- private void setClientScope() {
- if ("Firewall".equalsIgnoreCase(policyType)) {
- clientScope = "ConfigFirewall";
- filePrefix = "Config_FW_";
- } else if ("Action".equalsIgnoreCase(policyType)) {
- clientScope = "Action";
- filePrefix = "Action_";
- } else if ("Decision".equalsIgnoreCase(policyType)) {
- clientScope = "Decision";
- filePrefix = "Decision_";
- } else if ("Base".equalsIgnoreCase(policyType)) {
- clientScope = "Config";
- filePrefix = "Config_";
- } else if ("ClosedLoop_Fault".equalsIgnoreCase(policyType)) {
- clientScope = "ConfigClosedLoop";
- filePrefix = "Config_Fault_";
- } else if ("ClosedLoop_PM".equalsIgnoreCase(policyType)) {
- clientScope = "ConfigClosedLoop";
- filePrefix = "Config_PM_";
- } else if ("MicroService".equalsIgnoreCase(policyType)) {
- clientScope = "ConfigMS";
- filePrefix = "Config_MS_";
- } else if ("Optimization".equalsIgnoreCase(policyType)) {
- clientScope = "ConfigOptimization";
- filePrefix = "Config_OOF_";
- }else if ("BRMS_RAW".equalsIgnoreCase(policyType)) {
- clientScope = "ConfigBrmsRaw";
- filePrefix = "Config_BRMS_Raw_";
- } else if ("BRMS_PARAM".equalsIgnoreCase(policyType)) {
- clientScope = "ConfigBrmsParam";
- filePrefix = "Config_BRMS_Param_";
- } else {
- clientScope = null;
- message = XACMLErrorConstants.ERROR_DATA_ISSUE + policyType
- + " is not a valid Policy Type.";
+ final String activeVersion = papServices.getActiveVersion(policyData.getPolicyScope(),
+ policyData.getFilePrefix(), policyData.getPolicyName(), policyData.getClientScope(),
+ deletePolicyParameters.getRequestID());
+
+ if ("pe100".equalsIgnoreCase(activeVersion)) {
+ message = XACMLErrorConstants.ERROR_PERMISSIONS
+ + "response code of the URL is 403. PEP is not Authorized for making this Request!! "
+ + "Contact Administrator for this Scope. ";
+ LOGGER.warn(message + PRINT_REQUESTID + this.requestId);
+ return false;
+ } else if ("pe300".equalsIgnoreCase(activeVersion)) {
+ message = XACMLErrorConstants.ERROR_DATA_ISSUE + "response code of the URL is 404. "
+ + "This indicates a problem with getting the version"
+ + "from the PAP or the policy does not exist.";
+ LOGGER.warn(message + PRINT_REQUESTID + this.requestId);
+ return false;
+ }
+ if ("0".equalsIgnoreCase(activeVersion)) {
+ message = XACMLErrorConstants.ERROR_DATA_ISSUE + "could not retrieve the activeVersion for this policy."
+ + "This indicates the policy does not exist, please verify the policy exists.";
+ LOGGER.warn(message + PRINT_REQUESTID + this.requestId);
+ return false;
+ }
+
+ policyData.setFullPolicyName(policyData.getPolicyScope() + "." + policyData.getFilePrefix()
+ + policyData.getPolicyName() + "." + activeVersion + ".xml");