X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontroller%2FCreateBRMSRawController.java;h=3ab4f4f16c3206392c655fb9df944971a055169a;hb=e957a1d9a9fa6bd0f9f8348d1e864c09cfe2cb92;hp=9851d3165db1a96af3c1b929e7db4e015984b9b7;hpb=073cc188efe9abb4c010cf674e34e2cf46ef1c52;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java index 9851d3165..3ab4f4f16 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java @@ -57,7 +57,7 @@ public class CreateBRMSRawController{ @SuppressWarnings("unchecked") public void prePopulateBRMSRawPolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) { - attributeList = new ArrayList(); + attributeList = new ArrayList<>(); if (policyAdapter.getPolicyData() instanceof PolicyType) { PolicyType policy = (PolicyType) policyAdapter.getPolicyData(); policyAdapter.setOldPolicyFileName(policyAdapter.getPolicyName()); @@ -89,7 +89,7 @@ public class CreateBRMSRawController{ attribute.put("value", value); attributeList.add(attribute); }else if(attributeAssignment.getAttributeId().startsWith("dependencies:")){ - ArrayList dependencies = new ArrayList(Arrays.asList(attributeAssignment.getAttributeId().replace("dependencies:", "").split(","))); + ArrayList dependencies = new ArrayList<>(Arrays.asList(attributeAssignment.getAttributeId().replace("dependencies:", "").split(","))); if(dependencies.contains("")){ dependencies.remove(""); } @@ -131,17 +131,18 @@ public class CreateBRMSRawController{ AttributeDesignatorType designator = match.getAttributeDesignator(); String attributeId = designator.getAttributeId(); - if (attributeId.equals("RiskType")){ + if ("RiskType".equals(attributeId)){ policyAdapter.setRiskType(value); } - if (attributeId.equals("RiskLevel")){ + if ("RiskLevel".equals(attributeId)){ policyAdapter.setRiskLevel(value); } - if (attributeId.equals("guard")){ + if ("guard".equals(attributeId)){ policyAdapter.setGuard(value); } - if (attributeId.equals("TTLDate") && !value.contains("NA")){ - String newDate = convertDate(value, true); + if ("TTLDate".equals(attributeId) && !value.contains("NA")){ + PolicyController controller = new PolicyController(); + String newDate = controller.convertDate(value); policyAdapter.setTtlDate(newDate); } } @@ -154,19 +155,4 @@ public class CreateBRMSRawController{ } } - 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; - } }