aboutsummaryrefslogtreecommitdiffstats
path: root/ms/sliboot/src/main
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2022-09-29 15:52:33 -0400
committerDan Timoney <dtimoney@att.com>2022-09-29 15:52:33 -0400
commitc2556dd48738b43e91e27a57df60c3ec347c5ac0 (patch)
tree8d7ef5cf7d36fc5a946b1c99900ee88b7f3378b2 /ms/sliboot/src/main
parent7ae63cbdf21b06e0234d51a3200f9ebbf393f8eb (diff)
Update third party versions in ccsdk/apps
Upgrade to latest springboot 2.6 release and updated gson version Change-Id: Ie12921daa905424bee3e5423371f951d3156e803 Issue-ID: CCSDK-3771 Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'ms/sliboot/src/main')
-rw-r--r--ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/controllers/ExecuteGraphController.java112
-rw-r--r--ms/sliboot/src/main/resources/application.properties1
2 files changed, 1 insertions, 112 deletions
diff --git a/ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/controllers/ExecuteGraphController.java b/ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/controllers/ExecuteGraphController.java
deleted file mode 100644
index 07191446..00000000
--- a/ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/controllers/ExecuteGraphController.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - CCSDK
- * ================================================================================
- * Copyright (C) 2020 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.apps.ms.sliboot.controllers;
-
-import java.util.HashMap;
-import java.util.Map.Entry;
-import java.util.Properties;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceBase;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-@Controller
-@EnableAutoConfiguration
-public class ExecuteGraphController {
- @Autowired
- protected SvcLogicServiceBase svc;
-
- @RequestMapping(value = "/executeGraph", method = RequestMethod.POST)
- @ResponseBody
- public HashMap<String, String> executeGraph(@RequestBody String input) {
- HashMap<String, String> hash = new HashMap<String, String>();
- Properties parms = new Properties();
-
- hash.put("status", "success");
- JsonObject jsonInput = new Gson().fromJson(input, JsonObject.class);
- JsonObject passthroughObj = jsonInput.get("input").getAsJsonObject();
-
- writeResponseToCtx(passthroughObj.toString(), parms, "input");
-
- JsonObject inputObject = jsonInput.get("graphDetails").getAsJsonObject();
- try {
- // Any of these can throw a nullpointer exception
- String calledModule = inputObject.get("module").getAsString();
- String calledRpc = inputObject.get("rpc").getAsString();
- String modeStr = inputObject.get("mode").getAsString();
- // execute should only throw a SvcLogicException
- Properties respProps = svc.execute(calledModule, calledRpc, null, modeStr, parms);
- for (Entry<Object, Object> prop : respProps.entrySet()) {
- hash.put((String) prop.getKey(), (String) prop.getValue());
- }
- } catch (NullPointerException npe) {
- HashMap<String, String> errorHash = new HashMap<String, String>();
- errorHash.put("error-message", "check that you populated module, rpc and or mode correctly.");
- return errorHash;
- } catch (SvcLogicException e) {
- HashMap<String, String> errorHash = new HashMap<String, String>();
- errorHash.put("status", "failure");
- errorHash.put("message", e.getMessage());
- return errorHash;
- }
- return hash;
- }
-
- public static void writeResponseToCtx(String resp, Properties ctx, String prefix) {
- JsonParser jp = new JsonParser();
- JsonElement element = jp.parse(resp);
- writeJsonObject(element.getAsJsonObject(), ctx, prefix + ".");
- }
-
- public static void writeJsonObject(JsonObject obj, Properties ctx, String root) {
- for (Entry<String, JsonElement> entry : obj.entrySet()) {
- if (entry.getValue().isJsonObject()) {
- writeJsonObject(entry.getValue().getAsJsonObject(), ctx, root + entry.getKey() + ".");
- } else if (entry.getValue().isJsonArray()) {
- JsonArray array = entry.getValue().getAsJsonArray();
- ctx.put(root + entry.getKey() + "_length", String.valueOf(array.size()));
- Integer arrayIdx = 0;
- for (JsonElement element : array) {
- if (element.isJsonObject()) {
- writeJsonObject(element.getAsJsonObject(), ctx, root + entry.getKey() + "[" + arrayIdx + "].");
- }
- arrayIdx++;
- }
- } else {
- ctx.put(root + entry.getKey(), entry.getValue().getAsString());
- }
- }
- }
-
-
-}
diff --git a/ms/sliboot/src/main/resources/application.properties b/ms/sliboot/src/main/resources/application.properties
index d98aac30..5fae584e 100644
--- a/ms/sliboot/src/main/resources/application.properties
+++ b/ms/sliboot/src/main/resources/application.properties
@@ -25,3 +25,4 @@ spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.database=mysql
+spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER