IP配置导入调整,协议验证增加隧道协议,IPSEC的特殊验证
This commit is contained in:
@@ -538,13 +538,22 @@ public class BaseController {
|
||||
params.put("searchCfgId", entry.getCfgId());
|
||||
}
|
||||
}
|
||||
public void checkIpCfg(List<IpCfgTemplate> list) throws ServiceException{
|
||||
public void checkIpCfg(int functionId ,List<IpCfgTemplate> list) throws ServiceException{
|
||||
Properties prop=this.getMsgProp();
|
||||
List<SysDataDictionaryItem> ipTypeList = DictUtils.getDictList("IP_TYPE");
|
||||
List<SysDataDictionaryItem> ipPatternList = DictUtils.getDictList("IP_PATTERN");
|
||||
List<SysDataDictionaryItem> portPatternList = DictUtils.getDictList("PORT_PATTERN");
|
||||
List<SysDataDictionaryItem> directionList = DictUtils.getDictList("DIRECTION");
|
||||
List<SysDataDictionaryItem> protocolList = DictUtils.getDictList("PROTOCOL");
|
||||
List<SysDataDictionaryItem> ipsecProrocolList = DictUtils.getDictList("IPSEC_PROTOCOL");
|
||||
List<SysDataDictionaryItem> tunnelProrocolList = DictUtils.getDictList("TUNNEL_PROTOCOL");
|
||||
List<SysDataDictionaryItem> specialFunctionIdList = DictUtils.getDictList("SPECIAL_FUNCTION_ID");
|
||||
String specialItem=null;
|
||||
for(SysDataDictionaryItem sfuncItem:specialFunctionIdList){
|
||||
if(functionId==Integer.parseInt(sfuncItem.getItemCode())){
|
||||
specialItem=sfuncItem.getItemValue();
|
||||
}
|
||||
}
|
||||
StringBuffer msg=new StringBuffer();
|
||||
int line=1;
|
||||
for(IpCfgTemplate value:list){
|
||||
@@ -661,16 +670,42 @@ public class BaseController {
|
||||
if(protocol==null){
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("protocol"))+";");
|
||||
}else{
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem protocolItem:protocolList){
|
||||
if(Integer.parseInt(protocolItem.getItemCode())==protocol.intValue()){
|
||||
has=true;
|
||||
break;
|
||||
if(specialItem!=null&&("ipsec".equals(specialItem)||"tunnel".equals(specialItem))){
|
||||
if("ipsec".equals(specialItem)){
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem protocolItem:ipsecProrocolList){
|
||||
if(Integer.parseInt(protocolItem.getItemCode())==protocol.intValue()){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol"))+";");
|
||||
}
|
||||
}else if("tunnel".equals(specialItem)){
|
||||
for(SysDataDictionaryItem protocolItem:tunnelProrocolList){
|
||||
if("default".equals(protocolItem.getItemValue())){
|
||||
if(protocol.intValue()!=Integer.parseInt(protocolItem.getItemCode())){
|
||||
errInfo.append(String.format(prop.getProperty("must_be"), prop.getProperty("protocol"),Integer.parseInt(protocolItem.getItemCode()))+";");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem protocolItem:protocolList){
|
||||
if(Integer.parseInt(protocolItem.getItemCode())==protocol.intValue()){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol"))+";");
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol"))+";");
|
||||
}
|
||||
|
||||
}
|
||||
//protocol check end
|
||||
// requestId check start
|
||||
|
||||
Reference in New Issue
Block a user