/** * method will strip out the when, then, * at the beginning of each line and the mapped drl * expression * * @param text * @return */ protected String stripHeadingAndCode(String text) { if (text.startsWith(DSLMappingEntry.CONDITION.getSymbol())) { return text.substring(DSLMappingEntry.CONDITION.getSymbol().length() + 2, text.indexOf("=")); } else if (text.startsWith(DSLMappingEntry.CONSEQUENCE.getSymbol())) { return text.substring( DSLMappingEntry.CONSEQUENCE.getSymbol().length() + 2, text.indexOf("=")); } else if (text.startsWith(DSLMappingEntry.ANY.getSymbol())) { return text.substring(DSLMappingEntry.ANY.getSymbol().length() + 2, text.indexOf("=")); } else if (text.startsWith("#")) { return ""; } else { return text; } }
protected Section getSection(String text) { if (text.startsWith(DSLMappingEntry.CONDITION.getSymbol())) { return DSLMappingEntry.CONDITION; } else if (text.startsWith(DSLMappingEntry.CONSEQUENCE.getSymbol())) { return DSLMappingEntry.CONSEQUENCE; } else if (text.startsWith(DSLMappingEntry.ANY.getSymbol())) { return DSLMappingEntry.ANY; } else if (text.startsWith(DSLMappingEntry.KEYWORD.getSymbol())) { return DSLMappingEntry.KEYWORD; } return null; }