X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ECOMP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcomponents%2FAutoPushPolicy.java;h=31871587b8b5ae84042a273275308b47854507f0;hb=685ed1545ed28b777a3ba6e7d315b78f355154cb;hp=b658483d2e90d1d67f6820bcc476b1cb70d6bcf5;hpb=fc5c07705edc4dcb7083b39116a43844bb6a1490;p=policy%2Fengine.git diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java index b658483d2..31871587b 100644 --- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java +++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java @@ -32,8 +32,6 @@ import org.openecomp.policy.common.logging.eelf.MessageCodes; import org.openecomp.policy.common.logging.eelf.PolicyLogger; import org.openecomp.policy.common.logging.flexlogger.FlexLogger; import org.openecomp.policy.common.logging.flexlogger.Logger; -import org.openecomp.policy.xacml.api.pap.EcompPDPGroup; -import org.openecomp.policy.xacml.api.pap.PAPPolicyEngine; import org.openecomp.policy.xacml.std.pap.StdPDPGroup; import org.openecomp.policy.xacml.std.pap.StdPDPPolicy; @@ -64,63 +62,6 @@ public class AutoPushPolicy { readFile(); } - /** - * Checks Policy with all the Groups which has set such Property. - * Else returns Empty Set. - * - * @param policyToCreateUpdate - * @param papEngine - */ - public Set checkGroupsToPush(String policyToCreateUpdate, PAPPolicyEngine papEngine) { - Set changedGroups= new HashSet<>(); - // Check if the file has been modified. then re-load the properties file. - newModified = propFile.lastModified(); - try { - if(newModified!=oldModified){ - // File has been updated. - readFile(); - } - // Read the File name as its made. - String gitPath = PolicyDBDao.getGitPath(); - String policyId = policyToCreateUpdate.substring(policyToCreateUpdate.indexOf(gitPath)+gitPath.length()+1); - String policyName = policyId.substring(policyId.lastIndexOf(File.separator)+1,policyId.lastIndexOf(".")); - policyName = policyName.substring(0,policyName.lastIndexOf(".")); - policyId = policyId.replace("/", "."); - if(policyId.contains("\\")){ - policyId = policyId.replace("\\", "."); - } - LOGGER.info("Policy ID : " + policyId); - LOGGER.info("Policy Name : " + policyName); - // Read in Groups - for(EcompPDPGroup pdpGroup: papEngine.getEcompPDPGroups()){ - String groupName = pdpGroup.getName(); - Boolean typeFlag = false; - Boolean scopeFlag = false; - if(properties.containsKey(groupName + ".policyType")){ - String type= properties.getProperty(groupName + ".policyType").replaceAll(" ",""); - if(type.equals("")){ - type = " "; - } - typeFlag = policyName.contains(type); - } - if(properties.containsKey(groupName + ".policyScope")){ - String scope = properties.getProperty(groupName + ".policyScope").replaceAll(" ", ""); - if(scope.equals("")){ - scope = " "; - } - scopeFlag = policyId.contains(scope); - } - if(typeFlag || scopeFlag){ - StdPDPGroup group = addToGroup(policyId,policyName, policyToCreateUpdate, (StdPDPGroup)pdpGroup); - changedGroups.add(group); - } - } - } catch (Exception e) { - PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "AutoPushPolicy", "Error while processing the auto push for " + policyToCreateUpdate); - } - return changedGroups; - } - private void readFile(){ try { properties.load(new FileInputStream(propFile));