@Test public void testPrepareToSaveRainyDay() { logger.debug("test PrepareToSave Policy: enter"); policyAdapter.setRuleProvider("Rainy_Day"); component = new DecisionPolicy(policyAdapter); boolean response = false; try { response = component.prepareToSave(); } catch (Exception e) { logger.error("Exception Occured" + e); } assertTrue(response); }
@Override public boolean prepareToSave() throws PAPException { if (isPreparedToSave()) { return true; } int version = 0; String policyID = policyAdapter.getPolicyID(); version = policyAdapter.getHighestVersion(); if ("Raw".equals(policyAdapter.getRuleProvider())) { readRawPolicyData(); return true; } if ("Decision".equals(policyAdapter.getPolicyType())) { PolicyType policyConfig = new PolicyType(); policyConfig.setVersion(Integer.toString(version)); policyConfig.setPolicyId(policyID); policyConfig.setTarget(new TargetType()); policyAdapter.setData(policyConfig); } policyName = policyAdapter.getNewFileName(); if (policyAdapter.getRuleProvider().equals(GUARD_YAML) || policyAdapter.getRuleProvider().equals(GUARD_BL_YAML) || policyAdapter.getRuleProvider().equals(GUARD_MIN_MAX)) { Map<String, String> yamlParams = new HashMap<>(); String blackListEntryType = policyAdapter.getBlackListEntryType() != null ? policyAdapter.getBlackListEntryType() : "Use Manual Entry"; String description = policyAdapter.getPolicyDescription() != null ? policyAdapter.getPolicyDescription() : "YAML Guard Policy"; yamlParams.put(DESCRIPTION, description + "@blEntry@" + blackListEntryType + "@blEntry@"); String fileName = policyAdapter.getNewFileName(); String name = fileName.substring(fileName.lastIndexOf('\\') + 1, fileName.length()); if ((name == null) || ("".equals(name))) { name = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length()); } yamlParams.put(POLICY_NAME, name); yamlParams.put(ONAPNAME, policyAdapter.getOnapName()); Map<String, String> params = policyAdapter.getDynamicFieldConfigAttributes(); yamlParams.putAll(params); try { PolicyType decisionPolicy = getGuardPolicy(yamlParams, policyAdapter.getRuleProvider()); decisionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId()); decisionPolicy.setVersion(Integer.toString(version)); policyAdapter.setPolicyData(decisionPolicy); policyAdapter.setData(decisionPolicy); } catch (BuilderException e) { LOGGER.error(e); throw new PAPException(e); } } else if (policyAdapter.getData() != null) { PolicyType decisionPolicy = (PolicyType) policyAdapter.getData(); decisionPolicy.setDescription(policyAdapter.getPolicyDescription()); decisionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId()); AllOfType allOfOne = new AllOfType(); String fileName = policyAdapter.getNewFileName(); String name = fileName.substring(fileName.lastIndexOf('\\') + 1, fileName.length()); if ((name == null) || ("".equals(name))) { name = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length()); } allOfOne.getMatch().add(createMatch(POLICY_NAME, name)); AllOfType allOf = new AllOfType(); allOf.getMatch().add(createMatch(ONAPNAME, (policyAdapter.getOnapName()))); Map<String, String> dynamicFieldComponentAttributes = policyAdapter.getDynamicFieldConfigAttributes(); if (policyAdapter.getRuleProvider() != null && policyAdapter.getRuleProvider().equals(AAFPROVIDER)) { dynamicFieldComponentAttributes = new HashMap<>(); } for (String keyField : dynamicFieldComponentAttributes.keySet()) { String key = keyField; String value = dynamicFieldComponentAttributes.get(key); MatchType dynamicMatch = createDynamicMatch(key, value); allOf.getMatch().add(dynamicMatch); } AnyOfType anyOf = new AnyOfType(); anyOf.getAllOf().add(allOfOne); anyOf.getAllOf().add(allOf); TargetType target = new TargetType(); target.getAnyOf().add(anyOf); decisionPolicy.setTarget(target); Map<String, String> dynamicFieldDecisionSettings = policyAdapter.getDynamicSettingsMap(); if (policyAdapter.getRuleProvider() != null && (policyAdapter.getRuleProvider().equals(AAFPROVIDER) || policyAdapter.getRuleProvider().equals(RAINY_DAY))) { dynamicFieldDecisionSettings = new HashMap<>(); } for (String keyField : dynamicFieldDecisionSettings.keySet()) { String key = keyField; String value = dynamicFieldDecisionSettings.get(key); String dataType = getDataType(key); VariableDefinitionType dynamicVariable = createDynamicVariable(key, value, dataType); decisionPolicy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(dynamicVariable); } Map<String, String> dynamicFieldTreatmentAttributes = policyAdapter.getRainydayMap(); if (policyAdapter.getRuleProvider().equals(RAINY_DAY)) { for (String keyField : dynamicFieldTreatmentAttributes.keySet()) { String errorcode = keyField; String treatment = dynamicFieldTreatmentAttributes.get(errorcode); createRainydayRule(decisionPolicy, errorcode, treatment, true); } } else { createRule(decisionPolicy, true); createRule(decisionPolicy, false); } } setPreparedToSave(true); return true; }
DecisionPolicy extends Policy { @Override public boolean prepareToSave() throws PAPException { if (isPreparedToSave()) { return true; } int version = 0; String policyID = policyAdapter.getPolicyID(); version = policyAdapter.getHighestVersion(); if ("Raw".equals(policyAdapter.getRuleProvider())) { readRawPolicyData(); return true; } if ("Decision".equals(policyAdapter.getPolicyType())) { PolicyType policyConfig = new PolicyType(); policyConfig.setVersion(Integer.toString(version)); policyConfig.setPolicyId(policyID); policyConfig.setTarget(new TargetType()); policyAdapter.setData(policyConfig); } policyName = policyAdapter.getNewFileName(); if (policyAdapter.getRuleProvider().equals(GUARD_YAML) || policyAdapter.getRuleProvider().equals(GUARD_BL_YAML) || policyAdapter.getRuleProvider().equals(GUARD_MIN_MAX)) { Map<String, String> yamlParams = new HashMap<>(); String blackListEntryType = policyAdapter.getBlackListEntryType() != null ? policyAdapter.getBlackListEntryType() : "Use Manual Entry"; String description = policyAdapter.getPolicyDescription() != null ? policyAdapter.getPolicyDescription() : "YAML Guard Policy"; yamlParams.put(DESCRIPTION, description + "@blEntry@" + blackListEntryType + "@blEntry@"); String fileName = policyAdapter.getNewFileName(); String name = fileName.substring(fileName.lastIndexOf('\\') + 1, fileName.length()); if ((name == null) || ("".equals(name))) { name = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length()); } yamlParams.put(POLICY_NAME, name); yamlParams.put(ONAPNAME, policyAdapter.getOnapName()); Map<String, String> params = policyAdapter.getDynamicFieldConfigAttributes(); yamlParams.putAll(params); try { PolicyType decisionPolicy = getGuardPolicy(yamlParams, policyAdapter.getRuleProvider()); decisionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId()); decisionPolicy.setVersion(Integer.toString(version)); policyAdapter.setPolicyData(decisionPolicy); policyAdapter.setData(decisionPolicy); } catch (BuilderException e) { LOGGER.error(e); throw new PAPException(e); } } else if (policyAdapter.getData() != null) { PolicyType decisionPolicy = (PolicyType) policyAdapter.getData(); decisionPolicy.setDescription(policyAdapter.getPolicyDescription()); decisionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId()); AllOfType allOfOne = new AllOfType(); String fileName = policyAdapter.getNewFileName(); String name = fileName.substring(fileName.lastIndexOf('\\') + 1, fileName.length()); if ((name == null) || ("".equals(name))) { name = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length()); } allOfOne.getMatch().add(createMatch(POLICY_NAME, name)); AllOfType allOf = new AllOfType(); allOf.getMatch().add(createMatch(ONAPNAME, (policyAdapter.getOnapName()))); Map<String, String> dynamicFieldComponentAttributes = policyAdapter.getDynamicFieldConfigAttributes(); if (policyAdapter.getRuleProvider() != null && policyAdapter.getRuleProvider().equals(AAFPROVIDER)) { dynamicFieldComponentAttributes = new HashMap<>(); } for (String keyField : dynamicFieldComponentAttributes.keySet()) { String key = keyField; String value = dynamicFieldComponentAttributes.get(key); MatchType dynamicMatch = createDynamicMatch(key, value); allOf.getMatch().add(dynamicMatch); } AnyOfType anyOf = new AnyOfType(); anyOf.getAllOf().add(allOfOne); anyOf.getAllOf().add(allOf); TargetType target = new TargetType(); target.getAnyOf().add(anyOf); decisionPolicy.setTarget(target); Map<String, String> dynamicFieldDecisionSettings = policyAdapter.getDynamicSettingsMap(); if (policyAdapter.getRuleProvider() != null && (policyAdapter.getRuleProvider().equals(AAFPROVIDER) || policyAdapter.getRuleProvider().equals(RAINY_DAY))) { dynamicFieldDecisionSettings = new HashMap<>(); } for (String keyField : dynamicFieldDecisionSettings.keySet()) { String key = keyField; String value = dynamicFieldDecisionSettings.get(key); String dataType = getDataType(key); VariableDefinitionType dynamicVariable = createDynamicVariable(key, value, dataType); decisionPolicy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(dynamicVariable); } Map<String, String> dynamicFieldTreatmentAttributes = policyAdapter.getRainydayMap(); if (policyAdapter.getRuleProvider().equals(RAINY_DAY)) { for (String keyField : dynamicFieldTreatmentAttributes.keySet()) { String errorcode = keyField; String treatment = dynamicFieldTreatmentAttributes.get(errorcode); createRainydayRule(decisionPolicy, errorcode, treatment, true); } } else { createRule(decisionPolicy, true); createRule(decisionPolicy, false); } } setPreparedToSave(true); return true; } }
DecisionPolicy extends Policy { @Override public boolean prepareToSave() throws PAPException { if (isPreparedToSave()) { return true; } int version = 0; String policyID = policyAdapter.getPolicyID(); version = policyAdapter.getHighestVersion(); if ("Raw".equals(policyAdapter.getRuleProvider())) { readRawPolicyData(); return true; } if ("Decision".equals(policyAdapter.getPolicyType())) { PolicyType policyConfig = new PolicyType(); policyConfig.setVersion(Integer.toString(version)); policyConfig.setPolicyId(policyID); policyConfig.setTarget(new TargetType()); policyAdapter.setData(policyConfig); } policyName = policyAdapter.getNewFileName(); if (policyAdapter.getRuleProvider().equals(GUARD_YAML) || policyAdapter.getRuleProvider().equals(GUARD_BL_YAML) || policyAdapter.getRuleProvider().equals(GUARD_MIN_MAX)) { Map<String, String> yamlParams = new HashMap<>(); String blackListEntryType = policyAdapter.getBlackListEntryType() != null ? policyAdapter.getBlackListEntryType() : "Use Manual Entry"; String description = policyAdapter.getPolicyDescription() != null ? policyAdapter.getPolicyDescription() : "YAML Guard Policy"; yamlParams.put(DESCRIPTION, description + "@blEntry@" + blackListEntryType + "@blEntry@"); String fileName = policyAdapter.getNewFileName(); String name = fileName.substring(fileName.lastIndexOf('\\') + 1, fileName.length()); if ((name == null) || ("".equals(name))) { name = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length()); } yamlParams.put(POLICY_NAME, name); yamlParams.put(ONAPNAME, policyAdapter.getOnapName()); Map<String, String> params = policyAdapter.getDynamicFieldConfigAttributes(); yamlParams.putAll(params); try { PolicyType decisionPolicy = getGuardPolicy(yamlParams, policyAdapter.getRuleProvider()); decisionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId()); decisionPolicy.setVersion(Integer.toString(version)); policyAdapter.setPolicyData(decisionPolicy); policyAdapter.setData(decisionPolicy); } catch (BuilderException e) { LOGGER.error(e); throw new PAPException(e); } } else if (policyAdapter.getData() != null) { PolicyType decisionPolicy = (PolicyType) policyAdapter.getData(); decisionPolicy.setDescription(policyAdapter.getPolicyDescription()); decisionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId()); AllOfType allOfOne = new AllOfType(); String fileName = policyAdapter.getNewFileName(); String name = fileName.substring(fileName.lastIndexOf('\\') + 1, fileName.length()); if ((name == null) || ("".equals(name))) { name = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length()); } allOfOne.getMatch().add(createMatch(POLICY_NAME, name)); AllOfType allOf = new AllOfType(); allOf.getMatch().add(createMatch(ONAPNAME, (policyAdapter.getOnapName()))); Map<String, String> dynamicFieldComponentAttributes = policyAdapter.getDynamicFieldConfigAttributes(); if (policyAdapter.getRuleProvider() != null && policyAdapter.getRuleProvider().equals(AAFPROVIDER)) { dynamicFieldComponentAttributes = new HashMap<>(); } for (String keyField : dynamicFieldComponentAttributes.keySet()) { String key = keyField; String value = dynamicFieldComponentAttributes.get(key); MatchType dynamicMatch = createDynamicMatch(key, value); allOf.getMatch().add(dynamicMatch); } AnyOfType anyOf = new AnyOfType(); anyOf.getAllOf().add(allOfOne); anyOf.getAllOf().add(allOf); TargetType target = new TargetType(); target.getAnyOf().add(anyOf); decisionPolicy.setTarget(target); Map<String, String> dynamicFieldDecisionSettings = policyAdapter.getDynamicSettingsMap(); if (policyAdapter.getRuleProvider() != null && (policyAdapter.getRuleProvider().equals(AAFPROVIDER) || policyAdapter.getRuleProvider().equals(RAINY_DAY))) { dynamicFieldDecisionSettings = new HashMap<>(); } for (String keyField : dynamicFieldDecisionSettings.keySet()) { String key = keyField; String value = dynamicFieldDecisionSettings.get(key); String dataType = getDataType(key); VariableDefinitionType dynamicVariable = createDynamicVariable(key, value, dataType); decisionPolicy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(dynamicVariable); } Map<String, String> dynamicFieldTreatmentAttributes = policyAdapter.getRainydayMap(); if (policyAdapter.getRuleProvider().equals(RAINY_DAY)) { for (String keyField : dynamicFieldTreatmentAttributes.keySet()) { String errorcode = keyField; String treatment = dynamicFieldTreatmentAttributes.get(errorcode); createRainydayRule(decisionPolicy, errorcode, treatment, true); } } else { createRule(decisionPolicy, true); createRule(decisionPolicy, false); } } setPreparedToSave(true); return true; } DecisionPolicy(); @Autowired  DecisionPolicy(CommonClassDao commonClassDao);  DecisionPolicy(PolicyRestAdapter policyAdapter); }
DecisionPolicy extends Policy { @Override public boolean prepareToSave() throws PAPException { if (isPreparedToSave()) { return true; } int version = 0; String policyID = policyAdapter.getPolicyID(); version = policyAdapter.getHighestVersion(); if ("Raw".equals(policyAdapter.getRuleProvider())) { readRawPolicyData(); return true; } if ("Decision".equals(policyAdapter.getPolicyType())) { PolicyType policyConfig = new PolicyType(); policyConfig.setVersion(Integer.toString(version)); policyConfig.setPolicyId(policyID); policyConfig.setTarget(new TargetType()); policyAdapter.setData(policyConfig); } policyName = policyAdapter.getNewFileName(); if (policyAdapter.getRuleProvider().equals(GUARD_YAML) || policyAdapter.getRuleProvider().equals(GUARD_BL_YAML) || policyAdapter.getRuleProvider().equals(GUARD_MIN_MAX)) { Map<String, String> yamlParams = new HashMap<>(); String blackListEntryType = policyAdapter.getBlackListEntryType() != null ? policyAdapter.getBlackListEntryType() : "Use Manual Entry"; String description = policyAdapter.getPolicyDescription() != null ? policyAdapter.getPolicyDescription() : "YAML Guard Policy"; yamlParams.put(DESCRIPTION, description + "@blEntry@" + blackListEntryType + "@blEntry@"); String fileName = policyAdapter.getNewFileName(); String name = fileName.substring(fileName.lastIndexOf('\\') + 1, fileName.length()); if ((name == null) || ("".equals(name))) { name = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length()); } yamlParams.put(POLICY_NAME, name); yamlParams.put(ONAPNAME, policyAdapter.getOnapName()); Map<String, String> params = policyAdapter.getDynamicFieldConfigAttributes(); yamlParams.putAll(params); try { PolicyType decisionPolicy = getGuardPolicy(yamlParams, policyAdapter.getRuleProvider()); decisionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId()); decisionPolicy.setVersion(Integer.toString(version)); policyAdapter.setPolicyData(decisionPolicy); policyAdapter.setData(decisionPolicy); } catch (BuilderException e) { LOGGER.error(e); throw new PAPException(e); } } else if (policyAdapter.getData() != null) { PolicyType decisionPolicy = (PolicyType) policyAdapter.getData(); decisionPolicy.setDescription(policyAdapter.getPolicyDescription()); decisionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId()); AllOfType allOfOne = new AllOfType(); String fileName = policyAdapter.getNewFileName(); String name = fileName.substring(fileName.lastIndexOf('\\') + 1, fileName.length()); if ((name == null) || ("".equals(name))) { name = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length()); } allOfOne.getMatch().add(createMatch(POLICY_NAME, name)); AllOfType allOf = new AllOfType(); allOf.getMatch().add(createMatch(ONAPNAME, (policyAdapter.getOnapName()))); Map<String, String> dynamicFieldComponentAttributes = policyAdapter.getDynamicFieldConfigAttributes(); if (policyAdapter.getRuleProvider() != null && policyAdapter.getRuleProvider().equals(AAFPROVIDER)) { dynamicFieldComponentAttributes = new HashMap<>(); } for (String keyField : dynamicFieldComponentAttributes.keySet()) { String key = keyField; String value = dynamicFieldComponentAttributes.get(key); MatchType dynamicMatch = createDynamicMatch(key, value); allOf.getMatch().add(dynamicMatch); } AnyOfType anyOf = new AnyOfType(); anyOf.getAllOf().add(allOfOne); anyOf.getAllOf().add(allOf); TargetType target = new TargetType(); target.getAnyOf().add(anyOf); decisionPolicy.setTarget(target); Map<String, String> dynamicFieldDecisionSettings = policyAdapter.getDynamicSettingsMap(); if (policyAdapter.getRuleProvider() != null && (policyAdapter.getRuleProvider().equals(AAFPROVIDER) || policyAdapter.getRuleProvider().equals(RAINY_DAY))) { dynamicFieldDecisionSettings = new HashMap<>(); } for (String keyField : dynamicFieldDecisionSettings.keySet()) { String key = keyField; String value = dynamicFieldDecisionSettings.get(key); String dataType = getDataType(key); VariableDefinitionType dynamicVariable = createDynamicVariable(key, value, dataType); decisionPolicy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(dynamicVariable); } Map<String, String> dynamicFieldTreatmentAttributes = policyAdapter.getRainydayMap(); if (policyAdapter.getRuleProvider().equals(RAINY_DAY)) { for (String keyField : dynamicFieldTreatmentAttributes.keySet()) { String errorcode = keyField; String treatment = dynamicFieldTreatmentAttributes.get(errorcode); createRainydayRule(decisionPolicy, errorcode, treatment, true); } } else { createRule(decisionPolicy, true); createRule(decisionPolicy, false); } } setPreparedToSave(true); return true; } DecisionPolicy(); @Autowired  DecisionPolicy(CommonClassDao commonClassDao);  DecisionPolicy(PolicyRestAdapter policyAdapter); @Override Map<String, String> savePolicies(); @Override boolean prepareToSave(); PolicyType getGuardPolicy(Map<String, String> yamlParams, String ruleProvider); @Override Object getCorrectPolicyDataObject(); String getFunctionDefinitionId(String key); }
DecisionPolicy extends Policy { @Override public boolean prepareToSave() throws PAPException { if (isPreparedToSave()) { return true; } int version = 0; String policyID = policyAdapter.getPolicyID(); version = policyAdapter.getHighestVersion(); if ("Raw".equals(policyAdapter.getRuleProvider())) { readRawPolicyData(); return true; } if ("Decision".equals(policyAdapter.getPolicyType())) { PolicyType policyConfig = new PolicyType(); policyConfig.setVersion(Integer.toString(version)); policyConfig.setPolicyId(policyID); policyConfig.setTarget(new TargetType()); policyAdapter.setData(policyConfig); } policyName = policyAdapter.getNewFileName(); if (policyAdapter.getRuleProvider().equals(GUARD_YAML) || policyAdapter.getRuleProvider().equals(GUARD_BL_YAML) || policyAdapter.getRuleProvider().equals(GUARD_MIN_MAX)) { Map<String, String> yamlParams = new HashMap<>(); String blackListEntryType = policyAdapter.getBlackListEntryType() != null ? policyAdapter.getBlackListEntryType() : "Use Manual Entry"; String description = policyAdapter.getPolicyDescription() != null ? policyAdapter.getPolicyDescription() : "YAML Guard Policy"; yamlParams.put(DESCRIPTION, description + "@blEntry@" + blackListEntryType + "@blEntry@"); String fileName = policyAdapter.getNewFileName(); String name = fileName.substring(fileName.lastIndexOf('\\') + 1, fileName.length()); if ((name == null) || ("".equals(name))) { name = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length()); } yamlParams.put(POLICY_NAME, name); yamlParams.put(ONAPNAME, policyAdapter.getOnapName()); Map<String, String> params = policyAdapter.getDynamicFieldConfigAttributes(); yamlParams.putAll(params); try { PolicyType decisionPolicy = getGuardPolicy(yamlParams, policyAdapter.getRuleProvider()); decisionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId()); decisionPolicy.setVersion(Integer.toString(version)); policyAdapter.setPolicyData(decisionPolicy); policyAdapter.setData(decisionPolicy); } catch (BuilderException e) { LOGGER.error(e); throw new PAPException(e); } } else if (policyAdapter.getData() != null) { PolicyType decisionPolicy = (PolicyType) policyAdapter.getData(); decisionPolicy.setDescription(policyAdapter.getPolicyDescription()); decisionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId()); AllOfType allOfOne = new AllOfType(); String fileName = policyAdapter.getNewFileName(); String name = fileName.substring(fileName.lastIndexOf('\\') + 1, fileName.length()); if ((name == null) || ("".equals(name))) { name = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length()); } allOfOne.getMatch().add(createMatch(POLICY_NAME, name)); AllOfType allOf = new AllOfType(); allOf.getMatch().add(createMatch(ONAPNAME, (policyAdapter.getOnapName()))); Map<String, String> dynamicFieldComponentAttributes = policyAdapter.getDynamicFieldConfigAttributes(); if (policyAdapter.getRuleProvider() != null && policyAdapter.getRuleProvider().equals(AAFPROVIDER)) { dynamicFieldComponentAttributes = new HashMap<>(); } for (String keyField : dynamicFieldComponentAttributes.keySet()) { String key = keyField; String value = dynamicFieldComponentAttributes.get(key); MatchType dynamicMatch = createDynamicMatch(key, value); allOf.getMatch().add(dynamicMatch); } AnyOfType anyOf = new AnyOfType(); anyOf.getAllOf().add(allOfOne); anyOf.getAllOf().add(allOf); TargetType target = new TargetType(); target.getAnyOf().add(anyOf); decisionPolicy.setTarget(target); Map<String, String> dynamicFieldDecisionSettings = policyAdapter.getDynamicSettingsMap(); if (policyAdapter.getRuleProvider() != null && (policyAdapter.getRuleProvider().equals(AAFPROVIDER) || policyAdapter.getRuleProvider().equals(RAINY_DAY))) { dynamicFieldDecisionSettings = new HashMap<>(); } for (String keyField : dynamicFieldDecisionSettings.keySet()) { String key = keyField; String value = dynamicFieldDecisionSettings.get(key); String dataType = getDataType(key); VariableDefinitionType dynamicVariable = createDynamicVariable(key, value, dataType); decisionPolicy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(dynamicVariable); } Map<String, String> dynamicFieldTreatmentAttributes = policyAdapter.getRainydayMap(); if (policyAdapter.getRuleProvider().equals(RAINY_DAY)) { for (String keyField : dynamicFieldTreatmentAttributes.keySet()) { String errorcode = keyField; String treatment = dynamicFieldTreatmentAttributes.get(errorcode); createRainydayRule(decisionPolicy, errorcode, treatment, true); } } else { createRule(decisionPolicy, true); createRule(decisionPolicy, false); } } setPreparedToSave(true); return true; } DecisionPolicy(); @Autowired  DecisionPolicy(CommonClassDao commonClassDao);  DecisionPolicy(PolicyRestAdapter policyAdapter); @Override Map<String, String> savePolicies(); @Override boolean prepareToSave(); PolicyType getGuardPolicy(Map<String, String> yamlParams, String ruleProvider); @Override Object getCorrectPolicyDataObject(); String getFunctionDefinitionId(String key); static final String FUNCTION_NOT; static final String GUARD_YAML; static final String GUARD_BL_YAML; static final String GUARD_MIN_MAX; static final String RAINY_DAY; static final String MS_MODEL; }