public CareContextForPatientDocumentVoCollection listCareContext(EpisodeOfCareRefVo episodeOfCare) { if(episodeOfCare == null || !episodeOfCare.getID_EpisodeOfCareIsNotNull()) { throw new CodingRuntimeException("Supplied Episode Of Care is null or doesn't have an id."); } String hql = "from CareContext as cc where cc.episodeOfCare.id = :ep order by cc.startDateTime desc";//WDEV-12385 List<?> list = getDomainFactory().find(hql, "ep", episodeOfCare.getID_EpisodeOfCare()); if (list == null || list.size() == 0) return null; return CareContextForPatientDocumentVoAssembler.createCareContextForPatientDocumentVoCollectionFromCareContext(list); }