public MassageShortVoCollection listMassageByCareContext(CareContextRefVo voCareContextRef) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from Massage m "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (voCareContextRef != null) { hql.append(andStr + " m.clinicalContact.careContext.id = :id_CareContext"); markers.add("id_CareContext"); values.add(voCareContextRef.getID_CareContext()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List massage = factory.find(query, markers, values); MassageShortVoCollection collMassageShortVo = MassageShortVoAssembler.createMassageShortVoCollectionFromMassage(massage); if(collMassageShortVo != null) return collMassageShortVo; return null; }