Use the RuleHelper whenever you can, it saves you a lot of work!
eg.:
public static boolean isCodeInList(java.lang.String sList, java.lang.String sCode)
Method checks if a token belongs to a comma-separated list. If the list is empty it has the special meaning of "contains everything".
Parameters:
sList - the comma-separated list
sCode - the token
Returns:
true / false
sample code:
String paramTCodes = "WRK, TRN, MEAL"; // I would get it from a param field or so..
if (RuleHelper.isCodeInList(paramTCodes, WorkDetailData
// do your thing...
}
**********
If the rule requires parameters you need as for the time codes, remember to return the parameter list insted of new ArrayList(); Doh! Yes I did that this morning... ops..
public List getParameterInfo(DBConnection dBConnection) {
List parametersList = new ArrayList();
RuleParameterInfo rpiEligibleTimeCodes = new RuleParameterInfo(WORK_TIME_CODES, RuleParameterInfo.STRING_TYPE, false);
parametersList.add(rpiEligibleTimeCodes);
RuleParameterInfo rpiEligibleHourTypes = new RuleParameterInfo(HOLIDAY_HOUR_TIME_CODE, RuleParameterInfo.STRING_TYPE, false);
parametersList.add(rpiEligibleHourTypes);
return new ArrayList(); // <- OPS!!! should of returned the parametersList
}
No comments:
Post a Comment