/** * given a test string, parse the string to return a boolean value for Velocity result * * @param session * @param testStr for ex. = "velocityTest='#if($patient.getPatientIdentifier(5))true #else false #end")' >" * @return a boolean value if this patient is a female * @throws org.openmrs.module.htmlformentry.BadFormDesignException * @should return a correct boolean value for logic test string */ protected boolean processVelocityIncludeLogic(FormEntrySession session, String testStr) throws BadFormDesignException { //("#if($patient.getPatientIdentifier(5))true #else false #end")); testStr = "#if (" + testStr + ") true #else false #end"; return session.evaluateVelocityExpression(testStr).trim().equals("true"); }
String value; if (expression != null) value = session.evaluateVelocityExpression("$!{" + expression + "}"); else value = session.evaluateVelocityExpression(complexExpression);
value = session.evaluateVelocityExpression("$!{" + expression + "}");