X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fhandler%2FDictionaryHandlerImpl.java;h=65c50b1c0f9f4e0f5afce13faa3a2b0e4cdab1db;hp=ef6092d72c11c6d73f531a6205444316a859b577;hb=1e61676b77dd09659027b8984f050df7e8538526;hpb=5368a1d66dce2a1029e947a43e8ccdcfad98fbc8 diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java index ef6092d72..65c50b1c0 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-PAP-REST * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.pap.xacml.rest.handler; import javax.servlet.http.HttpServletRequest; @@ -31,6 +32,7 @@ public class DictionaryHandlerImpl implements DictionaryHandler { /* * Get Equivalent for Dictionary Services. */ + @Override public void doDictionaryAPIGet(HttpServletRequest request, HttpServletResponse response) { String dictionaryType = request.getParameter("dictionaryType"); try { @@ -111,6 +113,9 @@ public class DictionaryHandlerImpl implements DictionaryHandler { case "MicroServiceConfigName": dictionary.getMicroServiceConfigNameDictionary(response); break; + case "MicroServiceDictionaryData": + dictionary.getMicroServiceDictionaryData(response); + break; case "DCAEUUID": dictionary.getDCAEUUIDDictionary(response); break; @@ -159,13 +164,13 @@ public class DictionaryHandlerImpl implements DictionaryHandler { /** * Can be used to extend the services. *

- * getflag=true indicates Get Request. - * getflag=false indicates Put Request. + * getflag=true indicates Get Request. getflag=false indicates Put Request. * * @return */ + @Override public String extendedOptions(String dictionaryType, HttpServletRequest request, HttpServletResponse response, - boolean getflag) { + boolean getflag) { // Default code String message = XACMLErrorConstants.ERROR_DATA_ISSUE + " Invalid Dictionary in Request."; PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "DictionaryHandler", " Invalid Dictionary in Request."); @@ -175,6 +180,7 @@ public class DictionaryHandlerImpl implements DictionaryHandler { return null; } + @Override public void doDictionaryAPIPut(HttpServletRequest request, HttpServletResponse response) { String result = null; String dictionaryType = request.getParameter("dictionaryType"); @@ -257,6 +263,9 @@ public class DictionaryHandlerImpl implements DictionaryHandler { case "MicroServiceConfigName": result = dictionary.saveMicroServiceConfigNameDictionary(request, response); break; + case "MicroServiceDictionaryData": + dictionary.saveMicroServiceDictionaryData(request, response); + break; case "DCAEUUID": result = dictionary.saveDCAEUUIDDictionary(request, response); break; @@ -305,7 +314,7 @@ public class DictionaryHandlerImpl implements DictionaryHandler { response.addHeader("error", message); return; } - if (result.equalsIgnoreCase("Success")) { + if (("Success").equalsIgnoreCase(result)) { response.setStatus(HttpServletResponse.SC_OK); response.addHeader("successMapKey", "success"); if (operation.equalsIgnoreCase("update")) { @@ -313,10 +322,10 @@ public class DictionaryHandlerImpl implements DictionaryHandler { } else { response.addHeader("operation", "createDictionary"); } - } else if (result.equalsIgnoreCase("Duplicate")) { + } else if (("Duplicate").equalsIgnoreCase(result)) { response.setStatus(HttpServletResponse.SC_CONFLICT); response.addHeader("error", "dictionaryItemExists"); - } else if (result.equalsIgnoreCase("DuplicateGroup")) { + } else if (("DuplicateGroup").equalsIgnoreCase(result)) { response.setStatus(HttpServletResponse.SC_CONFLICT); response.addHeader("error", "duplicateGroup"); } else {