List list = null;
long count = 0;
Sort sort = extractSort(panel, form, new Sort(JobListDAO.SORT_DUEDATE, true));
Page page = new Page(conf.getIntValue(UserConfiguration.Key.LIST_NUMBER_ROWS), form.getPage());
String paramSubject = form.getSubject();
boolean paramAssignedUser = form.isAssignedUser();
JobVO.Status[] paramStatus = new JobVO.Status[] {JobVO.Status.IN_PROGRESS, JobVO.Status.PLANNED};
if(form.getStatus() != null) {
paramStatus = new JobVO.Status[]{EnumUtility.valueOf(JobVO.Status.class, form.getStatus())};
}
JobVO.Priority paramPriority = EnumUtility.valueOf(JobVO.Priority.class, form.getPriority());
Date paramDateStart = null;
Date paramDateEnd = null;
SimpleDateFormat sdf = new SimpleDateFormat(MessageUtil.message(request, "default.format.input.date"));
try
{
if (form.getDateStart() != null)
paramDateStart = sdf.parse(form.getDateStart());
if (form.getDateEnd() != null)
paramDateEnd = DateUtility.getEndOfDay(sdf.parse(form.getDateEnd()));
}
catch (ParseException e)
{
log.error("bad form validation", e);
}
JobListDAO dao = new JobListDAO();
count = dao.countList(null, null, null, paramSubject, paramStatus, paramPriority, paramDateStart, paramDateEnd, paramAssignedUser, user, null);
if (count < page.getFirstEntry())
page.setPage(1);
if (count > 0) {
list = dao.getList(null, null, null, paramSubject, paramStatus, paramPriority, paramDateStart, paramDateEnd, paramAssignedUser, user, sort, page, null);
} else {
list = new ArrayList();