public MosOrgLocVoCollection listOrganisationsForMos(MemberOfStaffRefVo mos) { DomainFactory factory = getDomainFactory(); if (mos.getID_MemberOfStaff() == null) { return new MosOrgLocVoCollection(); } MemberOfStaff mosBo = (MemberOfStaff)factory.getDomainObject(MemberOfStaff.class, mos.getID_MemberOfStaff()); factory.refresh(mosBo); if (mosBo == null) { return new MosOrgLocVoCollection(); } Set hcpLocations = mosBo.getLocations(); return this.listOrganisationsForLocations(hcpLocations); }
/** * @param voCollMosOrgLoc * @param newNode */ private void showOrgForMos(MosOrgLocVoCollection voCollMosOrgLoc, TreeNode mosNode) { mosNode.getNodes().clear(); for (int i = 0; i < voCollMosOrgLoc.size(); i++) { MosOrgLocVo vo = voCollMosOrgLoc.get(i); TreeNode orgNode = mosNode.getNodes().add(vo.getOrganisation(), vo.getOrganisation().getName()); orgNode.setCollapsedImage(form.getImages().Admin.Organisation); HCPLocationLiteVo.mixedSort(vo.getHCPLocations()); for (int j = 0; j < vo.getHCPLocations().size(); j++) { HCPLocationLiteVo locVo = vo.getHCPLocations().get(j); StringBuffer sb = new StringBuffer(); sb.append(locVo.getLocation().getName()); sb.append(locVo.getAccreditationStatusIsNotNull() ? " ," + locVo.getAccreditationStatus().toString() : ""); TreeNode locNode = orgNode.getNodes().add(locVo, sb.toString()); if (j == 0) locNode.setExpanded(true); if (locVo.getLocation() instanceof LocSiteVo || locVo.getLocation() instanceof LocSiteShortVo) { locNode.setCollapsedImage(form.getImages().Admin.LocationSite); locNode.setExpandedImage(form.getImages().Admin.LocationSite); } else { locNode.setCollapsedImage(form.getImages().Admin.Location); locNode.setExpandedImage(form.getImages().Admin.Location); } } } }
protected void onFormDialogClosed(FormName formName, DialogResult result) throws PresentationLogicException { if (formName.equals(form.getForms().Admin.HcpAdmin) && result.equals(DialogResult.OK)) { fillNameDetails(form.getGlobalContext().getMosFullName()); displayHCPDetails(form.getGlobalContext().getHcp()); changeHcpDetails(); } else if (formName.equals(form.getForms().Admin.HcpAdmin) && result.equals(DialogResult.CANCEL)) { if (form.getGlobalContext().getMosFormMode() != null && form.getGlobalContext().getMosFormMode().equals(FormMode.EDIT)) { if (form.getGlobalContext().getHcpIsNotNull() && form.getGlobalContext().getHcp().getID_Hcp() == null) { // The dialog was creating a new hcp and was cancelled. form.cmbHcpDiciplineDetails().setValue(null); form.imbHCPDlg().setVisible(false); form.getGlobalContext().setHcp(null); form.getGlobalContext().setMosFullName(null); } } } else if (formName.equals(form.getForms().Admin.MosOrganisationDlg) && result.equals(DialogResult.OK) || formName.equals(form.getForms().Admin.MOSHospitalAccreditationDialog) && result.equals(DialogResult.OK)) { // Might be returning from ImageButton within mos edit, so don't save locations yet. if (form.getMode().equals(FormMode.EDIT)) { // form.getGlobalContext().Admin.getSelectedMos().setLocations(); return; } MemberOfStaffVo mosFull = form.getGlobalContext().Admin.getSelectedMos(); if (save(mosFull)) { MosOrgLocVoCollection voCollMosOrgLoc = domain.listOrganisationsForMos(form.getGlobalContext().Admin.getSelectedMos()); // Refresh value in selected node TreeNode selectedNode = form.lyrLHS().tabMos().treMemberOfStaff().getSelectedNode(); MemberOfStaffShortVo mosShort = form.getGlobalContext().Admin.getSelectedMos(); selectedNode.setValue(mosShort); showOrgForMos(voCollMosOrgLoc, selectedNode); selectionChanged(selectedNode); //WDEV-16222 } } }
private void showOrgForMos(TreeNode mosNode) { MemberOfStaffShortVo mos = (MemberOfStaffShortVo) mosNode.getValue(); MosOrgLocVoCollection voCollMosOrgLoc = domain.listOrganisationsForMos(mos); showOrgForMos(voCollMosOrgLoc, mosNode); }
protected void onFormDialogClosed(FormName formName, DialogResult result) throws PresentationLogicException { if (formName.equals(form.getForms().Admin.HcpAdmin) && result.equals(DialogResult.OK)) { form.getLocalContext().setHcp(form.getGlobalContext().getHcp());//WDEV-21029 fillNameDetails(form.getGlobalContext().getMosFullName()); displayHCPDetails(form.getGlobalContext().getHcp()); changeHcpDetails(); } else if (formName.equals(form.getForms().Admin.HcpAdmin) && result.equals(DialogResult.CANCEL)) { if (form.getGlobalContext().getMosFormMode() != null && form.getGlobalContext().getMosFormMode().equals(FormMode.EDIT)) { //WDEV-21029 if(form.getLocalContext().getHcpIsNotNull() && !form.getLocalContext().getHcp().getID_HcpIsNotNull()) { Hcp hcpType = form.getLocalContext().getHcp(); Boolean isOtherDiscipline = !(hcpType instanceof MedicVo || hcpType instanceof NurseVo || hcpType instanceof TherapistVo); form.cmbHcpDiciplineDetails().setValue(isOtherDiscipline ? HcpDisType.OTHER : hcpType.getHcpType()); form.getGlobalContext().setHcp(hcpType); } else if (form.getGlobalContext().getHcpIsNotNull() && form.getGlobalContext().getHcp().getID_Hcp() == null) { // The dialog was creating a new hcp and was cancelled. form.cmbHcpDiciplineDetails().setValue(null); form.imbHCPDlg().setVisible(false); form.getGlobalContext().setHcp(null); form.getGlobalContext().setMosFullName(null); } } } else if (formName.equals(form.getForms().Admin.MosOrganisationDlg) && result.equals(DialogResult.OK) || formName.equals(form.getForms().Admin.MOSHospitalAccreditationDialog) && result.equals(DialogResult.OK)) { // Might be returning from ImageButton within mos edit, so don't save locations yet. if (form.getMode().equals(FormMode.EDIT)) { // form.getGlobalContext().Admin.getSelectedMos().setLocations(); return; } MemberOfStaffVo mosFull = form.getGlobalContext().Admin.getSelectedMos(); if (save(mosFull)) { MosOrgLocVoCollection voCollMosOrgLoc = domain.listOrganisationsForMos(form.getGlobalContext().Admin.getSelectedMos()); // Refresh value in selected node TreeNode selectedNode = form.lyrLHS().tabMos().treMemberOfStaff().getSelectedNode(); MemberOfStaffShortVo mosShort = form.getGlobalContext().Admin.getSelectedMos(); selectedNode.setValue(mosShort); showOrgForMos(voCollMosOrgLoc, selectedNode); selectionChanged(selectedNode); //WDEV-16222 } } }