import org.onap.policy.pap.xacml.rest.controller.BRMSDictionaryController;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
+import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.std.IdentifierImpl;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
// Saving the Configurations file at server location for CreateBrmsRawPolicy policy.
protected void saveConfigurations(String policyName, String jsonBody) {
- try {
- if (policyName.endsWith(".xml")) {
- policyName = policyName.substring(0,
- policyName.lastIndexOf(".xml"));
- }
- PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt");
+
+ if (policyName.endsWith(".xml")) {
+ policyName = policyName.substring(0,
+ policyName.lastIndexOf(".xml"));
+ }
+ try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt")){
out.println(jsonBody);
- out.close();
-
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsRawPolicy", "Exception saving configurations file");
}
}
@Override
- public Map<String, String> savePolicies() throws Exception {
+ public Map<String, String> savePolicies() throws PAPException {
Map<String, String> successMap = new HashMap<>();
if(isPolicyExists()){
// separately because the fully configured policy is used for multiple
// things
@Override
- public boolean prepareToSave() throws Exception {
+ public boolean prepareToSave() throws PAPException {
if (isPreparedToSave()) {
// we have already done this