X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ECOMP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcontroller%2FMicroServiceDictionaryController.java;h=108d33c25e28d9898c137b3189d8a0fae3f5cb24;hb=fc5c07705edc4dcb7083b39116a43844bb6a1490;hp=876f380d472175eaa30c4788470cf553c01a7084;hpb=dda032f8bb161d54eb1f59de2b4a3efb774fc4d1;p=policy%2Fengine.git diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java index 876f380d4..108d33c25 100644 --- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java +++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java @@ -82,18 +82,18 @@ public class MicroServiceDictionaryController { private static String ERROR = "error"; private static String DICTIONARYDBQUERY = "dictionaryDBQuery"; private HashMap classMap; - private List modelList = new ArrayList(); + private List modelList = new ArrayList<>(); - MSModelUtils utils = new MSModelUtils(XACMLPapServlet.msEcompName, XACMLPapServlet.msPolicyName); + MSModelUtils utils = new MSModelUtils(XACMLPapServlet.getMsEcompName(), XACMLPapServlet.getMsPolicyName()); private MicroServiceModels newModel; @RequestMapping(value={"/get_DCAEUUIDDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getDCAEUUIDDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("dcaeUUIDDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(DCAEuuid.class, "name"))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -108,7 +108,7 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_DCAEUUIDData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getDCAEUUIDDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("dcaeUUIDDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(DCAEuuid.class))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -239,7 +239,7 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_MicroServiceConfigNameDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getMicroServiceConfigNameByNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("microServiceCongigNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceConfigName.class, "name"))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -256,7 +256,7 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_MicroServiceConfigNameData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getMicroServiceConfigNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("microServiceCongigNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceConfigName.class))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -387,7 +387,7 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_MicroServiceLocationDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getMicroServiceLocationByNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("microServiceLocationDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceLocation.class, "name"))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -402,7 +402,7 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_MicroServiceLocationData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getMicroServiceLocationDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("microServiceLocationDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceLocation.class))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -533,7 +533,7 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_MicroServiceAttributeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getMicroServiceAttributeByNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("microServiceAttributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceAttribute.class, "name"))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -548,7 +548,7 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_MicroServiceAttributeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getMicroServiceAttributeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("microServiceAttributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceAttribute.class))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -679,7 +679,7 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_MicroServiceModelsDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getMicroServiceModelsDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceModels.class, "modelName"))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -694,7 +694,7 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_MicroServiceModelsDataByVersion"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getMicroServiceModelsDictionaryByVersionEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); JsonNode root = mapper.readTree(request.getReader()); String modelName = null; @@ -718,7 +718,7 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_MicroServiceModelsData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getMicroServiceModelsDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceModels.class))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -737,9 +737,9 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_MicroServiceModelsDataServiceVersion"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getMicroServiceModelsDictionaryEntityDataServiceVersion(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); - List data = new ArrayList(); + List data = new ArrayList<>(); List datas = commonClassDao.getData(MicroServiceModels.class); for(int i = 0; i < datas.size(); i++){ MicroServiceModels msmodel = (MicroServiceModels) datas.get(i); @@ -765,7 +765,7 @@ public class MicroServiceDictionaryController { @RequestMapping(value={"/get_MicroServiceModelsDataByClass"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getMicroServiceModelsDictionaryClassEntityData(HttpServletRequest request, HttpServletResponse response){ try{ - Map model = new HashMap(); + Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("microServiceModelsDictionaryClassDatas", mapper.writeValueAsString(modelList)); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -816,7 +816,7 @@ public class MicroServiceDictionaryController { } MSAttributeObject mainClass = null; - classMap = new HashMap(); + classMap = new HashMap<>(); JsonNode data = root.get("classMap"); ObjectMapper mapper1 = new ObjectMapper(); String data1 = data.toString().substring(1, data.toString().length()-1); @@ -880,7 +880,7 @@ public class MicroServiceDictionaryController { } } if(root.has("classMap")){ - classMap = new HashMap(); + classMap = new HashMap<>(); JsonNode data = root.get("classMap"); ObjectMapper mapper1 = new ObjectMapper(); String data1 = data.toString().substring(1, data.toString().length()-1); @@ -1010,7 +1010,7 @@ public class MicroServiceDictionaryController { this.newModel.setDependency(""); } - if (mainClass.getDependency()==null){ + if (mainClass != null && mainClass.getDependency()==null){ mainClass.setDependency(""); } @@ -1024,8 +1024,8 @@ public class MicroServiceDictionaryController { } private ArrayList getFullDependencyList(ArrayList dependency) { - ArrayList returnList = new ArrayList(); - ArrayList workingList = new ArrayList(); + ArrayList returnList = new ArrayList<>(); + ArrayList workingList = new ArrayList<>(); returnList.addAll(dependency); for (String element : dependency ){ if (classMap.containsKey(element)){