X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PDP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpdp%2Frest%2Fapi%2Fservices%2FClosedLoopPMPolicyService.java;h=64178fc0015c754225366044a54c6da3237e0eb6;hb=refs%2Fchanges%2F09%2F61209%2F1;hp=3f0416492cb0141554716d8b06f11e6cf70edb69;hpb=84df4a428ded309f750f52ac1c104ac84e426fc0;p=policy%2Fengine.git diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyService.java index 3f0416492..64178fc00 100644 --- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyService.java +++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyService.java @@ -3,6 +3,7 @@ * ONAP-PDP-REST * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +30,7 @@ import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.pdp.rest.api.utils.PolicyApiUtils; import org.onap.policy.xacml.api.XACMLErrorConstants; import org.onap.policy.xacml.std.pap.StdPAPPolicy; +import org.onap.policy.xacml.std.pap.StdPAPPolicyParams; /** * Closed Loop PM policy Implementation. @@ -116,10 +118,24 @@ public class ClosedLoopPMPolicyService { String jsonBody = configBody.toString(); String serviceType = configBody.get("serviceTypePolicyName").toString().replace("\"", ""); // Create Policy. - StdPAPPolicy newPAPPolicy = new StdPAPPolicy("ClosedLoop_PM", policyName, - policyParameters.getPolicyDescription(), onapName, - jsonBody, false, null, serviceType, updateFlag, policyScope, 0, policyParameters.getRiskLevel(), - policyParameters.getRiskType(), String.valueOf(policyParameters.getGuard()), date); + // Creating CloseLoop_Fault and Performance Metric Policies + StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder() + .configPolicyType("ClosedLoop_PM") + .policyName(policyName) + .description(policyParameters.getPolicyDescription()) + .onapName(onapName) + .jsonBody(jsonBody) + .draft(false) + .oldPolicyFileName(null) + .serviceType(serviceType) + .editPolicy(updateFlag) + .domain(policyScope) + .highestVersion(0) + .riskLevel(policyParameters.getRiskLevel()) + .riskType(policyParameters.getRiskType()) + .guard(String.valueOf(policyParameters.getGuard())) + .ttlDate(date) + .build()); //send JSON object to PAP response = (String) papServices.callPAP(newPAPPolicy, new String[]{"operation=" + operation, "apiflag=api", "policyType=Config"}, policyParameters.getRequestID(), "ConfigClosedLoop");