public ReferralsRecordingListVoCollection listByCriteria(ReferralsRecordingListVo filter, Date dateFrom, Date dateTo) { DomainFactory factory = getDomainFactory(); IMSCriteria criteria = new IMSCriteria(ReferralsRecording.class, factory); /*if (filter.getSpecialtyFunctionCodeIsNotNull()) { criteria.equal("specialtyFunctionCode.id", filter.getSpecialtyFunctionCode().getID()); }*/ if (filter.getDisciplineIsNotNull()) { criteria.equal("discipline.id", filter.getDiscipline().getID()); } if (filter.getReferralStatusIsNotNull()) { criteria.equal("referralStatus.id", filter.getReferralStatus().getID()); } if (filter.getReferralSourceIsNotNull()) { criteria.equal("referralSource.id", filter.getReferralSource().getID()); } if (filter.getReferralHCPIsNotNull()) { criteria.equal("referralHCP.id", filter.getReferralHCP().getID_MemberOfStaff()); } /*if (dateFrom != null && dateTo != null) { criteria.between("dateSent", dateFrom.getDate(), dateTo.getDate()); }*/ List lst = criteria.find(); return (ReferralsRecordingListVoAssembler.createReferralsRecordingListVoCollectionFromReferralsRecording(lst)).sort(); }