private PatientSurgicalOperationVoCollection listSurgicalOperations(CareContextRefVo refCareContext, ClinicalContactShortVo voClinicalContactShort, Boolean bRIE) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from PatientSurgicalOperation t "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (voClinicalContactShort != null) { hql.append(andStr + " t.clinicalContact.id =:rcc"); markers.add("rcc"); values.add(voClinicalContactShort.getID_ClinicalContact()); andStr = " and "; } if (refCareContext != null) { hql.append(andStr + " t.careContext.id =:cc"); markers.add("cc"); values.add(refCareContext.getID_CareContext()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List patientProcedures = factory.find(query, markers, values); return PatientSurgicalOperationVoAssembler.createPatientSurgicalOperationVoCollectionFromPatientSurgicalOperation(patientProcedures); }