public CarePlanEvaluationNoteListVoCollection listEvaluationNotesForActiveCarePlansByDateRange(CareContextRefVo voCareContext, Date dateFrom, Date dateTo, Boolean activeOnly) { if(voCareContext == null || voCareContext.getID_CareContext() == null || dateFrom == null || dateTo == null) throw new CodingRuntimeException("Mandatory parameters are null in method listEvaluationNotesForActiveCarePlans"); String hql = "from CarePlanEvaluationNote note where note.carePlan.careContext.id = :idCareContext and note.carePlan.isRIE is null and note.carePlan.currentCarePlanStatus.status = :activeStatus and (note.recordedDateTime between :dateFrom and :dateTo) "; if(activeOnly == true) hql += "and note.active = true"; DomainFactory factory = getDomainFactory(); return CarePlanEvaluationNoteListVoAssembler.createCarePlanEvaluationNoteListVoCollectionFromCarePlanEvaluationNote(factory.find(hql, new String[]{"idCareContext", "activeStatus", "dateFrom", "dateTo"}, new Object[]{voCareContext.getID_CareContext(), getDomLookup(CarePlanStatus.ACTIVE), dateFrom.getDate(), dateTo.copy().addDay(1).getDate()})).sort(); }