1、增加maat结构配置对象类,以及界面配置转换maat配置的测试类
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
package com.nis.domain.maat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
@@ -27,80 +28,518 @@ import com.nis.domain.configuration.NumBoundaryCfg;
|
||||
*/
|
||||
public class MaatCfg implements Serializable {
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private Integer compileId;
|
||||
private Integer action;
|
||||
@SerializedName("service")
|
||||
private Integer serviceId;
|
||||
@SerializedName("contType")
|
||||
private String classify;//分类
|
||||
@SerializedName("attrType")
|
||||
private String attribute;//性质
|
||||
@SerializedName("contLabel")
|
||||
private String lable;//标签
|
||||
private Integer taskId;
|
||||
@SerializedName("guaranteeId")
|
||||
private Integer functionId;
|
||||
@SerializedName("effectiveRange")
|
||||
private String areaEffectiveIds ;
|
||||
private Integer doBlackList;
|
||||
private Integer doLog;
|
||||
private Integer activeSys;
|
||||
private Integer configPercent;
|
||||
private Integer configOption;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
private String userRegion;
|
||||
private Integer groupNum;
|
||||
private Integer fatherCfgId;
|
||||
@SerializedName("opTime")
|
||||
private Date auditTime;
|
||||
private List<GroupCfg> groupRelationList;
|
||||
private List<StringCfg> strRegionList;
|
||||
private List<IpCfg> ipRegionList;
|
||||
private List<NumBoundaryCfg> numRegionList;
|
||||
private List<DigestCfg> digestRegionList;
|
||||
|
||||
private static final long serialVersionUID = -7745084076394247318L;
|
||||
@Expose
|
||||
@SerializedName("strCfg")
|
||||
private List<BaseStringCfg> strCfg;
|
||||
@Expose
|
||||
@SerializedName("ipCfg")
|
||||
private List<BaseIpCfg> ipCfg;
|
||||
@Expose
|
||||
@SerializedName("numCfg")
|
||||
private List<NumBoundaryCfg> numCfg;
|
||||
@Expose
|
||||
@SerializedName("complexStrCfg")
|
||||
private List<ComplexkeywordCfg> complexStrCfg;
|
||||
/**
|
||||
* strCfg
|
||||
* @return strCfg
|
||||
*/
|
||||
|
||||
public List<BaseStringCfg> getStrCfg() {
|
||||
return strCfg;
|
||||
public static class GroupCfg{
|
||||
private Integer groupId;
|
||||
private Integer compileId;
|
||||
private Integer isValid;
|
||||
private Date opTime;
|
||||
public Integer getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
public void setGroupId(Integer groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
public Integer getCompileId() {
|
||||
return compileId;
|
||||
}
|
||||
public void setCompileId(Integer compileId) {
|
||||
this.compileId = compileId;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Date getOpTime() {
|
||||
return opTime;
|
||||
}
|
||||
public void setOpTime(Date opTime) {
|
||||
this.opTime = opTime;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @param strCfg the strCfg to set
|
||||
*/
|
||||
public void setStrCfg(List<BaseStringCfg> strCfg) {
|
||||
this.strCfg = strCfg;
|
||||
public static class StringCfg{
|
||||
private Integer regionId;
|
||||
private Integer groupId;
|
||||
@SerializedName("tableName")
|
||||
private String cfgType;
|
||||
private String district;
|
||||
@SerializedName("keywords")
|
||||
private String cfgKeywords;
|
||||
private Integer exprType;
|
||||
private Integer matchMethod;
|
||||
private Integer isHexbin;
|
||||
private Integer isValid;
|
||||
private Date opTime;
|
||||
public Integer getRegionId() {
|
||||
return regionId;
|
||||
}
|
||||
public void setRegionId(Integer regionId) {
|
||||
this.regionId = regionId;
|
||||
}
|
||||
public Integer getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
public void setGroupId(Integer groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
public String getCfgType() {
|
||||
return cfgType;
|
||||
}
|
||||
public void setCfgType(String cfgType) {
|
||||
this.cfgType = cfgType;
|
||||
}
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
public String getCfgKeywords() {
|
||||
return cfgKeywords;
|
||||
}
|
||||
public void setCfgKeywords(String cfgKeywords) {
|
||||
this.cfgKeywords = cfgKeywords;
|
||||
}
|
||||
public Integer getExprType() {
|
||||
return exprType;
|
||||
}
|
||||
public void setExprType(Integer exprType) {
|
||||
this.exprType = exprType;
|
||||
}
|
||||
public Integer getMatchMethod() {
|
||||
return matchMethod;
|
||||
}
|
||||
public void setMatchMethod(Integer matchMethod) {
|
||||
this.matchMethod = matchMethod;
|
||||
}
|
||||
public Integer getIsHexbin() {
|
||||
return isHexbin;
|
||||
}
|
||||
public void setIsHexbin(Integer isHexbin) {
|
||||
this.isHexbin = isHexbin;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Date getOpTime() {
|
||||
return opTime;
|
||||
}
|
||||
public void setOpTime(Date opTime) {
|
||||
this.opTime = opTime;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* ipCfg
|
||||
* @return ipCfg
|
||||
*/
|
||||
|
||||
public List<BaseIpCfg> getIpCfg() {
|
||||
return ipCfg;
|
||||
public static class IpCfg{
|
||||
private Integer regionId;
|
||||
private Integer groupId;
|
||||
@SerializedName("tableName")
|
||||
private String cfgType;
|
||||
private Integer ipType;
|
||||
private String srcIp;
|
||||
private String srcIpMask ;
|
||||
private String srcPort ;
|
||||
private String srcPortMask ;
|
||||
private String dstIp ;
|
||||
private String dstIpMask ;
|
||||
private String dstPort ;
|
||||
private String dstPortMask ;
|
||||
private Integer direction ;
|
||||
private Integer protocol ;
|
||||
private Integer isValid;
|
||||
private Date opTime;
|
||||
public Integer getRegionId() {
|
||||
return regionId;
|
||||
}
|
||||
public void setRegionId(Integer regionId) {
|
||||
this.regionId = regionId;
|
||||
}
|
||||
public Integer getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
public void setGroupId(Integer groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
public String getCfgType() {
|
||||
return cfgType;
|
||||
}
|
||||
public void setCfgType(String cfgType) {
|
||||
this.cfgType = cfgType;
|
||||
}
|
||||
public Integer getIpType() {
|
||||
return ipType;
|
||||
}
|
||||
public void setIpType(Integer ipType) {
|
||||
this.ipType = ipType;
|
||||
}
|
||||
public String getSrcIp() {
|
||||
return srcIp;
|
||||
}
|
||||
public void setSrcIp(String srcIp) {
|
||||
this.srcIp = srcIp;
|
||||
}
|
||||
public String getSrcIpMask() {
|
||||
return srcIpMask;
|
||||
}
|
||||
public void setSrcIpMask(String srcIpMask) {
|
||||
this.srcIpMask = srcIpMask;
|
||||
}
|
||||
public String getSrcPort() {
|
||||
return srcPort;
|
||||
}
|
||||
public void setSrcPort(String srcPort) {
|
||||
this.srcPort = srcPort;
|
||||
}
|
||||
public String getSrcPortMask() {
|
||||
return srcPortMask;
|
||||
}
|
||||
public void setSrcPortMask(String srcPortMask) {
|
||||
this.srcPortMask = srcPortMask;
|
||||
}
|
||||
public String getDstIp() {
|
||||
return dstIp;
|
||||
}
|
||||
public void setDstIp(String dstIp) {
|
||||
this.dstIp = dstIp;
|
||||
}
|
||||
public String getDstIpMask() {
|
||||
return dstIpMask;
|
||||
}
|
||||
public void setDstIpMask(String dstIpMask) {
|
||||
this.dstIpMask = dstIpMask;
|
||||
}
|
||||
public String getDstPort() {
|
||||
return dstPort;
|
||||
}
|
||||
public void setDstPort(String dstPort) {
|
||||
this.dstPort = dstPort;
|
||||
}
|
||||
public String getDstPortMask() {
|
||||
return dstPortMask;
|
||||
}
|
||||
public void setDstPortMask(String dstPortMask) {
|
||||
this.dstPortMask = dstPortMask;
|
||||
}
|
||||
public Integer getDirection() {
|
||||
return direction;
|
||||
}
|
||||
public void setDirection(Integer direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
public Integer getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
public void setProtocol(Integer protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Date getOpTime() {
|
||||
return opTime;
|
||||
}
|
||||
public void setOpTime(Date opTime) {
|
||||
this.opTime = opTime;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param ipCfg the ipCfg to set
|
||||
*/
|
||||
public void setIpCfg(List<BaseIpCfg> ipCfg) {
|
||||
this.ipCfg = ipCfg;
|
||||
public static class NumBoundaryCfg{
|
||||
private Integer regionId;
|
||||
private Integer groupId;
|
||||
@SerializedName("tableName")
|
||||
private String cfgType;
|
||||
private Integer lowBoundary;
|
||||
private Integer upBoundary;
|
||||
private Integer isValid;
|
||||
private Date opTime;
|
||||
public Integer getRegionId() {
|
||||
return regionId;
|
||||
}
|
||||
public void setRegionId(Integer regionId) {
|
||||
this.regionId = regionId;
|
||||
}
|
||||
public Integer getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
public void setGroupId(Integer groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
public String getCfgType() {
|
||||
return cfgType;
|
||||
}
|
||||
public void setCfgType(String cfgType) {
|
||||
this.cfgType = cfgType;
|
||||
}
|
||||
public Integer getLowBoundary() {
|
||||
return lowBoundary;
|
||||
}
|
||||
public void setLowBoundary(Integer lowBoundary) {
|
||||
this.lowBoundary = lowBoundary;
|
||||
}
|
||||
public Integer getUpBoundary() {
|
||||
return upBoundary;
|
||||
}
|
||||
public void setUpBoundary(Integer upBoundary) {
|
||||
this.upBoundary = upBoundary;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Date getOpTime() {
|
||||
return opTime;
|
||||
}
|
||||
public void setOpTime(Date opTime) {
|
||||
this.opTime = opTime;
|
||||
}
|
||||
}public static class DigestCfg{
|
||||
private Integer regionId;
|
||||
private Integer groupId;
|
||||
@SerializedName("tableName")
|
||||
private String cfgType;
|
||||
private Integer rawLen;
|
||||
private String digest;
|
||||
private Integer cfdsLevel;
|
||||
private Integer isValid;
|
||||
private Date opTime;
|
||||
public Integer getRegionId() {
|
||||
return regionId;
|
||||
}
|
||||
public void setRegionId(Integer regionId) {
|
||||
this.regionId = regionId;
|
||||
}
|
||||
public Integer getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
public void setGroupId(Integer groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
public String getCfgType() {
|
||||
return cfgType;
|
||||
}
|
||||
public void setCfgType(String cfgType) {
|
||||
this.cfgType = cfgType;
|
||||
}
|
||||
public Integer getRawLen() {
|
||||
return rawLen;
|
||||
}
|
||||
public void setRawLen(Integer rawLen) {
|
||||
this.rawLen = rawLen;
|
||||
}
|
||||
public String getDigest() {
|
||||
return digest;
|
||||
}
|
||||
public void setDigest(String digest) {
|
||||
this.digest = digest;
|
||||
}
|
||||
public Integer getCfdsLevel() {
|
||||
return cfdsLevel;
|
||||
}
|
||||
public void setCfdsLevel(Integer cfdsLevel) {
|
||||
this.cfdsLevel = cfdsLevel;
|
||||
}
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
public Date getOpTime() {
|
||||
return opTime;
|
||||
}
|
||||
public void setOpTime(Date opTime) {
|
||||
this.opTime = opTime;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* numCfg
|
||||
* @return numCfg
|
||||
*/
|
||||
|
||||
public List<NumBoundaryCfg> getNumCfg() {
|
||||
return numCfg;
|
||||
public Integer getCompileId() {
|
||||
return compileId;
|
||||
}
|
||||
/**
|
||||
* @param numCfg the numCfg to set
|
||||
*/
|
||||
public void setNumCfg(List<NumBoundaryCfg> numCfg) {
|
||||
this.numCfg = numCfg;
|
||||
public void setCompileId(Integer compileId) {
|
||||
this.compileId = compileId;
|
||||
}
|
||||
/**
|
||||
* complexStrCfg
|
||||
* @return complexStrCfg
|
||||
*/
|
||||
|
||||
public List<ComplexkeywordCfg> getComplexStrCfg() {
|
||||
return complexStrCfg;
|
||||
public Integer getAction() {
|
||||
return action;
|
||||
}
|
||||
/**
|
||||
* @param complexStrCfg the complexStrCfg to set
|
||||
*/
|
||||
public void setComplexStrCfg(List<ComplexkeywordCfg> complexStrCfg) {
|
||||
this.complexStrCfg = complexStrCfg;
|
||||
public void setAction(Integer action) {
|
||||
this.action = action;
|
||||
}
|
||||
public Integer getServiceId() {
|
||||
return serviceId;
|
||||
}
|
||||
public void setServiceId(Integer serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
}
|
||||
public String getClassify() {
|
||||
return classify;
|
||||
}
|
||||
public void setClassify(String classify) {
|
||||
this.classify = classify;
|
||||
}
|
||||
public String getAttribute() {
|
||||
return attribute;
|
||||
}
|
||||
public void setAttribute(String attribute) {
|
||||
this.attribute = attribute;
|
||||
}
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
public Integer getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
public void setTaskId(Integer taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
public Integer getFunctionId() {
|
||||
return functionId;
|
||||
}
|
||||
public void setFunctionId(Integer functionId) {
|
||||
this.functionId = functionId;
|
||||
}
|
||||
public String getAreaEffectiveIds() {
|
||||
return areaEffectiveIds;
|
||||
}
|
||||
public void setAreaEffectiveIds(String areaEffectiveIds) {
|
||||
this.areaEffectiveIds = areaEffectiveIds;
|
||||
}
|
||||
public Integer getDoBlackList() {
|
||||
return doBlackList;
|
||||
}
|
||||
public void setDoBlackList(Integer doBlackList) {
|
||||
this.doBlackList = doBlackList;
|
||||
}
|
||||
public Integer getDoLog() {
|
||||
return doLog;
|
||||
}
|
||||
public void setDoLog(Integer doLog) {
|
||||
this.doLog = doLog;
|
||||
}
|
||||
public Integer getActiveSys() {
|
||||
return activeSys;
|
||||
}
|
||||
public void setActiveSys(Integer activeSys) {
|
||||
this.activeSys = activeSys;
|
||||
}
|
||||
public Integer getConfigPercent() {
|
||||
return configPercent;
|
||||
}
|
||||
public void setConfigPercent(Integer configPercent) {
|
||||
this.configPercent = configPercent;
|
||||
}
|
||||
public Integer getConfigOption() {
|
||||
return configOption;
|
||||
}
|
||||
public void setConfigOption(Integer configOption) {
|
||||
this.configOption = configOption;
|
||||
}
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
public String getUserRegion() {
|
||||
return userRegion;
|
||||
}
|
||||
public void setUserRegion(String userRegion) {
|
||||
this.userRegion = userRegion;
|
||||
}
|
||||
public Integer getGroupNum() {
|
||||
return groupNum;
|
||||
}
|
||||
public void setGroupNum(Integer groupNum) {
|
||||
this.groupNum = groupNum;
|
||||
}
|
||||
public Integer getFatherCfgId() {
|
||||
return fatherCfgId;
|
||||
}
|
||||
public void setFatherCfgId(Integer fatherCfgId) {
|
||||
this.fatherCfgId = fatherCfgId;
|
||||
}
|
||||
public Date getAuditTime() {
|
||||
return auditTime;
|
||||
}
|
||||
public void setAuditTime(Date auditTime) {
|
||||
this.auditTime = auditTime;
|
||||
}
|
||||
public List<GroupCfg> getGroupRelationList() {
|
||||
return groupRelationList;
|
||||
}
|
||||
public void setGroupRelationList(List<GroupCfg> groupRelationList) {
|
||||
this.groupRelationList = groupRelationList;
|
||||
}
|
||||
public List<StringCfg> getStrRegionList() {
|
||||
return strRegionList;
|
||||
}
|
||||
public void setStrRegionList(List<StringCfg> strRegionList) {
|
||||
this.strRegionList = strRegionList;
|
||||
}
|
||||
public List<IpCfg> getIpRegionList() {
|
||||
return ipRegionList;
|
||||
}
|
||||
public void setIpRegionList(List<IpCfg> ipRegionList) {
|
||||
this.ipRegionList = ipRegionList;
|
||||
}
|
||||
public List<NumBoundaryCfg> getNumRegionList() {
|
||||
return numRegionList;
|
||||
}
|
||||
public void setNumRegionList(List<NumBoundaryCfg> numRegionList) {
|
||||
this.numRegionList = numRegionList;
|
||||
}
|
||||
public List<DigestCfg> getDigestRegionList() {
|
||||
return digestRegionList;
|
||||
}
|
||||
public void setDigestRegionList(List<DigestCfg> digestRegionList) {
|
||||
this.digestRegionList = digestRegionList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
package com.nis.domain.maat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
|
||||
/**
|
||||
* @ClassName: ToMaatBean.java
|
||||
@@ -24,219 +24,52 @@ import com.nis.domain.configuration.AreaIpCfg;
|
||||
*/
|
||||
public class ToMaatBean implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3468862666445104490L;
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(转换为maat格式的java bean)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = 5123156423588372849L;
|
||||
@Expose
|
||||
@SerializedName("serviceCfg")
|
||||
private List<MaatCfg> serviceCfg;
|
||||
@Expose
|
||||
@SerializedName("areaCfg")
|
||||
private List<AreaIpCfg> areaCfg;
|
||||
@Expose
|
||||
@SerializedName("action")
|
||||
private Integer action;
|
||||
@Expose
|
||||
@SerializedName("areaEffectiveIds")
|
||||
private String areaEffectiveIds;
|
||||
@Expose
|
||||
@SerializedName("attribute")
|
||||
private String attribute;
|
||||
@Expose
|
||||
@SerializedName("classify")
|
||||
private String classify;
|
||||
@Expose
|
||||
@SerializedName("lable")
|
||||
private String lable;
|
||||
@Expose
|
||||
@SerializedName("compileId")
|
||||
private Integer compileId;
|
||||
@Expose
|
||||
@SerializedName("isAreaEffective")
|
||||
private Integer isAreaEffective;
|
||||
@Expose
|
||||
@SerializedName("isValid")
|
||||
private Integer isValid;
|
||||
@Expose
|
||||
@SerializedName("requestId")
|
||||
private Integer requestId;
|
||||
@Expose
|
||||
@SerializedName("serviceId")
|
||||
private Integer serviceId;
|
||||
|
||||
|
||||
/**
|
||||
* serviceCfg
|
||||
* @return serviceCfg
|
||||
*/
|
||||
|
||||
public List<MaatCfg> getServiceCfg() {
|
||||
return serviceCfg;
|
||||
private String version;
|
||||
@SerializedName("operator")
|
||||
private String creatorName;
|
||||
@SerializedName("opTime")
|
||||
private Date auditTime;
|
||||
private List<MaatCfg> configCompileList;
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
/**
|
||||
* @param serviceCfg the serviceCfg to set
|
||||
*/
|
||||
public void setServiceCfg(List<MaatCfg> serviceCfg) {
|
||||
this.serviceCfg = serviceCfg;
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
/**
|
||||
* areaCfg
|
||||
* @return areaCfg
|
||||
*/
|
||||
|
||||
public List<AreaIpCfg> getAreaCfg() {
|
||||
return areaCfg;
|
||||
|
||||
public String getCreatorName() {
|
||||
return creatorName;
|
||||
}
|
||||
/**
|
||||
* @param areaCfg the areaCfg to set
|
||||
*/
|
||||
public void setAreaCfg(List<AreaIpCfg> areaCfg) {
|
||||
this.areaCfg = areaCfg;
|
||||
|
||||
public void setCreatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
}
|
||||
/**
|
||||
* action
|
||||
* @return action
|
||||
*/
|
||||
|
||||
public Integer getAction() {
|
||||
return action;
|
||||
|
||||
public Date getAuditTime() {
|
||||
return auditTime;
|
||||
}
|
||||
/**
|
||||
* @param action the action to set
|
||||
*/
|
||||
public void setAction(Integer action) {
|
||||
this.action = action;
|
||||
|
||||
public void setAuditTime(Date auditTime) {
|
||||
this.auditTime = auditTime;
|
||||
}
|
||||
/**
|
||||
* areaEffectiveIds
|
||||
* @return areaEffectiveIds
|
||||
*/
|
||||
|
||||
public String getAreaEffectiveIds() {
|
||||
return areaEffectiveIds;
|
||||
|
||||
public List<MaatCfg> getConfigCompileList() {
|
||||
return configCompileList;
|
||||
}
|
||||
/**
|
||||
* @param areaEffectiveIds the areaEffectiveIds to set
|
||||
*/
|
||||
public void setAreaEffectiveIds(String areaEffectiveIds) {
|
||||
this.areaEffectiveIds = areaEffectiveIds;
|
||||
}
|
||||
/**
|
||||
* attribute
|
||||
* @return attribute
|
||||
*/
|
||||
|
||||
public String getAttribute() {
|
||||
return attribute;
|
||||
}
|
||||
/**
|
||||
* @param attribute the attribute to set
|
||||
*/
|
||||
public void setAttribute(String attribute) {
|
||||
this.attribute = attribute;
|
||||
}
|
||||
/**
|
||||
* classify
|
||||
* @return classify
|
||||
*/
|
||||
|
||||
public String getClassify() {
|
||||
return classify;
|
||||
}
|
||||
/**
|
||||
* @param classify the classify to set
|
||||
*/
|
||||
public void setClassify(String classify) {
|
||||
this.classify = classify;
|
||||
}
|
||||
|
||||
/**
|
||||
* lable
|
||||
* @return lable
|
||||
*/
|
||||
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
/**
|
||||
* @param lable the lable to set
|
||||
*/
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
/**
|
||||
* compileId
|
||||
* @return compileId
|
||||
*/
|
||||
|
||||
public Integer getCompileId() {
|
||||
return compileId;
|
||||
}
|
||||
/**
|
||||
* @param compileId the compileId to set
|
||||
*/
|
||||
public void setCompileId(Integer compileId) {
|
||||
this.compileId = compileId;
|
||||
}
|
||||
/**
|
||||
* isAreaEffective
|
||||
* @return isAreaEffective
|
||||
*/
|
||||
|
||||
public Integer getIsAreaEffective() {
|
||||
return isAreaEffective;
|
||||
}
|
||||
/**
|
||||
* @param isAreaEffective the isAreaEffective to set
|
||||
*/
|
||||
public void setIsAreaEffective(Integer isAreaEffective) {
|
||||
this.isAreaEffective = isAreaEffective;
|
||||
}
|
||||
/**
|
||||
* isValid
|
||||
* @return isValid
|
||||
*/
|
||||
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
/**
|
||||
* @param isValid the isValid to set
|
||||
*/
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
/**
|
||||
* requestId
|
||||
* @return requestId
|
||||
*/
|
||||
|
||||
public Integer getRequestId() {
|
||||
return requestId;
|
||||
}
|
||||
/**
|
||||
* @param requestId the requestId to set
|
||||
*/
|
||||
public void setRequestId(Integer requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
/**
|
||||
* serviceId
|
||||
* @return serviceId
|
||||
*/
|
||||
|
||||
public Integer getServiceId() {
|
||||
return serviceId;
|
||||
}
|
||||
/**
|
||||
* @param serviceId the serviceId to set
|
||||
*/
|
||||
public void setServiceId(Integer serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
|
||||
public void setConfigCompileList(List<MaatCfg> configCompileList) {
|
||||
this.configCompileList = configCompileList;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
@@ -367,7 +367,7 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
for(List<BaseCfg> cfg:cfgs){
|
||||
int compileId=0;
|
||||
ToMaatBean toMaatBean=new ToMaatBean();
|
||||
toMaatBean.setServiceCfg(new ArrayList<MaatCfg>());
|
||||
// toMaatBean.setServiceCfg(new ArrayList<MaatCfg>());
|
||||
MaatCfg maatCfg=new MaatCfg();
|
||||
for(BaseCfg c:cfg){
|
||||
if(c instanceof BaseIpCfg){
|
||||
@@ -472,60 +472,60 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
|
||||
}else if(c instanceof NumBoundaryCfg){
|
||||
compileId=compileId==0?c.getCompileId():compileId;
|
||||
if(maatCfg.getNumCfg()==null){
|
||||
/*if(maatCfg.getNumCfg()==null){
|
||||
List<NumBoundaryCfg> list=new ArrayList<NumBoundaryCfg>();
|
||||
list.add((NumBoundaryCfg)c);
|
||||
maatCfg.setNumCfg(list);
|
||||
}else{
|
||||
List<NumBoundaryCfg> list=maatCfg.getNumCfg();
|
||||
list.add((NumBoundaryCfg)c);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if(c.getAreaCfg()!=null){
|
||||
if(toMaatBean.getAreaCfg()!=null){
|
||||
/*if(toMaatBean.getAreaCfg()!=null){
|
||||
toMaatBean.getAreaCfg().addAll(c.getAreaCfg());
|
||||
}else{
|
||||
toMaatBean.setAreaCfg(new ArrayList<AreaIpCfg>());
|
||||
toMaatBean.getAreaCfg().addAll(c.getAreaCfg());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
toMaatBean.getServiceCfg().add(maatCfg);
|
||||
// toMaatBean.getServiceCfg().add(maatCfg);
|
||||
BaseCfg baseCfg=cfg.get(0);
|
||||
if(compileId==0){
|
||||
throw new RuntimeException("转换出错,未获取到正确的compileId");
|
||||
}else{
|
||||
toMaatBean.setCompileId(compileId);
|
||||
// toMaatBean.setCompileId(compileId);
|
||||
}
|
||||
if(baseCfg.getAction()==null){
|
||||
throw new RuntimeException("转换出错,未获取到正确的action");
|
||||
}else{
|
||||
toMaatBean.setAction(baseCfg.getAction());
|
||||
// toMaatBean.setAction(baseCfg.getAction());
|
||||
}
|
||||
if(baseCfg.getIsAreaEffective()==null){
|
||||
throw new RuntimeException("转换出错,未获取到正确的isAreaEffective");
|
||||
}else{
|
||||
toMaatBean.setIsAreaEffective(baseCfg.getIsAreaEffective());
|
||||
// toMaatBean.setIsAreaEffective(baseCfg.getIsAreaEffective());
|
||||
}
|
||||
if(baseCfg.getIsValid()==null){
|
||||
throw new RuntimeException("转换出错,未获取到正确的isValid");
|
||||
}else{
|
||||
toMaatBean.setIsValid(baseCfg.getIsValid());
|
||||
// toMaatBean.setIsValid(baseCfg.getIsValid());
|
||||
}
|
||||
if(baseCfg.getRequestId()==null){
|
||||
throw new RuntimeException("转换出错,未获取到正确的requestId");
|
||||
}else{
|
||||
toMaatBean.setRequestId(baseCfg.getRequestId());
|
||||
// toMaatBean.setRequestId(baseCfg.getRequestId());
|
||||
}
|
||||
if(baseCfg.getServiceId()==null){
|
||||
throw new RuntimeException("转换出错,未获取到正确的serviceId");
|
||||
}else{
|
||||
toMaatBean.setServiceId(baseCfg.getServiceId());
|
||||
// toMaatBean.setServiceId(baseCfg.getServiceId());
|
||||
}
|
||||
toMaatBean.setAreaEffectiveIds(baseCfg.getAreaEffectiveIds()==null?"":baseCfg.getAreaEffectiveIds());
|
||||
toMaatBean.setAttribute(baseCfg.getAttribute()==null?"":baseCfg.getAttribute());
|
||||
toMaatBean.setClassify(baseCfg.getClassify()==null?"":baseCfg.getClassify());
|
||||
toMaatBean.setLable(baseCfg.getLable()==null?"":baseCfg.getLable());
|
||||
// toMaatBean.setAreaEffectiveIds(baseCfg.getAreaEffectiveIds()==null?"":baseCfg.getAreaEffectiveIds());
|
||||
// toMaatBean.setAttribute(baseCfg.getAttribute()==null?"":baseCfg.getAttribute());
|
||||
// toMaatBean.setClassify(baseCfg.getClassify()==null?"":baseCfg.getClassify());
|
||||
// toMaatBean.setLable(baseCfg.getLable()==null?"":baseCfg.getLable());
|
||||
beans.add(toMaatBean);
|
||||
}
|
||||
String json=gson.toJson(beans);
|
||||
@@ -588,7 +588,7 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
}else{
|
||||
int compileId=0;
|
||||
ToMaatBean toMaatBean=new ToMaatBean();
|
||||
toMaatBean.setServiceCfg(new ArrayList<MaatCfg>());
|
||||
// toMaatBean.setServiceCfg(new ArrayList<MaatCfg>());
|
||||
MaatCfg maatCfg=new MaatCfg();
|
||||
for(BaseCfg c:cfg){
|
||||
if(c instanceof BaseIpCfg){
|
||||
@@ -692,7 +692,7 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
// }
|
||||
|
||||
}else if(c instanceof NumBoundaryCfg){
|
||||
compileId=compileId==0?c.getCompileId():compileId;
|
||||
/*compileId=compileId==0?c.getCompileId():compileId;
|
||||
if(maatCfg.getNumCfg()==null){
|
||||
List<NumBoundaryCfg> list=new ArrayList<NumBoundaryCfg>();
|
||||
list.add((NumBoundaryCfg)c);
|
||||
@@ -700,10 +700,10 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
}else{
|
||||
List<NumBoundaryCfg> list=maatCfg.getNumCfg();
|
||||
list.add((NumBoundaryCfg)c);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
if(areaCfg!=null){
|
||||
/*if(areaCfg!=null){
|
||||
toMaatBean.setAreaCfg(areaCfg);
|
||||
}else{
|
||||
toMaatBean.setAreaCfg(new ArrayList<AreaIpCfg>());
|
||||
@@ -743,7 +743,7 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
toMaatBean.setAreaEffectiveIds(baseCfg.getAreaEffectiveIds()==null?"":baseCfg.getAreaEffectiveIds());
|
||||
toMaatBean.setAttribute(baseCfg.getAttribute()==null?"":baseCfg.getAttribute());
|
||||
toMaatBean.setClassify(baseCfg.getClassify()==null?"":baseCfg.getClassify());
|
||||
toMaatBean.setLable(baseCfg.getLable()==null?"":baseCfg.getLable());
|
||||
toMaatBean.setLable(baseCfg.getLable()==null?"":baseCfg.getLable());*/
|
||||
|
||||
String json=gson.toJson(toMaatBean);
|
||||
logger.info("to maat json:"+json);
|
||||
|
||||
179
src/main/java/com/nis/web/test/MaatCfgConverTest.java
Normal file
179
src/main/java/com/nis/web/test/MaatCfgConverTest.java
Normal file
@@ -0,0 +1,179 @@
|
||||
package com.nis.web.test;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
||||
import com.nis.domain.maat.MaatCfg.IpCfg;
|
||||
import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.util.IpUtil;
|
||||
|
||||
public class MaatCfgConverTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
List<BaseIpCfg> ipList = new ArrayList();
|
||||
List<IpCfg> ipRegion = new ArrayList();
|
||||
List<StringCfg> strRegion = new ArrayList();
|
||||
List<MaatCfg> maatList = new ArrayList();
|
||||
List<GroupCfg> groupList = new ArrayList();
|
||||
ToMaatBean maat = new ToMaatBean();
|
||||
BaseStringCfg str = new BaseStringCfg();
|
||||
BaseIpCfg ip = new BaseIpCfg();
|
||||
ip.setIpPattern(1);
|
||||
ip.setIpType(4);
|
||||
ip.setSrcIpAddress("192.168.10.0/24");
|
||||
ip.setPortPattern(2);
|
||||
ip.setSrcPort("8080-8089");
|
||||
ip.setCompileId(123);
|
||||
ip.setProtocol(6);
|
||||
ip.setDirection(2);
|
||||
ipList.add(ip);
|
||||
ip = new BaseIpCfg();
|
||||
ip.setIpPattern(2);
|
||||
ip.setIpType(4);
|
||||
ip.setSrcIpAddress("10.0.6.0-10.0.6.100");
|
||||
ip.setPortPattern(1);
|
||||
ip.setSrcPort("7080/65534");
|
||||
ip.setCompileId(124);
|
||||
ip.setDirection(1);
|
||||
ip.setProtocol(17);
|
||||
ipList.add(ip);
|
||||
|
||||
GroupCfg group = new GroupCfg();
|
||||
int groupId = 0;
|
||||
if(ipList.size()>0){
|
||||
groupId++;
|
||||
group.setGroupId(groupId);
|
||||
group.setCompileId(1);
|
||||
group.setOpTime(new Date());
|
||||
group.setIsValid(1);
|
||||
groupList.add(group);
|
||||
}
|
||||
|
||||
int regionId = 1;
|
||||
|
||||
for(BaseIpCfg c:ipList){
|
||||
IpCfg ipCfg = new IpCfg();
|
||||
ipCfg.setRegionId(regionId);
|
||||
if(c.getIpPattern()==1){
|
||||
ipCfg.setSrcIp(c.getSrcIpAddress().split("/")[0]);
|
||||
ipCfg.setSrcIpMask(IpUtil.convertMask(Integer.parseInt(c.getSrcIpAddress().split("/")[1])));
|
||||
}else if(c.getIpPattern()==2){
|
||||
ipCfg.setSrcIp(c.getSrcIpAddress().split("-")[0]);
|
||||
ipCfg.setSrcIpMask(IpUtil.getMask(c.getSrcIpAddress().split("-")[0], c.getSrcIpAddress().split("-")[1]));
|
||||
}
|
||||
if(c.getPortPattern()==1){
|
||||
ipCfg.setSrcPort(c.getSrcPort().split("/")[0]);
|
||||
ipCfg.setSrcPortMask(c.getSrcPort().split("/")[1]);
|
||||
}else if(c.getPortPattern()==2){
|
||||
ipCfg.setSrcPort(c.getSrcPort().split("-")[0]);
|
||||
Integer portMask = Integer.parseInt(c.getSrcPort().split("-")[1])-Integer.parseInt(c.getSrcPort().split("-")[0]);
|
||||
ipCfg.setSrcPortMask(portMask.toString());
|
||||
}
|
||||
ipCfg.setDirection(c.getDirection());
|
||||
ipCfg.setProtocol(c.getProtocol());
|
||||
ipCfg.setGroupId(groupId);
|
||||
ipRegion.add(ipCfg);
|
||||
regionId++;
|
||||
}
|
||||
List<BaseStringCfg> list1 = new ArrayList();
|
||||
str.setAction(1);
|
||||
str.setCfgKeywords("测试1");
|
||||
list1.add(str);
|
||||
str = new BaseStringCfg();
|
||||
str.setAction(2);
|
||||
str.setCfgKeywords("测试2");
|
||||
list1.add(str);
|
||||
if(list1.size()>0){
|
||||
groupId++;
|
||||
group.setGroupId(groupId);
|
||||
group.setCompileId(1);
|
||||
group.setOpTime(new Date());
|
||||
group.setIsValid(1);
|
||||
groupList.add(group);
|
||||
}
|
||||
for(BaseStringCfg c:list1){
|
||||
StringCfg strCfg = new StringCfg();
|
||||
try {
|
||||
BeanUtils.copyProperties(strCfg, c);
|
||||
strCfg.setRegionId(regionId);
|
||||
strCfg.setGroupId(groupId);
|
||||
strRegion.add(strCfg);
|
||||
} catch (IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
regionId++;
|
||||
}
|
||||
ComplexkeywordCfg complex = new ComplexkeywordCfg();
|
||||
List<ComplexkeywordCfg> list2 = new ArrayList();
|
||||
complex.setAction(1);
|
||||
complex.setDistrict("UA");
|
||||
complex.setKeywords("测试1");
|
||||
list2.add(complex);
|
||||
str = new BaseStringCfg();
|
||||
complex.setAction(1);
|
||||
complex.setDistrict("cookie");
|
||||
complex.setKeywords("测试2");
|
||||
list2.add(complex);
|
||||
if(list2.size()>0){
|
||||
groupId++;
|
||||
group.setGroupId(groupId);
|
||||
group.setCompileId(1);
|
||||
group.setOpTime(new Date());
|
||||
group.setIsValid(1);
|
||||
groupList.add(group);
|
||||
}
|
||||
for(ComplexkeywordCfg c:list2){
|
||||
StringCfg strCfg = new StringCfg();
|
||||
try {
|
||||
BeanUtils.copyProperties(strCfg, c);
|
||||
strCfg.setRegionId(regionId);
|
||||
strCfg.setGroupId(groupId);
|
||||
strRegion.add(strCfg);
|
||||
} catch (IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
regionId++;
|
||||
}
|
||||
MaatCfg c = new MaatCfg();
|
||||
c.setCompileId(1);
|
||||
c.setGroupNum(groupList.size());
|
||||
c.setAction(1);
|
||||
c.setAttribute("11,12,13");
|
||||
c.setClassify("22,23,24");
|
||||
c.setLable("17,18,19");
|
||||
c.setFunctionId(30);
|
||||
c.setIpRegionList(ipRegion);
|
||||
c.setStrRegionList(strRegion);
|
||||
|
||||
maatList.add(c);
|
||||
maat.setAuditTime(new Date());
|
||||
maat.setVersion("1.0");
|
||||
maat.setCreatorName("test");
|
||||
maat.setConfigCompileList(maatList);
|
||||
Gson gson=new GsonBuilder().disableHtmlEscaping()
|
||||
.create();
|
||||
System.out.println(gson.toJson(maat));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user