(1)字符串,增强字符串当可配置多个关键词的时候,加入最多4个词限制,并且关键词不能重复
(2)bgp as导入提交 (3)删除重复的ip_range_in_the_same国际化
This commit is contained in:
@@ -12,10 +12,10 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.management.RuntimeErrorException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.beust.jcommander.internal.Sets;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
@@ -58,15 +59,14 @@ import com.nis.domain.configuration.template.AsnIpTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.P2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.P2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.IpCfgTemplate;
|
||||
import com.nis.domain.configuration.template.IpPayloadTemplate;
|
||||
import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.P2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.P2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.domain.log.SearchReport;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Configurations;
|
||||
@@ -124,8 +124,6 @@ import com.nis.web.service.specific.SpecificServiceCfgService;
|
||||
import com.nis.web.service.specific.SpecificServiceHostCfgService;
|
||||
import com.nis.web.service.systemService.ServiceConfigInfoService;
|
||||
|
||||
import jdk.nashorn.internal.runtime.regexp.joni.Regex;
|
||||
|
||||
public class BaseController {
|
||||
|
||||
@Autowired
|
||||
@@ -888,6 +886,7 @@ public class BaseController {
|
||||
}
|
||||
} else {
|
||||
boolean has = false;
|
||||
Set<String> keywordSet=Sets.newHashSet();
|
||||
for (String key : keyword.split("\n")) {
|
||||
Matcher m = pattern.matcher(key);
|
||||
if (m.find()) {
|
||||
@@ -896,10 +895,20 @@ public class BaseController {
|
||||
prop.getProperty("key_word") + " '" + key + "'") + ";");
|
||||
break;
|
||||
}
|
||||
if(!keywordSet.contains(key)) {
|
||||
keywordSet.add(key);
|
||||
}else {
|
||||
errInfo.append(prop.getProperty("key_word") + " '" + key + "'"+" "+prop.getProperty("repeat") + ";");
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR);
|
||||
baseStringCfg.setCfgKeywords(reWord);
|
||||
if(keyword.split("\n").length>4) {
|
||||
errInfo.append(String.format(prop.getProperty("most_keywords"),
|
||||
prop.getProperty("key_word")) + ";");
|
||||
}else {
|
||||
String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR);
|
||||
baseStringCfg.setCfgKeywords(reWord);
|
||||
}
|
||||
}
|
||||
}
|
||||
Integer exprType = baseStringCfg.getExprType();
|
||||
@@ -1121,6 +1130,8 @@ public class BaseController {
|
||||
}
|
||||
} else {
|
||||
boolean has = false;
|
||||
Set<String> keywordSet=Sets.newHashSet();
|
||||
|
||||
for (String key : keyword.split("\n")) {
|
||||
Matcher m = pattern.matcher(key);
|
||||
if (m.find()) {
|
||||
@@ -1129,10 +1140,20 @@ public class BaseController {
|
||||
prop.getProperty("key_word") + " '" + key + "'") + ";");
|
||||
break;
|
||||
}
|
||||
if(!keywordSet.contains(key)) {
|
||||
keywordSet.add(key);
|
||||
}else {
|
||||
errInfo.append(prop.getProperty("key_word") + " '" + key + "'"+" "+prop.getProperty("repeat") + ";");
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR);
|
||||
baseStringCfg.setCfgKeywords(reWord);
|
||||
if(keyword.split("\n").length>4) {
|
||||
errInfo.append(String.format(prop.getProperty("most_keywords"),
|
||||
prop.getProperty("key_word")) + ";");
|
||||
}else {
|
||||
String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR);
|
||||
baseStringCfg.setCfgKeywords(reWord);
|
||||
}
|
||||
}
|
||||
}
|
||||
Integer exprType = baseStringCfg.getExprType();
|
||||
@@ -3297,7 +3318,7 @@ public class BaseController {
|
||||
}
|
||||
} else {
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo);
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}
|
||||
}
|
||||
@@ -3320,6 +3341,9 @@ public class BaseController {
|
||||
/* } */
|
||||
|
||||
}
|
||||
if (regionDict.getFunctionId().equals(61)) {
|
||||
bgpCfgService.saveBgpAsCfg(stringCfgs);
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {
|
||||
for (ComplexkeywordCfg cfg : complexkeywordCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
|
||||
@@ -11,8 +11,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcBgpAsCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
@@ -86,7 +86,15 @@ public class BgpCfgService extends CrudService<BgpCfgDao,CfgIndexInfo> {
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
public void saveBgpAsCfg(List<BaseStringCfg<?>> cfgs) {
|
||||
for(BaseStringCfg cfg:cfgs){
|
||||
NtcBgpAsCfg _cfg=new NtcBgpAsCfg();
|
||||
BeanUtils.copyProperties(cfg, _cfg);
|
||||
if(cfg.getCfgKeywords()!=null && !"".equals(cfg.getCfgKeywords())){
|
||||
bgpCfgDao.saveNtcBgpAsCfg(_cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 保存配置
|
||||
* @param entity
|
||||
|
||||
Reference in New Issue
Block a user