model change
This commit is contained in:
parent
d0f278624e
commit
d86dcc3562
|
@ -1,21 +0,0 @@
|
|||
package com.loafle.overflow.central.commons.exception;
|
||||
|
||||
import io.grpc.Status;
|
||||
|
||||
public class OverflowException extends Exception {
|
||||
protected Status.Code code;
|
||||
|
||||
public OverflowException(Status.Code code) {
|
||||
super();
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public OverflowException(Status.Code code, String message) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Status.Code getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package com.loafle.overflow.central.commons.exception;
|
||||
|
||||
public class OverflowRuntimeException extends RuntimeException {
|
||||
public OverflowRuntimeException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OverflowRuntimeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
package com.loafle.overflow.central.commons.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by geek on 18. 1. 3.
|
||||
*/
|
||||
public class Mail {
|
||||
private String mailFrom;
|
||||
|
||||
private String mailTo;
|
||||
|
||||
private String mailCc;
|
||||
|
||||
private String mailBcc;
|
||||
|
||||
private String mailSubject;
|
||||
|
||||
private String mailContent;
|
||||
|
||||
private String contentType;
|
||||
|
||||
private List< Object > attachments;
|
||||
|
||||
private Map< String, Object > model;
|
||||
|
||||
public Mail() {
|
||||
contentType = "text/plain";
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
public String getMailBcc() {
|
||||
return mailBcc;
|
||||
}
|
||||
|
||||
public void setMailBcc(String mailBcc) {
|
||||
this.mailBcc = mailBcc;
|
||||
}
|
||||
|
||||
public String getMailCc() {
|
||||
return mailCc;
|
||||
}
|
||||
|
||||
public void setMailCc(String mailCc) {
|
||||
this.mailCc = mailCc;
|
||||
}
|
||||
|
||||
public String getMailFrom() {
|
||||
return mailFrom;
|
||||
}
|
||||
|
||||
public void setMailFrom(String mailFrom) {
|
||||
this.mailFrom = mailFrom;
|
||||
}
|
||||
|
||||
public String getMailSubject() {
|
||||
return mailSubject;
|
||||
}
|
||||
|
||||
public void setMailSubject(String mailSubject) {
|
||||
this.mailSubject = mailSubject;
|
||||
}
|
||||
|
||||
public String getMailTo() {
|
||||
return mailTo;
|
||||
}
|
||||
|
||||
public void setMailTo(String mailTo) {
|
||||
this.mailTo = mailTo;
|
||||
}
|
||||
|
||||
public Date getMailSendDate() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
public String getMailContent() {
|
||||
return mailContent;
|
||||
}
|
||||
|
||||
public void setMailContent(String mailContent) {
|
||||
this.mailContent = mailContent;
|
||||
}
|
||||
|
||||
public List< Object > getAttachments() {
|
||||
return attachments;
|
||||
}
|
||||
|
||||
public void setAttachments(List < Object > attachments) {
|
||||
this.attachments = attachments;
|
||||
}
|
||||
|
||||
public Map< String, Object > getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setModel(Map < String, Object > model) {
|
||||
this.model = model;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package com.loafle.overflow.central.commons.model;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 8. 25.
|
||||
*/
|
||||
public class PageParams {
|
||||
|
||||
private int pageNo;
|
||||
private int countPerPage;
|
||||
private String sortCol;
|
||||
private String sortDirection;
|
||||
|
||||
public int getPageNo() {
|
||||
return pageNo;
|
||||
}
|
||||
|
||||
public void setPageNo(int pageNo) {
|
||||
this.pageNo = pageNo;
|
||||
}
|
||||
|
||||
public int getCountPerPage() {
|
||||
return countPerPage;
|
||||
}
|
||||
|
||||
public void setCountPerPage(int countPerPage) {
|
||||
this.countPerPage = countPerPage;
|
||||
}
|
||||
|
||||
public String getSortCol() {
|
||||
return sortCol;
|
||||
}
|
||||
|
||||
public void setSortCol(String sortCol) {
|
||||
this.sortCol = sortCol;
|
||||
}
|
||||
|
||||
public String getSortDirection() {
|
||||
return sortDirection;
|
||||
}
|
||||
|
||||
public void setSortDirection(String sortDirection) {
|
||||
this.sortDirection = sortDirection;
|
||||
}
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
package com.loafle.overflow.central.commons.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PublishMessage {
|
||||
private TargetType targetType;
|
||||
private List<String> targets;
|
||||
private PublishMessageBody message;
|
||||
|
||||
public void setTargetType(TargetType targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
public TargetType getTargetType() {
|
||||
return this.targetType;
|
||||
}
|
||||
|
||||
public void setTargets(List<String> targets) {
|
||||
this.targets = targets;
|
||||
}
|
||||
|
||||
public void addTarget(String target) {
|
||||
if (null == targets) {
|
||||
targets = new ArrayList<>();
|
||||
}
|
||||
targets.add(target);
|
||||
}
|
||||
|
||||
public List<String> getTargets() {
|
||||
return targets;
|
||||
}
|
||||
|
||||
public void setMessage(PublishMessageBody message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public PublishMessageBody getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public static enum TargetType {
|
||||
MEMBER_SESSION("MEMBER_SESSION"),
|
||||
MEMBER("MEMBER"),
|
||||
PROBE("PROBE");
|
||||
|
||||
final private String name;
|
||||
|
||||
private TargetType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PublishMessageBody {
|
||||
private String jsonrpc = "2.0";
|
||||
private PublishMessageBodyNotification result;
|
||||
|
||||
public PublishMessageBody() {
|
||||
this.result = new PublishMessageBodyNotification();
|
||||
|
||||
}
|
||||
public PublishMessageBody(String method) {
|
||||
this();
|
||||
this.result.setMethod(method);
|
||||
}
|
||||
public PublishMessageBody(String method, List<String> params) {
|
||||
this(method);
|
||||
this.result.setParams(params);
|
||||
}
|
||||
|
||||
public String getJsonrpc() {
|
||||
return jsonrpc;
|
||||
}
|
||||
|
||||
public void setJsonrpc(String jsonrpc) {
|
||||
this.jsonrpc = jsonrpc;
|
||||
}
|
||||
|
||||
public PublishMessageBodyNotification getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(PublishMessageBodyNotification result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PublishMessageBodyNotification {
|
||||
private String method;
|
||||
private List<String> params;
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public List<String> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(List<String> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public void addParams(String param) {
|
||||
if (null == this.params) {
|
||||
this.params = new ArrayList<>();
|
||||
}
|
||||
this.params.add(param);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package com.loafle.overflow.central.commons.model;
|
||||
|
||||
import io.grpc.Context;
|
||||
import io.grpc.Metadata;
|
||||
|
||||
import static io.grpc.Metadata.ASCII_STRING_MARSHALLER;
|
||||
|
||||
public class SessionMetadata {
|
||||
/*
|
||||
digits: 0-9
|
||||
uppercase letters: A-Z (normalized to lower)
|
||||
lowercase letters: a-z
|
||||
special characters: -_.
|
||||
*/
|
||||
|
||||
public static final String CLIENT_TYPE_KEY = "OVERFLOW_GRPC_CLIENT_TYPE";
|
||||
public static final String SESSION_ID_KEY = "OVERFLOW_GRPC_SESSION_ID";
|
||||
public static final String TARGET_ID_KEY = "OVERFLOW_GRPC_TARGET_ID";
|
||||
|
||||
public static final Context.Key<String> CTX_CLIENT_TYPE_KEY = Context.key(CLIENT_TYPE_KEY);
|
||||
public static final Context.Key<String> CTX_SESSION_ID_KEY = Context.key(SESSION_ID_KEY);
|
||||
public static final Context.Key<String> CTX_TARGET_ID_KEY = Context.key(TARGET_ID_KEY);
|
||||
|
||||
public static final Metadata.Key<String> METADATA_CLIENT_TYPE_KEY = Metadata.Key.of(CLIENT_TYPE_KEY, ASCII_STRING_MARSHALLER);
|
||||
public static final Metadata.Key<String> METADATA_SESSION_ID_KEY = Metadata.Key.of(SESSION_ID_KEY, ASCII_STRING_MARSHALLER);
|
||||
public static final Metadata.Key<String> METADATA_TARGET_ID_KEY = Metadata.Key.of(TARGET_ID_KEY, ASCII_STRING_MARSHALLER);
|
||||
|
||||
public static ClientType getClientType() {
|
||||
return ClientType.valueOf(CTX_CLIENT_TYPE_KEY.get());
|
||||
}
|
||||
public static String getSessionID() {
|
||||
return CTX_SESSION_ID_KEY.get();
|
||||
}
|
||||
public static String getTargetID() {
|
||||
return CTX_TARGET_ID_KEY.get();
|
||||
}
|
||||
|
||||
public static enum ClientType {
|
||||
MEMBER("MEMBER"),
|
||||
PROBE("PROBE");
|
||||
|
||||
final private String name;
|
||||
|
||||
private ClientType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package com.loafle.overflow.central.commons.utils;
|
||||
|
||||
import com.loafle.overflow.central.commons.model.Mail;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.velocity.app.VelocityEngine;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -16,6 +15,9 @@ import javax.crypto.spec.IvParameterSpec;
|
|||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import com.loafle.overflow.core.model.Mail;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.loafle.overflow.central.module.sensor.dao;
|
||||
|
||||
import com.loafle.overflow.central.module.meta.model.MetaSensorDisplayItem;
|
||||
import com.loafle.overflow.central.module.meta.model.MetaSensorItemKey;
|
||||
import com.loafle.overflow.model.meta.MetaSensorDisplayItem;
|
||||
import com.loafle.overflow.model.meta.MetaSensorItemKey;
|
||||
import com.loafle.overflow.model.sensor.SensorItemDependency;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
package com.loafle.overflow.central.module.sensor.service;
|
||||
|
||||
import com.loafle.overflow.central.commons.model.PageParams;
|
||||
import com.loafle.overflow.central.commons.utils.PageUtil;
|
||||
import com.loafle.overflow.central.module.generator.service.SensorConfigGenerator;
|
||||
import com.loafle.overflow.central.module.infra.exception.InfraNotFoundException;
|
||||
import com.loafle.overflow.central.module.infra.service.InfraService;
|
||||
import com.loafle.overflow.central.module.meta.service.MetaSensorItemKeyService;
|
||||
import com.loafle.overflow.central.module.probe.exception.ProbeNotFoundException;
|
||||
import com.loafle.overflow.central.module.sensor.dao.SensorDAO;
|
||||
import com.loafle.overflow.central.module.target.exception.TargetNotFoundException;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.core.model.PageParams;
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.model.infra.Infra;
|
||||
import com.loafle.overflow.model.meta.MetaSensorStatus;
|
||||
|
@ -17,6 +12,7 @@ import com.loafle.overflow.model.probe.Probe;
|
|||
import com.loafle.overflow.model.sensor.Sensor;
|
||||
import com.loafle.overflow.model.sensor.SensorItem;
|
||||
import com.loafle.overflow.model.target.Target;
|
||||
import com.loafle.overflow.service.central.infra.InfraService;
|
||||
import com.loafle.overflow.service.central.probe.ProbeService;
|
||||
import com.loafle.overflow.service.central.sensor.SensorService;
|
||||
|
||||
|
@ -58,13 +54,13 @@ public class CentralSensorService implements SensorService {
|
|||
List<Probe> probeList = this.probeService.readAllByDomain(domain);
|
||||
|
||||
if (probeList == null || probeList.size() <= 0) {
|
||||
throw new ProbeNotFoundException();
|
||||
throw new OverflowException("", new Throwable());
|
||||
}
|
||||
|
||||
List<Target> targetList = this.infraService.readAllTargetByProbeList(probeList);
|
||||
|
||||
if (targetList == null || targetList.size() <= 0) {
|
||||
throw new TargetNotFoundException();
|
||||
throw new OverflowException("", new Throwable());
|
||||
}
|
||||
|
||||
return this.sensorDAO.findAllByTargetList(targetList, PageUtil.getPageRequest(pageParams));
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.loafle.overflow.central.module.target.service;
|
||||
|
||||
import com.loafle.overflow.central.module.infra.service.*;
|
||||
import com.loafle.overflow.service.central.target.TargetService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user