public DischargedEpisodeForVTERiskAssessmentWorklistVo getDischargeEpisode(PASEventRefVo pasEvent) { if(pasEvent == null ) throw new CodingRuntimeException("Pas Event not provided"); DomainFactory factory = getDomainFactory(); List<?> dis = factory.find("select dis from DischargedEpisode as dis left join dis.pasEvent as pas where pas.id =:idPasEvent", new String[] {"idPasEvent"}, new Object[] {pasEvent.getID_PASEvent()}); if( dis != null && dis.size() > 0) { DischargedEpisodeForVTERiskAssessmentWorklistVoCollection tempColl = DischargedEpisodeForVTERiskAssessmentWorklistVoAssembler.createDischargedEpisodeForVTERiskAssessmentWorklistVoCollectionFromDischargedEpisode(dis).sort(SortOrder.DESCENDING); if(tempColl != null && tempColl.size() > 0) return tempColl.get(0); } return null; }