private void addElementsToProperties(List elements, Properties props, String parentPath) { for (java.lang.Object o : elements) { Node ele = (Node) o; if (ele.getNodeType() != 1) { // text continue; } String contents = ele.getText().trim(); String newParentPath = ""; if (!StringUtils.isEmpty(parentPath)) { newParentPath = parentPath + "."; } newParentPath += ele.getName(); if (!StringUtils.isEmpty(contents)) { props.setProperty(newParentPath, contents); } if (ele instanceof Element) { List children = ((Element) ele).content(); addElementsToProperties(children, props, newParentPath); } } }
public void setProperty(String name, String value) { name = name.trim(); if (StringUtils.isEmpty(name)) { return; } if (name.equals("drools.dialect.default")) { setDefaultDialect(value); } else if (name.startsWith("drools.accumulate.function")) { addAccumulateFunction(name.substring(name.lastIndexOf('.')), value); } else if (name.startsWith("drools.evaluator.")) { this.evaluatorRegistry.addEvaluatorDefinition(value); } else if (name.equals("drools.dump.dir")) { buildDumpDirectory(value); } else if (name.equals(DROOLS_PARSER_PROCESS_STRING_ESCAPES)) { setProcessStringEscapes(Boolean.parseBoolean(value)); } }
public String getProperty(String name) { name = name.trim(); if (StringUtils.isEmpty(name)) { return null; } if (name.equals("drools.dialect.default")) { return getDefaultDialect(); } else if (name.startsWith("drools.accumulate.function")) { return this.accumulateFunctions.get(name); } else if (name.startsWith("drools.evaluator.")) { return this.evaluatorRegistry .getEvaluatorDefinition(name.substring(name.lastIndexOf('.'))) .getClass() .getName(); } else if (name.equals("drools.dump.dir")) { return Boolean.toString(this.dumpDirectory != null); } else if (name.equals(DROOLS_PARSER_PROCESS_STRING_ESCAPES)) { return String.valueOf(isProcessStringEscapes()); } return null; }