-
- //check if update operation or create, get id for data to be updated and update attributeData
- if (request.getParameter("operation").equals("update")) {
- List<Object> duplicateData = commonClassDao.checkDuplicateEntry(termList.getTermName(), "termName", TermList.class);
- int id = 0;
- TermList data = (TermList) duplicateData.get(0);
- id = data.getId();
- if(id==0){
- isFakeUpdate=true;
- termList.setId(1);
- } else {
- termList.setId(id);
- }
- termList.setUserCreatedBy(this.getUserInfo(userId));
- }
- } else {
- termList = (TermList)mapper.readValue(root.get("termListDictionaryData").toString(), TermList.class);
- termListDatas = (TermListData)mapper.readValue(root.get("termListDictionaryData").toString(), TermListData.class);
- userId = root.get("userid").textValue();
- }
- String fromZoneValue = "";
- int counter = 0;
- if(termListDatas.getFromZoneDatas().size() > 0){
- for(Object fromZone : termListDatas.getFromZoneDatas()){
- if(fromZone instanceof LinkedHashMap<?, ?>){
- String key = ((LinkedHashMap<?, ?>) fromZone).get("option").toString();
- if(counter>0){
- fromZoneValue = fromZoneValue + ",";
- }
- fromZoneValue = fromZoneValue + key ;
- counter ++;
- }
- }
- }
- termList.setFromZones(fromZoneValue);
-
- String toZoneValue = "";
- int toZonecounter = 0;
- if(termListDatas.getToZoneDatas().size() > 0){
- for(Object toZone : termListDatas.getToZoneDatas()){
- if(toZone instanceof LinkedHashMap<?, ?>){
- String key = ((LinkedHashMap<?, ?>) toZone).get("option").toString();
- if(toZonecounter>0){
- toZoneValue = toZoneValue + ",";
- }
- toZoneValue = toZoneValue + key ;
- toZonecounter ++;
- }
- }
- }
- termList.setToZones(toZoneValue);
-
- String srcListValues = "";
- int srcListcounter = 0;
- if(termListDatas.getSourceListDatas().size() > 0){
- for(Object srcList : termListDatas.getSourceListDatas()){
- if(srcList instanceof LinkedHashMap<?, ?>){
- String key = ((LinkedHashMap<?, ?>) srcList).get("option").toString();
- if(srcListcounter>0){
- srcListValues = srcListValues + ",";
- }
- srcListValues = srcListValues + key ;
- srcListcounter ++;
- }
- }
- }
- termList.setSrcIPList(srcListValues);
-
- String desListValues = "";
- int destListcounter = 0;
- if(termListDatas.getDestinationListDatas().size() > 0){
- for(Object desList : termListDatas.getDestinationListDatas()){
- if(desList instanceof LinkedHashMap<?, ?>){
- String key = ((LinkedHashMap<?, ?>) desList).get("option").toString();
- if(destListcounter>0){
- desListValues = desListValues + ",";
- }
- desListValues = desListValues + key ;
- destListcounter ++;
- }
- }
- }
- termList.setDestIPList(desListValues);
-
- String srcSerValue = "";
- int srcSercounter = 0;
- if(termListDatas.getSourceServiceDatas().size() > 0){
- for(Object srcSrc : termListDatas.getSourceServiceDatas()){
- if(srcSrc instanceof LinkedHashMap<?, ?>){
- String key = ((LinkedHashMap<?, ?>) srcSrc).get("option").toString();
- if(srcSercounter>0){
- srcSerValue = srcSerValue + ",";
- }
- srcSerValue = srcSerValue + key ;
- srcSercounter ++;
- }
- }
- }
- termList.setSrcPortList(srcSerValue);
-
- String desSrcValue = "";
- int desSrccounter = 0;
- if(termListDatas.getDestinationServiceDatas().size() > 0){
- for(Object desSrc : termListDatas.getDestinationServiceDatas()){
- if(desSrc instanceof LinkedHashMap<?, ?>){
- String key = ((LinkedHashMap<?, ?>) desSrc).get("option").toString();
- if(desSrccounter>0){
- desSrcValue = desSrcValue + ",";
- }
- desSrcValue = desSrcValue + key ;
- desSrccounter ++;
- }
- }