public NurseVo getNurse(HcpRefVo id) { if(id == null) throw new CodingRuntimeException("HCP id must not be null "); DomainFactory factory = getDomainFactory(); String hql = "from Nurse as n1_1 where n1_1.id = :idHCP"; List list = factory.find(hql, new String[] {"idHCP"}, new Object[] {id.getID_Hcp()}); if(list != null && list.size() > 0) { NurseVoCollection voColl = NurseVoAssembler.createNurseVoCollectionFromNurse(list); if(voColl != null && voColl.size() > 0) return voColl.get(0); } return null; }
public MemberOfStaffVo getMemberOfStaffByTaxonomyType(String extId, TaxonomyType taxonomyType) { MemberOfStaff domMos = getDomMosByTaxonomyType(extId, taxonomyType); if (domMos == null) return null; MemberOfStaffVo mosVo = MemberOfStaffVoAssembler.create(domMos); ims.core.vo.Hcp hcp = null; if (domMos.getHcp() instanceof Medic) { hcp = MedicVoAssembler.create((Medic)domMos.getHcp()); } else if (domMos.getHcp() instanceof Nurse) { hcp = NurseVoAssembler.create((Nurse)domMos.getHcp()); } else if (domMos.getHcp() instanceof Therapist) { hcp = TherapistVoAssembler.create((Therapist)domMos.getHcp()); } mosVo.setHcp(hcp); return mosVo; }
public Hcp getHCP(HcpRefVo hcpRefVo) { DomainFactory factory = getDomainFactory(); ims.core.resource.people.domain.objects.Hcp doHcp = (ims.core.resource.people.domain.objects.Hcp) factory.getDomainObject(ims.core.resource.people.domain.objects.Hcp.class, hcpRefVo.getID_Hcp()); if (Medic.class.isAssignableFrom(doHcp.getClass())) return MedicVoAssembler.create((Medic) doHcp); else if (doHcp instanceof Therapist) return TherapistVoAssembler.create((Therapist)doHcp); else if (doHcp instanceof Nurse) return NurseVoAssembler.create((Nurse) doHcp); return HcpAssembler.create(doHcp); }
private IMos[] listByDiscipline(List hcps, String name, HcpDisType mosDiscipline) { List<IMos> hcpList = new ArrayList<IMos>(); if(hcps != null) { for(int i=0;i<hcps.size();i++) { Hcp hcp = (Hcp) hcps.get(i); if (Medic.class.isAssignableFrom(hcp.getClass())) hcpList.add(MedicVoAssembler.create((Medic)hcp)); else if (Therapist.class.isAssignableFrom(hcp.getClass())) hcpList.add(TherapistVoAssembler.create((Therapist)hcps.get(i))); else if (Nurse.class.isAssignableFrom(hcp.getClass())) hcpList.add(NurseVoAssembler.create((Nurse)hcps.get(i))); else hcpList.add(HcpAssembler.create((Hcp)hcps.get(i))); } } Collections.sort(hcpList, new HcpAdminComparator(SortOrder.ASCENDING)); IMos[] iMosArray = new IMos[hcpList.size()]; for(int i=0; i < hcpList.size(); i++) iMosArray[i] = hcpList.get(i); return iMosArray; }
private HcpCollection listHCPs(HcpFilter filter, String subClass) { List hcps = listHCPList(filter,subClass,-1); //WDEV-11656 //iterate through domainlist and use each subclasses respective assembler to convert and add to voCollHcps //Using arraylist so can sort it locally. Not sort won't work as collection is mixed type. ArrayList hcpList = new ArrayList(); if(hcps != null) { for(int i=0;i<hcps.size();i++) { Hcp hcp = (Hcp) hcps.get(i); if (Medic.class.isAssignableFrom(hcp.getClass())){ hcpList.add(MedicVoAssembler.create((Medic)hcp)); } else if (Therapist.class.isAssignableFrom(hcp.getClass())) hcpList.add(TherapistVoAssembler.create((Therapist)hcps.get(i))); else if (Nurse.class.isAssignableFrom(hcp.getClass())) hcpList.add(NurseVoAssembler.create((Nurse)hcps.get(i))); else hcpList.add(HcpAssembler.create((Hcp)hcps.get(i))); } } Collections.sort(hcpList, new HcpAdminComparator(SortOrder.ASCENDING)); HcpCollection voCollHcps = new HcpCollection(); for(int i=0; i < hcpList.size(); i++) { voCollHcps.add((ims.core.vo.Hcp)hcpList.get(i)); } return voCollHcps; }
/** * Creates a new HCP or updates if it already exists */ public ims.core.vo.Hcp saveHCP(ims.core.vo.Hcp hcp) throws StaleObjectException { if (!hcp.isValidated()) { throw new DomainRuntimeException("HCP VO has not been validated."); } DomainFactory factory = getDomainFactory(); hcp.getName().setUppers(); Hcp doHcp = null; if (hcp instanceof MedicVo) { doHcp = MedicVoAssembler.extractMedic(factory, (MedicVo)hcp); } else if (hcp instanceof TherapistVo) { doHcp = TherapistVoAssembler.extractTherapist(factory, (TherapistVo)hcp); } else if (hcp instanceof NurseVo) { doHcp = NurseVoAssembler.extractNurse(factory, (NurseVo)hcp); } else { doHcp = HcpAssembler.extractHcp(factory, hcp); } factory.save(doHcp); hcp.setID_Hcp(doHcp.getId()); return hcp; }
public ims.core.vo.Hcp getHcpByExternalCode(TaxonomyType taxType, String codeVal) { if (codeVal == null) return null; List hcpList = getDomHcpByExternalCode(taxType, codeVal); if (hcpList != null && hcpList.size() > 0) { Hcp hcp = (Hcp)hcpList.get(0); if (hcp instanceof Medic) { return MedicVoAssembler.create((Medic)hcp); } else if (hcp instanceof Therapist) { return TherapistVoAssembler.create((Therapist)hcp); } else if (hcp instanceof Nurse) { return NurseVoAssembler.create((Nurse)hcp); } else { return HcpAssembler.create((Hcp)hcpList.get(0)); } } return null; }
public ims.core.vo.Hcp getHcp(HcpFilter filter) { DomainFactory factory = getDomainFactory(); Hcp doHcp = (Hcp) factory.getDomainObject(Hcp.class, filter.getID_Hcp()); if (Medic.class.isAssignableFrom(doHcp.getClass())) return MedicVoAssembler.create((Medic) doHcp); else if (doHcp instanceof Therapist) return TherapistVoAssembler.create((Therapist)doHcp); else if (doHcp instanceof Nurse) return NurseVoAssembler.create((Nurse) doHcp); return HcpAssembler.create(doHcp); }
public ims.core.vo.Hcp saveHcp(ims.core.vo.Hcp hcp) throws ims.domain.exceptions.StaleObjectException { if (!hcp.isValidated()) { throw new DomainRuntimeException("HCP VO has not been validated."); } DomainFactory factory = getDomainFactory(); hcp.getName().setUppers(); Hcp doHcp = null; if (hcp instanceof MedicVo) { doHcp = MedicVoAssembler.extractMedic(factory, (MedicVo) hcp); } else if (hcp instanceof TherapistVo) { doHcp = TherapistVoAssembler.extractTherapist(factory, (TherapistVo) hcp); } else if (hcp instanceof NurseVo) { doHcp = NurseVoAssembler.extractNurse(factory, (NurseVo) hcp); } else { doHcp = HcpAssembler.extractHcp(factory, hcp); } factory.save(doHcp); hcp.setID_Hcp(doHcp.getId()); return hcp; }
public ims.core.vo.Hcp getHCP(ims.core.resource.people.vo.HcpRefVo hcpRefVo) { DomainFactory factory = getDomainFactory(); Hcp doHcp = (Hcp) factory.getDomainObject(Hcp.class, hcpRefVo.getID_Hcp()); if (Medic.class.isAssignableFrom(doHcp.getClass())) return MedicVoAssembler.create((Medic) doHcp); else if (doHcp instanceof Therapist) return TherapistVoAssembler.create((Therapist)doHcp); else if (doHcp instanceof Nurse) return NurseVoAssembler.create((Nurse) doHcp); return HcpAssembler.create(doHcp); }