public EnvironmentalVisitShortVoCollection getEnvironmentalVisitByCareContext(CareContextRefVo voCareContextRefVo) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from EnvironmentalVisit ev "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (voCareContextRefVo != null) { hql.append(andStr + " ev.careContext.id = :id_CareContext"); markers.add("id_CareContext"); values.add(voCareContextRefVo.getID_CareContext()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List visit = factory.find(query, markers, values); EnvironmentalVisitShortVoCollection collEnvironmentalVisitShortVo = EnvironmentalVisitShortVoAssembler.createEnvironmentalVisitShortVoCollectionFromEnvironmentalVisit(visit); if(collEnvironmentalVisitShortVo != null) return collEnvironmentalVisitShortVo.sort(); return null; }