public StrengtheningProgramVo getStrengthProgByClinicalContact(ClinicalContactRefVo voClinicalContactRefVo) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from StrengtheningProgram sp "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (voClinicalContactRefVo != null) { hql.append(andStr + " sp.clinicalContact.id = :id_ClinicalContact"); markers.add("id_ClinicalContact"); values.add(voClinicalContactRefVo.getID_ClinicalContact()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List skills = factory.find(query, markers, values); StrengtheningProgramVoCollection collStrengtheningProgramVo = StrengtheningProgramVoAssembler.createStrengtheningProgramVoCollectionFromStrengtheningProgram(skills); if(collStrengtheningProgramVo != null && collStrengtheningProgramVo.size() > 0) return collStrengtheningProgramVo.get(0); return null; }