X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontroller%2FCreateClosedLoopFaultController.java;h=839a79f29b04337b1b86a22e18fa36fce722ad88;hb=428150834ee60899b9a8da019bae3c8bf009adf1;hp=e7740c336922f1de952a020fd724a71c56dee9fb;hpb=7ea81288603904f0cb6f57936da44d6a3dd521a6;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java index e7740c336..839a79f29 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java @@ -39,7 +39,7 @@ import org.onap.policy.rest.dao.CommonClassDao; import org.onap.policy.rest.jpa.OnapName; import org.onap.policy.rest.jpa.PolicyEntity; import org.onap.policy.rest.jpa.VarbindDictionary; -import org.openecomp.portalsdk.core.controller.RestrictedBaseController; +import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -120,7 +120,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } jsonBody.setTriggerSignaturesUsedForUI(uiTriggerSignatures); jsonBody.setTriggerTimeWindowUsedForUI(Integer.parseInt(policyData.getClearTimeOut())); - jsonBody.setTrapMaxAgeUsedForUI(Integer.parseInt(policyData.getTrapMaxAge())); + jsonBody.setTrapMaxAge(Integer.parseInt(policyData.getTrapMaxAge())); } jsonBody.setTriggerSignatures(triggerSignatures); @@ -150,7 +150,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } jsonBody.setVerificationSignaturesUsedForUI(uifaultSignatures); - jsonBody.setVerfificationTimeWindowUsedForUI(Integer.parseInt(policyData.getVerificationclearTimeOut())); + jsonBody.setVerificationTimeWindowUsedForUI(Integer.parseInt(policyData.getVerificationclearTimeOut())); } jsonBody.setVerificationSignatures(faultSignatures); ObjectWriter om = new ObjectMapper().writer(); @@ -564,7 +564,8 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ policyAdapter.setGuard(value); } if (attributeId.equals("TTLDate") && !value.contains("NA")){ - String newDate = convertDate(value, true); + PolicyController controller = new PolicyController(); + String newDate = controller.convertDate(value); policyAdapter.setTtlDate(newDate); } } @@ -579,22 +580,6 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } - private String convertDate(String dateTTL, boolean portalType) { - String formateDate = null; - String[] date; - String[] parts; - - if (portalType){ - parts = dateTTL.split("-"); - formateDate = parts[2] + "-" + parts[1] + "-" + parts[0] + "T05:00:00.000Z"; - } else { - date = dateTTL.split("T"); - parts = date[0].split("-"); - formateDate = parts[2] + "-" + parts[1] + "-" + parts[0]; - } - return formateDate; - } - private String readClosedLoopJSONFile(PolicyRestAdapter policyAdapter, PolicyEntity entity) { ObjectMapper mapper = new ObjectMapper(); try { @@ -605,14 +590,14 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ closedLoopBody.setClosedLoopPolicyStatus("InActive"); } policyAdapter.setJsonBodyData(closedLoopBody); - if(closedLoopBody.getTrapMaxAgeUsedForUI() != null){ - policyAdapter.setTrapMaxAge(closedLoopBody.getTrapMaxAgeUsedForUI().toString()); + if(closedLoopBody.getTrapMaxAge() != null){ + policyAdapter.setTrapMaxAge(closedLoopBody.getTrapMaxAge().toString()); } if(closedLoopBody.getTriggerTimeWindowUsedForUI() != null){ policyAdapter.setClearTimeOut(closedLoopBody.getTriggerTimeWindowUsedForUI().toString()); } - if(closedLoopBody.getVerfificationTimeWindowUsedForUI() != null){ - policyAdapter.setVerificationclearTimeOut(closedLoopBody.getVerfificationTimeWindowUsedForUI().toString()); + if(closedLoopBody.getVerificationTimeWindowUsedForUI() != null){ + policyAdapter.setVerificationclearTimeOut(closedLoopBody.getVerificationTimeWindowUsedForUI().toString()); } } catch (Exception e) {