- private static final Logger LOGGER = FlexLogger.getLogger(PolicyAdapter.class);
-
- public void configure(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- String policyNameValue;
- String configPolicyName = null ;
- if(extendedOptions(policyAdapter, entity)){
- return;
- }
- if(policyAdapter.getPolicyName().startsWith("Config_PM")){
- policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf("_"));
- configPolicyName = "ClosedLoop_PM";
- }else if(policyAdapter.getPolicyName().startsWith("Config_Fault")){
- policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf("_"));
- configPolicyName = "ClosedLoop_Fault";
- }else if(policyAdapter.getPolicyName().startsWith("Config_FW")){
- policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf("_"));
- configPolicyName = "Firewall Config";
- }else if(policyAdapter.getPolicyName().startsWith("Config_BRMS_Raw")){
- policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf("_"));
- configPolicyName = "BRMS_Raw";
- }else if(policyAdapter.getPolicyName().startsWith("Config_BRMS_Param")){
- policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf("_"));
- configPolicyName = "BRMS_Param";
- }else if(policyAdapter.getPolicyName().startsWith("Config_MS")){
- policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf("_"));
- configPolicyName = "Micro Service";
- }else if(policyAdapter.getPolicyName().startsWith("Action") || policyAdapter.getPolicyName().startsWith("Decision") ){
- policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf("_"));
- }else{
- policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf("_"));
- configPolicyName = "Base";
- }
- if (policyNameValue != null) {
- policyAdapter.setPolicyType(policyNameValue);
- }
- if (configPolicyName != null) {
- policyAdapter.setConfigPolicyType(configPolicyName);
- }
+ private static final Logger LOGGER = FlexLogger.getLogger(PolicyAdapter.class);
+
+ /**
+ * configure.
+ *
+ * @param policyAdapter PolicyRestAdapter object
+ * @param entity PolicyEntity object
+ */
+ public void configure(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
+ String policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf('_'));
+ String configPolicyName = getConfigPolicyName(policyAdapter);
+ policyAdapter.setPolicyType(policyNameValue);
+
+ if (configPolicyName != null) {
+ policyAdapter.setConfigPolicyType(configPolicyName);
+ }
+ if ("Action".equalsIgnoreCase(policyAdapter.getPolicyType())) {
+ new ActionPolicyController().prePopulateActionPolicyData(policyAdapter);
+ }
+ if ("Decision".equalsIgnoreCase(policyAdapter.getPolicyType())) {
+ new DecisionPolicyController().prePopulateDecisionPolicyData(policyAdapter, entity);
+ }
+ if ("Config".equalsIgnoreCase(policyAdapter.getPolicyType())) {
+ prePopulatePolicyData(policyAdapter, entity);
+ }
+ }