aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-10-22 07:53:44 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-10-23 13:33:56 -0400
commit1e61676b77dd09659027b8984f050df7e8538526 (patch)
tree115053dba12b4b27a0f92de0e7648a672a66893a /ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
parentf18fbfc026de9cf02126f57844c37abfee607394 (diff)
Consolidate PolicyRestAdapter setup
Put common code into PolicyEngineUtils that the controllers use to populate the PolicyRestController. Also some more sonar cleanup and formatting of XML files. Shortened 120 line characters. Removed some trailing spaces from comments. Fixed up one JUnit. Licenses. Issue-ID: POLICY-2133 Change-Id: Id7d8ac3ab60331535f048ec0f26aeb17a099414e Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java69
1 files changed, 51 insertions, 18 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
index 5b42fc310..1582dab19 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
@@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -32,8 +33,10 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
@@ -110,14 +113,18 @@ public class MicroServiceDictionaryController {
private MicroServiceModels newModel;
- @RequestMapping(value = {"/get_DCAEUUIDDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_DCAEUUIDDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getDCAEUUIDDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getDataByEntity(response, dcaeUUIDDatas, "name", DCAEuuid.class);
}
- @RequestMapping(value = {"/get_DCAEUUIDData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_DCAEUUIDData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getDCAEUUIDDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
@@ -180,21 +187,27 @@ public class MicroServiceDictionaryController {
utils.removeData(request, response, dcaeUUIDDatas, DCAEuuid.class);
}
- @RequestMapping(value = {"/get_MicroServiceConfigNameDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceConfigNameDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceConfigNameByNameDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getDataByEntity(response, microServiceConfigNameDatas, "name", MicroServiceConfigName.class);
}
- @RequestMapping(value = {"/get_MicroServiceConfigNameData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceConfigNameData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceConfigNameDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getData(response, microServiceConfigNameDatas, MicroServiceConfigName.class);
}
- @RequestMapping(value = {"/get_MicroServiceDictData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceDictData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceDictNameDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
@@ -328,14 +341,18 @@ public class MicroServiceDictionaryController {
utils.removeData(request, response, microServiceConfigNameDatas, MicroServiceConfigName.class);
}
- @RequestMapping(value = {"/get_MicroServiceLocationDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceLocationDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceLocationByNameDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getDataByEntity(response, microServiceLocationDatas, "name", MicroServiceLocation.class);
}
- @RequestMapping(value = {"/get_MicroServiceLocationData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceLocationData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceLocationDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
@@ -403,14 +420,18 @@ public class MicroServiceDictionaryController {
utils.removeData(request, response, microServiceLocationDatas, MicroServiceLocation.class);
}
- @RequestMapping(value = {"/get_MicroServiceAttributeDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceAttributeDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceAttributeByNameDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getDataByEntity(response, microServiceAttributeDatas, "name", MicroServiceAttribute.class);
}
- @RequestMapping(value = {"/get_MicroServiceAttributeData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceAttributeData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceAttributeDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
@@ -481,15 +502,18 @@ public class MicroServiceDictionaryController {
utils.removeData(request, response, microServiceAttributeDatas, MicroServiceAttribute.class);
}
-
- @RequestMapping(value = {"/get_MicroServiceModelsDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceModelsDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryByNameEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getDataByEntity(response, microServiceModelsDictionaryDatas, modelName, MicroServiceModels.class);
}
- @RequestMapping(value = {"/get_MicroServiceModelsDataByVersion"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceModelsDataByVersion"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryByVersionEntityData(HttpServletRequest request,
HttpServletResponse response) {
@@ -515,14 +539,18 @@ public class MicroServiceDictionaryController {
}
}
- @RequestMapping(value = {"/get_MicroServiceModelsData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceModelsData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getData(response, microServiceModelsDictionaryDatas, MicroServiceModels.class);
}
- @RequestMapping(value = {"/get_MicroServiceModelsDataServiceVersion"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceModelsDataServiceVersion"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryEntityDataServiceVersion(HttpServletResponse response) {
try {
@@ -550,7 +578,9 @@ public class MicroServiceDictionaryController {
}
}
- @RequestMapping(value = {"/get_MicroServiceModelsDataByClass"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceModelsDataByClass"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceModelsDictionaryClassEntityData(HttpServletResponse response) {
try {
@@ -798,21 +828,24 @@ public class MicroServiceDictionaryController {
return returnList;
}
- @RequestMapping(value = {"/get_MicroServiceHeaderDefaultsDataByName"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceHeaderDefaultsDataByName"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceHeaderDefaultsEntityDataByName(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getDataByEntity(response, microServiceHeaderDefaultDatas, "modelName", MicroserviceHeaderdeFaults.class);
}
- @RequestMapping(value = {"/get_MicroServiceHeaderDefaultsData"}, method = {RequestMethod.GET},
+ @RequestMapping(
+ value = {"/get_MicroServiceHeaderDefaultsData"},
+ method = {RequestMethod.GET},
produces = MediaType.APPLICATION_JSON_VALUE)
public void getMicroServiceHeaderDefaultsEntityData(HttpServletResponse response) {
DictionaryUtils utils = getDictionaryUtilsInstance();
utils.getData(response, microServiceHeaderDefaultDatas, MicroserviceHeaderdeFaults.class);
}
-
@RequestMapping(value = {"/ms_dictionary/save_headerDefaults"}, method = {RequestMethod.POST})
public ModelAndView saveMicroServiceHeaderDefaultValues(HttpServletRequest request, HttpServletResponse response)
throws IOException {