(1)端口验证修改,端口必须为数字,不再限制大小小于65535,同时加入限制,非0数字不能以0开头

(2)Maat相关bean加入@Expose注解
This commit is contained in:
wangxin
2018-05-28 17:05:35 +08:00
parent da189660d8
commit 9cd93c1d6e
7 changed files with 109 additions and 29 deletions

View File

@@ -27,44 +27,72 @@ import com.nis.domain.configuration.NumBoundaryCfg;
* @version V1.0 * @version V1.0
*/ */
public class MaatCfg implements Serializable { public class MaatCfg implements Serializable {
@Expose
private Integer compileId; private Integer compileId;
private Integer action; @Expose
private Integer action;
@Expose
@SerializedName("service") @SerializedName("service")
private Integer serviceId; private Integer serviceId;
@Expose
@SerializedName("contType") @SerializedName("contType")
private String classify;//分类 private String classify;//分类
@Expose
@SerializedName("attrType") @SerializedName("attrType")
private String attribute;//性质 private String attribute;//性质
@Expose
@SerializedName("contLabel") @SerializedName("contLabel")
private String lable;//标签 private String lable;//标签
@Expose
private Integer taskId; private Integer taskId;
@Expose
@SerializedName("guaranteeId") @SerializedName("guaranteeId")
private Integer functionId; private Integer functionId;
@Expose
@SerializedName("effectiveRange") @SerializedName("effectiveRange")
private String areaEffectiveIds ; private String areaEffectiveIds ;
private Integer doBlackList; @Expose
private Integer doLog; private Integer doBlackList;
private Integer activeSys; @Expose
private Integer configPercent; private Integer doLog;
private Integer configOption; @Expose
private Date startTime; private Integer activeSys;
private Date endTime; @Expose
private String userRegion; private Integer configPercent;
private Integer groupNum; @Expose
private Integer configOption;
@Expose
private Date startTime;
@Expose
private Date endTime;
@Expose
private String userRegion;
@Expose
private Integer groupNum;
@Expose
private Integer fatherCfgId; private Integer fatherCfgId;
@Expose
@SerializedName("opTime") @SerializedName("opTime")
private Date auditTime; private Date auditTime;
@Expose
private List<GroupCfg> groupRelationList; private List<GroupCfg> groupRelationList;
private List<StringCfg> strRegionList; @Expose
private List<IpCfg> ipRegionList; private List<StringCfg> strRegionList;
private List<NumBoundaryCfg> numRegionList; @Expose
private List<IpCfg> ipRegionList;
@Expose
private List<NumBoundaryCfg> numRegionList;
@Expose
private List<DigestCfg> digestRegionList; private List<DigestCfg> digestRegionList;
public static class GroupCfg{ public static class GroupCfg{
@Expose
private Integer groupId; private Integer groupId;
@Expose
private Integer compileId; private Integer compileId;
@Expose
private Integer isValid; private Integer isValid;
@Expose
private Date opTime; private Date opTime;
public Integer getGroupId() { public Integer getGroupId() {
return groupId; return groupId;
@@ -93,17 +121,27 @@ public class MaatCfg implements Serializable {
} }
public static class StringCfg{ public static class StringCfg{
@Expose
private Integer regionId; private Integer regionId;
@Expose
private Integer groupId; private Integer groupId;
@Expose
@SerializedName("tableName") @SerializedName("tableName")
private String cfgType; private String cfgType;
@Expose
private String district; private String district;
@Expose
@SerializedName("keywords") @SerializedName("keywords")
private String cfgKeywords; private String cfgKeywords;
@Expose
private Integer exprType; private Integer exprType;
@Expose
private Integer matchMethod; private Integer matchMethod;
@Expose
private Integer isHexbin; private Integer isHexbin;
@Expose
private Integer isValid; private Integer isValid;
@Expose
private Date opTime; private Date opTime;
public Integer getRegionId() { public Integer getRegionId() {
return regionId; return regionId;
@@ -168,22 +206,38 @@ public class MaatCfg implements Serializable {
} }
public static class IpCfg{ public static class IpCfg{
@Expose
private Integer regionId; private Integer regionId;
@Expose
private Integer groupId; private Integer groupId;
@Expose
@SerializedName("tableName") @SerializedName("tableName")
private String cfgType; private String cfgType;
@Expose
private Integer ipType; private Integer ipType;
@Expose
private String srcIp; private String srcIp;
@Expose
private String srcIpMask ; private String srcIpMask ;
@Expose
private String srcPort ; private String srcPort ;
@Expose
private String srcPortMask ; private String srcPortMask ;
@Expose
private String dstIp ; private String dstIp ;
@Expose
private String dstIpMask ; private String dstIpMask ;
@Expose
private String dstPort ; private String dstPort ;
@Expose
private String dstPortMask ; private String dstPortMask ;
@Expose
private Integer direction ; private Integer direction ;
@Expose
private Integer protocol ; private Integer protocol ;
@Expose
private Integer isValid; private Integer isValid;
@Expose
private Date opTime; private Date opTime;
public Integer getRegionId() { public Integer getRegionId() {
return regionId; return regionId;
@@ -283,13 +337,20 @@ public class MaatCfg implements Serializable {
} }
} }
public static class NumBoundaryCfg{ public static class NumBoundaryCfg{
@Expose
private Integer regionId; private Integer regionId;
@Expose
private Integer groupId; private Integer groupId;
@Expose
@SerializedName("tableName") @SerializedName("tableName")
private String cfgType; private String cfgType;
@Expose
private Integer lowBoundary; private Integer lowBoundary;
@Expose
private Integer upBoundary; private Integer upBoundary;
@Expose
private Integer isValid; private Integer isValid;
@Expose
private Date opTime; private Date opTime;
public Integer getRegionId() { public Integer getRegionId() {
return regionId; return regionId;
@@ -334,14 +395,22 @@ public class MaatCfg implements Serializable {
this.opTime = opTime; this.opTime = opTime;
} }
}public static class DigestCfg{ }public static class DigestCfg{
@Expose
private Integer regionId; private Integer regionId;
@Expose
private Integer groupId; private Integer groupId;
@Expose
@SerializedName("tableName") @SerializedName("tableName")
private String cfgType; private String cfgType;
@Expose
private Integer rawLen; private Integer rawLen;
@Expose
private String digest; private String digest;
@Expose
private Integer cfdsLevel; private Integer cfdsLevel;
@Expose
private Integer isValid; private Integer isValid;
@Expose
private Date opTime; private Date opTime;
public Integer getRegionId() { public Integer getRegionId() {
return regionId; return regionId;

View File

@@ -13,6 +13,7 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
/** /**
@@ -33,11 +34,15 @@ public class ToMaatBean implements Serializable{
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@Expose
private String version; private String version;
@Expose
@SerializedName("operator") @SerializedName("operator")
private String creatorName; private String creatorName;
@Expose
@SerializedName("opTime") @SerializedName("opTime")
private Date auditTime; private Date auditTime;
@Expose
private List<MaatCfg> configCompileList; private List<MaatCfg> configCompileList;
public String getVersion() { public String getVersion() {

View File

@@ -82,7 +82,7 @@ $(function(){
<div class="portlet-body form"> <div class="portlet-body form">
<!-- BEGIN FORM--> <!-- BEGIN FORM-->
<form id="ipCfgFrom" action="${ctx}/ntc/whitelist/saveOrUpdateIp" method="post" class="form-horizontal"> <form id="ipCfgFrom" action="${ctx}/ntc/whitelist/saveOrUpdateIp" method="post" class="form-horizontal">
<div class="form-body"> <div class="form-body row">
<input type="hidden" name="cfgId" value="${_cfg.cfgId}"> <input type="hidden" name="cfgId" value="${_cfg.cfgId}">
<input type="hidden" name="compileId" value="${_cfg.compileId}"> <input type="hidden" name="compileId" value="${_cfg.compileId}">
<input type="hidden" name="protocolId" value="${_cfg.protocolId}"> <input type="hidden" name="protocolId" value="${_cfg.protocolId}">

View File

@@ -272,14 +272,14 @@ jQuery.validator.addMethod("portCheck",function(value, element) {
typeInt=$(element).parents(".row").find("select[name$='portPattern']").val(); typeInt=$(element).parents(".row").find("select[name$='portPattern']").val();
} }
if(typeInt==1){//port 0~65535 if(typeInt==1){//port 0~65535
if(this.optional(element)||(/^([0-9]+)$/.test(value) && (RegExp.$1 <=65535 && RegExp.$1 >=0))){ if(this.optional(element)||(/^(0|[1-9]+)$/.test(value))){
return true; return true;
}else{ }else{
$.validator.messages.portCheck=$.validator.messages.portRange $.validator.messages.portCheck=$.validator.messages.portRange
return false; return false;
} }
}else if(typeInt==2){// port -mask 0~65535/0~65535 }else if(typeInt==2){// port -mask 0~65535/0~65535
if(this.optional(element)||(/^([0-9]+)\/([0-9]+)$/.test(value) && (RegExp.$1 <=65535 && RegExp.$2 <=65535))){ if(this.optional(element)||(/^(0|[1-9]+)\/(0|[1-9]{1,5})$/.test(value) && RegExp.$2 <=65535)){
return true; return true;
}else{ }else{
$.validator.messages.portCheck=$.validator.messages.portMaskRange $.validator.messages.portCheck=$.validator.messages.portMaskRange

View File

@@ -29,7 +29,7 @@
ipRange1:"start IP should smaller than end IP", ipRange1:"start IP should smaller than end IP",
portCheck:"Please enter a correct port", portCheck:"Please enter a correct port",
notStartZero:"Please enter a valid Integer", notStartZero:"Please enter a valid Integer",
portRange:"Port must between 0 and 65535", portRange:"Please enter a valid Integer",
portMaskRange:"Port and mask must between 0 and 65535.The right pattern is \"port/mask\"." portMaskRange:"Port must be a valid Integer and mask must between 0 and 65535.The correct pattern is \"port/mask\"."
}); });
}(jQuery)); }(jQuery));

View File

@@ -22,6 +22,12 @@
max: $.validator.format("Пожалуйста, введите число, меньшее или равное {0}."), max: $.validator.format("Пожалуйста, введите число, меньшее или равное {0}."),
min: $.validator.format("Пожалуйста, введите число, большее или равное {0}."), min: $.validator.format("Пожалуйста, введите число, большее или равное {0}."),
ipCheck: $.validator.format(" Пожалуйста, введите  правильный  IP - адрес."), ipCheck: $.validator.format(" Пожалуйста, введите  правильный  IP - адрес."),
portCheck: $.validator.format(" Пожалуйста, введите  правильный  порт.") ipMask:"Please enter a correct IP/mask",
ipMaskRange:"IP mask must between 0 and 32",
ipRange:"Wrong IP format or start IP and end IP in two subnet",
ipRange1:"start IP should smaller than end IP",
portCheck: " Пожалуйста, введите  правильный  порт.",
portRange:"Please enter a valid Integer",
portMaskRange:"Port must be a valid Integer and mask must between 0 and 65535.The correct pattern is \"port/mask\"."
}); });
}(jQuery)); }(jQuery));

View File

@@ -30,7 +30,7 @@
ipMaskRange:"掩码范围0到32", ipMaskRange:"掩码范围0到32",
ipRange:"IP范围格式错误或者起始IP与结束IP不在同一网段", ipRange:"IP范围格式错误或者起始IP与结束IP不在同一网段",
ipRange1:"起始IP值应小于结束IP值", ipRange1:"起始IP值应小于结束IP值",
portRange:"端口范围0 到 65535", portRange:"端口必须为整数非0数字不能以0开头",
portMaskRange:"端口和掩码均为0-65535格式为\"端口/掩码\"" portMaskRange:"端口必须为整数掩码范围0-65535非0数字不能以0开头。格式为\"端口/掩码\"",
}); });
}(jQuery)); }(jQuery));