diff options
Diffstat (limited to 'ONAP-PAP-REST/src/main/java')
2 files changed, 4 insertions, 12 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java index d989470a2..64324d432 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java @@ -115,7 +115,7 @@ public class PolicyCreation extends AbstractPolicyCreation{ policyData.setTtlDate("NA"); }else{ String dateTTL = policyData.getTtlDate(); - String newDate = convertDate(dateTTL, false); + String newDate = convertDate(dateTTL); policyData.setTtlDate(newDate); } diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java index 71de2b297..aa33729c9 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java @@ -40,18 +40,10 @@ public abstract class AbstractPolicyCreation { getDomain().replaceAll("[/\\\\.]", ":"), "xacml", "policy", "id", UUID.randomUUID()); } - public String convertDate(String dateTTL, boolean portalType) { + public String convertDate(String dateTTL) { String formateDate = null; - String[] date; - String[] parts; - - if (portalType){ - parts = dateTTL.split("-"); - formateDate = parts[2] + "-" + parts[1] + "-" + parts[0]; - } else { - date = dateTTL.split("T"); - parts = date[0].split("-"); - formateDate = parts[2] + "-" + parts[1] + "-" + parts[0]; + if(dateTTL.contains("/")){ + formateDate = dateTTL.replace("/", "-"); } return formateDate; } |