-
- try {
- body.append("/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI purpose. \n\t " +
- "<$%BRMSParamTemplate=" + tempateValue + "%$> \n */ \n");
- body.append(valueFromDictionary + "\n");
- generatedRule.append("rule \"" +policyName.substring(0, policyName.replace(".xml", "").lastIndexOf(".")) +".PapParams\" \n\tsalience 1000 \n\twhen\n\tthen\n\t\tPapParams params = new PapParams();");
-
- //We first read the map data structure(ruleAndUIValue) received from the PAP-ADMIN
- //We ignore if the key is "templateName as we are interested only in the UI fields and its value.
- //We have one more map data structure(typeOfUIField) created by parsing the Drools rule.
- //From the type of the UI field(String/int) we structure whether to put the "" or not.
- for (Map.Entry<String, String> entry : ruleAndUIValue.entrySet()) {
- if(entry.getKey()!="templateName")
- {
- for(Map.Entry<String, String> fieldType:typeOfUIField.entrySet())
- {
- if(fieldType.getKey().equalsIgnoreCase(entry.getKey()))
- {
- String key = entry.getKey().substring(0, 1).toUpperCase() + entry.getKey().substring(1);
- if(fieldType.getValue()=="String")
- {
- //Type is String
- generatedRule.append("\n\t\tparams.set"
- + key + "(\""
- + entry.getValue() + "\");");
- }
- else{
- generatedRule.append("\n\t\tparams.set"
- + key + "("
- + entry.getValue() + ");");
- }
- }
- }
- }
- }
-
- generatedRule.append("\n\t\tinsert(params);\nend");
- LOGGER.info("New rule generated with :" + generatedRule);
- body.append(generatedRule);
- } catch (Exception e) {
- PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving policy");
- }
+ body.append("/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI purpose. \n\t " +
+ "<$%BRMSParamTemplate=" + templateValue + "%$> \n");
+ body.append("<%$Values=");
+ for (Map.Entry<String, String> entry : ruleAndUIValue.entrySet()) {
+ String uiKey = entry.getKey();
+ if(!"templateName".equals(uiKey)) {
+ body.append(uiKey+":-:"+entry.getValue()+":|:");
+ }
+ }
+ body.append("$%> \n*/ \n");
+ body.append(valueFromDictionary + "\n");