com.envision.event.bean.Event Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eos-event-api-new Show documentation
Show all versions of eos-event-api-new Show documentation
1.0 初版
1.1 增加了event的flag和custom_attr字段。
The newest version!
package com.envision.event.bean;
import com.envision.event.rule.EventRule;
import java.io.Serializable;
/**
* 事件对象
*
* @author kang.ouyang
*
*/
public class Event implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
// event ID
private String ID;
private String customerID;
// 设备ID
private String deviceID;
private String deviceType;
// 场站ID
private String siteID;
private String pointID;
private String warnType;
private String childWarnType;
private String warnGroup;
private String level;
private String value;
// 事件代码,来自规则表中的status字段
private String code;
private String opPerson;
private String category;
private String confirmPerson;
private String confirmValue;
private Long confirmTime;
private Long occurTime;
private Long endTime;
// 1:告警事件,0:告警恢复事件,其他值:普通事件
private Integer eventType;
private String tag;
// 描述,json字符串,包含多语言,eg:{"zh-CN":"母线电压波动"}
private String description;
// 告警内容,由外部填入
private String content;
private Integer flag;
//用户自定义字段,每个用户对于这个字段的使用可以不一样
private String customAttr;
public Event() {
}
public Event(DataPoint point, EventRule rule) {
// 拷贝自数据点的属性
this.pointID = point.getPointID();
this.deviceID = point.getDeviceID();
this.siteID = point.getSiteID();
this.value = point.getValue();
long ts = point.getDeviceTime();
if (ts <= 0) {
ts = point.getCloudTime();
}
this.occurTime = ts;
this.customerID = point.getCustomerID();
this.deviceType = point.getDeviceType();
// 拷贝自规则的属性
this.warnType = rule.getAlarmTypeId();
this.childWarnType = rule.getChildAlarmTypeId();
this.category = rule.getCategory();
this.level = rule.getRank();
this.code = rule.getStatus();
this.eventType = rule.getEventType();
this.tag = rule.getTag();
this.description = rule.getDescription();
}
public Integer getFlag() {
return flag;
}
public void setFlag(Integer flag) {
this.flag = flag;
}
public String getCustomAttr() {
return customAttr;
}
public void setCustomAttr(String customAttr) {
this.customAttr = customAttr;
}
public String getCustomerID() {
return customerID;
}
public void setCustomerID(String customerID) {
this.customerID = customerID;
}
public String getID() {
return ID;
}
public void setID(String iD) {
ID = iD;
}
public String getDeviceID() {
return deviceID;
}
public void setDeviceID(String deviceID) {
this.deviceID = deviceID;
}
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
public String getSiteID() {
return siteID;
}
public void setSiteID(String siteID) {
this.siteID = siteID;
}
public String getPointID() {
return pointID;
}
public void setPointID(String pointID) {
this.pointID = pointID;
}
public String getWarnType() {
return warnType;
}
public void setWarnType(String warnType) {
this.warnType = warnType;
}
public String getChildWarnType() {
return childWarnType;
}
public void setChildWarnType(String childWarnType) {
this.childWarnType = childWarnType;
}
public String getWarnGroup() {
return warnGroup;
}
public void setWarnGroup(String warnGroup) {
this.warnGroup = warnGroup;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getOpPerson() {
return opPerson;
}
public void setOpPerson(String opPerson) {
this.opPerson = opPerson;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getConfirmPerson() {
return confirmPerson;
}
public void setConfirmPerson(String confirmPerson) {
this.confirmPerson = confirmPerson;
}
public String getConfirmValue() {
return confirmValue;
}
public void setConfirmValue(String confirmValue) {
this.confirmValue = confirmValue;
}
public Long getConfirmTime() {
return confirmTime;
}
public void setConfirmTime(Long confirmTime) {
this.confirmTime = confirmTime;
}
public Long getOccurTime() {
return occurTime;
}
public void setOccurTime(Long occurTime) {
this.occurTime = occurTime;
}
public Long getEndTime() {
return endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
/**
* 事件类型,1:告警事件,0:告警恢复事件,其他值:普通事件(非告警类事件)
*
* @return
*/
public Integer getEventType() {
return eventType;
}
public void setEventType(Integer eventType) {
this.eventType = eventType;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("{devId:").append(deviceID).append(",point:").append(pointID)
.append(",value:").append(value).append(",occur:").append(occurTime).append(",type:").append(eventType)
.append(",id:").append(ID).append("}");
return builder.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy