X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcontroller%2FBRMSDictionaryController.java;h=3e695b7da91fcf9917901ea8266bf45ccd1d496f;hb=6e2d9d53bedf7b1239eb57bd58102abc3bed98db;hp=beee437e4e3c624c24f8734237fb2ba0ba49585f;hpb=af7f65b6cdc759e4968604e7fa9ff45562bdd8e2;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/BRMSDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/BRMSDictionaryController.java index beee437e4..3e695b7da 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/BRMSDictionaryController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/BRMSDictionaryController.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-PAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -86,6 +86,9 @@ public class BRMSDictionaryController{ public BRMSDictionaryController(CommonClassDao commonClassDao){ BRMSDictionaryController.commonClassDao = commonClassDao; } + public static void setCommonClassDao(CommonClassDao commonClassDao2) { + BRMSDictionaryController.commonClassDao = commonClassDao2; + } /* * This is an empty constructor */ @@ -130,7 +133,7 @@ public class BRMSDictionaryController{ } @RequestMapping(value={"/brms_dictionary/set_BRMSParamData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}) - public void SetRuleData(HttpServletRequest request) throws IOException{ + public static void setRuleData(HttpServletRequest request) throws IOException{ StringWriter writer = new StringWriter(); IOUtils.copy(request.getInputStream() , writer, StandardCharsets.UTF_8); String cleanStreamBoundary = writer.toString().replaceFirst("------(.*)(?s).*octet-stream", ""); @@ -306,9 +309,8 @@ public class BRMSDictionaryController{ //check if update operation or create, get id for data to be updated if ((update).equals(request.getParameter(operation))) { List duplicateData = commonClassDao.checkDuplicateEntry(brmsDependency.getDependencyName(), dependencyName, BRMSDependency.class); - int id = 0; BRMSDependency data = (BRMSDependency) duplicateData.get(0); - id = data.getId(); + int id = data.getId(); brmsDependency.setId(id); brmsDependency.setUserCreatedBy(this.getUserInfo(userId)); } @@ -461,9 +463,8 @@ public class BRMSDictionaryController{ //check if update operation or create, get id for data to be updated if ((update).equals(request.getParameter(operation))) { List duplicateData = commonClassDao.checkDuplicateEntry(brmsController.getControllerName(), controllerName, BRMSController.class); - int id = 0; BRMSController data = (BRMSController) duplicateData.get(0); - id = data.getId(); + int id = data.getId(); brmsController.setId(id); brmsController.setUserCreatedBy(this.getUserInfo(userId)); }