/**
*
* @param condition
* @param formDef
* @param params
* @param start
* @param rowCount
*
* @return FormRowSet
*
* @throws Exception
*/
public FormRowSet findRecords(String condition, FormDefinition formDef, ArrayList params, Integer start, Integer rowCount) throws Exception {
LogUtil.info(TAG, ">>>>>>> extra conditions : " + condition);
LogUtil.info(TAG, ">>>>>>> Row Limits : Start= " + start + ", Count= " + rowCount);
FormRowSet rowSet = null;
if (params.isEmpty() && (rowCount == null || rowCount == 0)) {
throw new Exception("if parameters are empty, `rows` must be specifed");
}
try {
FormDataDao formDataDao = (FormDataDao) AppUtil.getApplicationContext().getBean("formDataDao");
rowSet = formDataDao.find(formDef.getName(), formDef.getTableName(), condition, params.toArray(), null, null, start, rowCount);
} catch (Exception ex) {
LogUtil.error(TAG, ex, ex.getMessage());
throw ex;
}
FormRowSet records = new FormRowSet();
for (FormRow formRow : rowSet) {
String latestProcessId = null;
try {
latestProcessId = getLatestProcessId(formRow.getId());
} catch (Exception e) {
LogUtil.error(TAG, e, e.getMessage());
}
LogUtil.info(TAG, ">>>>>>> latestProcessId: " + latestProcessId);
formRow.put("latest_processId", latestProcessId);
records.add(formRow);
}
return records;
}