public SupportNetworkProfessionalVoCollection listSupportNetworkProfessionalByPatient(Boolean activeOnly, PatientRefVo patient) { DomainFactory factory = getDomainFactory(); String hql = "select snw.professional from SupportNetwork as snw where snw.patient.id = :idPatient"; if (activeOnly) hql = " select prof from SupportNetwork as snw left join snw.professional as prof where prof.isCurrActiveProfSupp = true and snw.patient.id = :idPatient"; List supportNetworkProf = factory.find(hql, new String[]{"idPatient"}, new Object[]{patient.getID_Patient()}); return SupportNetworkProfessionalVoAssembler.createSupportNetworkProfessionalVoCollectionFromSupportNetworkProfessional(supportNetworkProf).sort(); }
public SupportNetworkProfessionalVoCollection listSupportNetworkProfessionalByCareContext(CareContextRefVo voCareContextRef, Boolean activeOnly) { if (voCareContextRef == null) throw new CodingRuntimeException("Care Context was not supplied. Mandatory argument"); DomainFactory factory = getDomainFactory(); String hqlQuery = " from SupportNetwork snw "; StringBuffer condStr = new StringBuffer(); ArrayList markerNames = new ArrayList(); ArrayList markerValues = new ArrayList(); condStr.append(" where "); if (voCareContextRef != null) { condStr.append(" snw.careContext.id = :careContext"); markerNames.add("careContext"); markerValues.add(voCareContextRef.getID_CareContext()); } hqlQuery += condStr.toString(); java.util.List lst = factory.find(hqlQuery, markerNames, markerValues); // Should be only one / none Support Network in the list for the // CLinical Contact if (lst.size() > 0) { SupportNetwork snw = (SupportNetwork) lst.get(0); if (activeOnly.booleanValue() == false) return SupportNetworkProfessionalVoAssembler.createSupportNetworkProfessionalVoCollectionFromSupportNetworkProfessional(snw.getProfessional()).sort(); else { if (snw != null) { java.util.List lst2 = factory.find(snw.getProfessional(), " where this.isCurrActiveProfSupp = :active", new String[]{"active"}, new Object[]{Boolean.TRUE}); return SupportNetworkProfessionalVoAssembler.createSupportNetworkProfessionalVoCollectionFromSupportNetworkProfessional(lst2); } return null; } } else return null; }