* ============LICENSE_START=======================================================
* ONAP-PAP-REST
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import javax.xml.parsers.ParserConfigurationException;
import org.onap.policy.common.logging.eelf.PolicyLogger;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.pap.xacml.rest.XACMLPapServlet;
import org.onap.policy.pap.xacml.rest.policycontroller.PolicyCreation;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
import org.onap.policy.utils.PolicyUtils;
-import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.std.pap.StdPAPPolicy;
import org.xml.sax.SAXException;
import com.att.research.xacml.util.XACMLProperties;
public class SavePolicyHandler {
+ private static final Logger logger = FlexLogger.getLogger(SavePolicyHandler.class);
private HashMap<String, String> ErrorHeaders = null;
public void doPolicyAPIPut(HttpServletRequest request, HttpServletResponse response) throws IOException {
scanner.useDelimiter("\\A");
json = scanner.hasNext() ? scanner.next() : "";
scanner.close();
- PolicyLogger.info("JSON request from API: " + json);
+
+ if(policyAdapter.isEditPolicy()){
+ PolicyLogger.info("SavePolicyHandler: JSON request from API to update a policy: " + json);
+ } else {
+ PolicyLogger.info("SavePolicyHandler: JSON request from API to create a policy: " + json);
+ }
+
// convert Object sent as JSON into local object
StdPAPPolicy policy = PolicyUtils.jsonStringToObject(json, StdPAPPolicy.class);
//Set policyAdapter values including parentPath (Common to all policy types)
try {
+ PolicyLogger.info("SavePolicyHandler: Setting parameter values to PolicyAdapter");
policyAdapter = setDataToPolicyAdapter(policy, policyType, apiflag);
if(!extendedPolicyOptions(policyAdapter, response)){
response.addHeader("operation", "create");
}
} catch (Exception e1) {
- PolicyLogger.error(XACMLErrorConstants.ERROR_UNKNOWN +
- "Could not set data to policy adapter "+ e1.getMessage());
+ logger.error("Could not set data to policy adapter "+e1.getMessage(),e1);
}
}
}
policyAdapter.setDynamicSettingsMap(policy.getDynamicSettingsMap());
policyAdapter.setRuleProvider(policy.getProviderComboBox());
policyAdapter.setDomainDir(policyAdapter.getPolicyScope());
- policyAdapter.setDomain(policyAdapter.getPolicyScope());
+ policyAdapter.setRainydayMap(policy.getTreatments());
+
return policyAdapter;
}
SavePolicyHandler instance = (SavePolicyHandler) savePolicyHandler.newInstance();
return instance;
} catch (Exception e) {
- PolicyLogger.error(e.getMessage());
+ logger.error(e.getMessage(),e);
}
return null;
}