public SupportNetworkServicesVoCollection listSupportNetworkServicesByPatient(Boolean activeOnly, PatientRefVo patient) { DomainFactory factory = getDomainFactory(); String hql = "select snw.services from SupportNetwork as snw where snw.patient.id = :idPatient"; if (activeOnly) hql = "select serv from SupportNetwork as snw left join snw.services as serv where (serv.isCurrentlyActive = true and snw.patient.id = :idPatient)"; List supportNetworkServices = factory.find(hql, new String[]{"idPatient"}, new Object[]{patient.getID_Patient()}); return SupportNetworkServicesVoAssembler.createSupportNetworkServicesVoCollectionFromSupportNetworkServices(supportNetworkServices); }
public SupportNetworkServicesVoCollection listSupportNetworkServiceByCareContext(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 SupportNetworkServicesVoAssembler.createSupportNetworkServicesVoCollectionFromSupportNetworkServices(snw.getServices()).sort(); else { if (snw != null) { java.util.List lst2 = factory.find(snw.getServices(), " where this.isCurrentlyActive = :active", new String[]{"active"}, new Object[]{Boolean.TRUE}); return SupportNetworkServicesVoAssembler.createSupportNetworkServicesVoCollectionFromSupportNetworkServices(lst2); } return null; } } else return null; }