private String getGpListMessage(OrganisationWithSitesVo voOrgWithSites, ForeignKeyViolationException excp) { StringBuffer message = new StringBuffer(); String[] gps = domain.listGps(voOrgWithSites); if(gps != null && gps.length > 0) { message.append("Cannot delete '" + voOrgWithSites.getName() + "' as it is currently associated with"); message.append(" the following GPs:"); for (int i = 0; i < gps.length; i++) { message.append(System.getProperty("line.separator")); message.append(gps[i]); } } else { message.append(excp.getMessage()); } return message.toString(); }
private boolean practiceAdded(OrganisationWithSitesVo practice) { //Don't add null value if(practice == null) return true; for (int i = 0; i < form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().size(); i++) { Object objVal = form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().get(i).getValue() ; if(objVal instanceof GpToPracticesVo) { if(practice.equals(((GpToPracticesVo)objVal).getPractice())) { return true; } } } return false; }
private DynamicGridRow getPracticeRow(OrganisationWithSitesVo practice) { //Don't add null value if(practice == null) return null; for (int i = 0; i < form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().size(); i++) { Object objVal = form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().get(i).getValue() ; if(objVal instanceof GpToPracticesVo) { if(practice.equals(((GpToPracticesVo)objVal).getPractice())) { return form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getRows().get(i); } } } return null; }
private void onGridSearchSelectionChanged() { enableContextMenu(); Object val = form.grdSearch().getValue(); clearPracticeAndSurgeryLocalContext(); if(val != null) { if(val instanceof OrganisationWithSitesVo) { setSelectedPractice((OrganisationWithSitesVo) val); } else if(val instanceof LocSiteVo) { setSelectedSurgery((LocSiteVo) val); } setActionAndFireEvent(PracticeSearch.SELECT); } }
public OrganisationWithSitesVo getParentPractice() { LocSiteVo voLocSiteVo = getSelectedSurgery(); if(voLocSiteVo != null) { for (int i = 0; i < form.grdSearch().getRows().size(); i++) { if(form.grdSearch().getRows().get(i).getValue() instanceof OrganisationWithSitesVo) { OrganisationWithSitesVo organisationWithSitesVo = (OrganisationWithSitesVo)form.grdSearch().getRows().get(i).getValue(); if(organisationWithSitesVo.getLocationSites().indexOf(voLocSiteVo) >= 0) return organisationWithSitesVo; } } } return null; }
public Boolean removePracticeFromGrid(OrganisationWithSitesVo voOrganisationWithSites) { if(voOrganisationWithSites == null) return Boolean.FALSE; for (int i = 0; i < form.grdSearch().getRows().size(); i++) { if(voOrganisationWithSites.equals(form.grdSearch().getRows().get(i).getValue())) { form.grdSearch().getRows().remove(i); setSelectedSurgery(null); setSelectedPractice(null); enableContextMenu(); setActionAndFireEvent(PracticeSearch.PRACTICEREMOVED); return Boolean.TRUE; } } return Boolean.FALSE; }
public OrganisationWithSitesVo getNewPracticeBasedOnSearchCriteria() { OrganisationWithSitesVo voOrganisation = new OrganisationWithSitesVo(); voOrganisation.setName(form.txtName().getValue()); voOrganisation.setIsActive(Boolean.TRUE); voOrganisation.setAddress(new PersonAddress()); voOrganisation.getAddress().setLine1(form.txtAddress().getValue()); TaxonomyType taxonomyType = form.cmbType().getValue(); if(taxonomyType != null) { TaxonomyMap taxonomyMap = new TaxonomyMap(); taxonomyMap.setTaxonomyName(taxonomyType); taxonomyMap.setTaxonomyCode(form.txtCode().getValue()); voOrganisation.setCodeMappings(new TaxonomyMapCollection()); voOrganisation.getCodeMappings().add(taxonomyMap); } return voOrganisation; }
private String getPracticeCodeBasedOnCodeMappings(OrganisationWithSitesVo gpPractice, TaxonomyType taxonomyType) { if (gpPractice==null) return null; TaxonomyMapCollection collCodeMappings = gpPractice.getCodeMappings(); for (int i=0; collCodeMappings!=null && i<collCodeMappings.size();i++) { if (collCodeMappings.get(i)!=null && taxonomyType.equals(collCodeMappings.get(i).getTaxonomyName())) { return collCodeMappings.get(i).getTaxonomyCode(); } } return null; }
private boolean containsSurgeryForGp(OrganisationWithSitesVo practice, String gMCCode) { if(practice != null &&practice.getLocationSitesIsNotNull()&&practice.getLocationSites().size()>0) { for (LocSiteVo surgery : practice.getLocationSites()) { if(surgery.getIsActiveIsNotNull() && surgery.getIsActive().equals(Boolean.TRUE)&& surgery.getPasCode()!=null&& gMCCode!=null&& gMCCode.trim()!=null&& surgery.getPasCode().toUpperCase().matches("\\S+_"+gMCCode.trim().toUpperCase()+"_\\S+")) //http://jira/browse/WDEV-15535 changed filter from PAS to GMC { return true; } } } return false; }
private void displayGp() { clearScreen(); if (form.getGlobalContext().Core.getGPDetails() == null) return; if (form.getGlobalContext().Core.getGPDetails().getNameIsNotNull()) { form.txtGPName().setValue(form.getGlobalContext().Core.getGPDetails().getName().toString()); } // WDEV-15527 if (!ConfigFlag.DOM.GP_USE_SURGERIES.getValue()) { if (form.getGlobalContext().Core.getGPPracticeWithCommIsNotNull()) //WDEV-16051 { OrganisationWithSitesVo practice = form.getGlobalContext().Core.getGPPracticeWithComm(); displayPracticeAddress(practice); } form.lblSurgeryName().setValue("Practice Name:"); form.lblAddress().setValue("Practice Address:"); } else if (form.getGlobalContext().Core.getGPSurgeryIsNotNull()) { // WDEV-15527 displaySurgeryAddress(); form.lblAddress().setValue("Surgery Name:"); form.lblAddress().setValue("Surgery Address:"); } }
private void displayPracticeAddress(OrganisationWithSitesVo practice) { if (practice!=null) //WDEV-16051 { form.txtViewingAddress().setValue(practice.getName()); PersonAddress address = practice.getAddress(); if (address != null) { form.txtAddr1().setValue(address.getLine1()); form.txtAddr2().setValue(address.getLine2()); form.txtAddr3().setValue(address.getLine3()); form.txtAddr4().setValue(address.getLine4()); form.txtAddr5().setValue(address.getLine5()); if (ConfigFlag.UI.DEMOGRAPHICS_TYPE.getValue().equals("IRISH") && address.getCounty() != null) { form.txtCounty().setValue(address.getCounty().getText()); } else { form.txtCounty().setValue(address.getPostCode()); } } //WDEV-16041 setPracticePhoneAndFax(practice); } }
private void setPracticePhoneAndFax(OrganisationWithSitesVo practice) { if (practice.getCommChannelsIsNotNull()) //WDEV-16051 { GpShortVo gp = form.getGlobalContext().Core.getGPDetails(); // WORK PHONE CommChannelVo gpWorkPhone = gp.getCommChannels().getCommunicationChannel(ChannelType.WORK_PHONE); CommChannelVo practiceWorkPhone = practice.getCommChannels().getCommunicationChannel(ChannelType.WORK_PHONE); if (gpWorkPhone != null && gpWorkPhone.getCommValueIsNotNull()) { form.txtPhone().setValue(gpWorkPhone.toString()); form.lblPhone().setValue("GP Phone:"); } else if (practiceWorkPhone != null && practiceWorkPhone.getCommValueIsNotNull()) { form.txtPhone().setValue(practiceWorkPhone.toString()); form.lblPhone().setValue("Practice Phone:"); } else form.lblPhone().setValue("Practice Phone:"); // FAX NUMBER CommChannelVo gpFax = gp.getCommChannels().getCommunicationChannel(ChannelType.FAX); CommChannelVo practiceFax = practice.getCommChannels().getCommunicationChannel(ChannelType.FAX); if (gpFax != null && gpFax.getCommValueIsNotNull()) { form.txtFax().setValue(gpFax.toString()); form.lblFax().setValue("GP Fax:"); } else if (practiceFax != null && practiceFax.getCommValueIsNotNull()) { form.txtFax().setValue(practiceFax.toString()); form.lblFax().setValue("Practice Fax:"); } else form.lblFax().setValue("Practice Fax:"); } }
public OrganisationWithSitesVo getGPPractice(OrganisationRefVo organisationRef) { if(organisationRef == null) throw new CodingRuntimeException("Cannot get Organisation on null Id."); return OrganisationWithSitesVoAssembler.create((Organisation) getDomainFactory().getDomainObject(Organisation.class, organisationRef.getID_Organisation())); }
protected void onFormOpen(Object[] args) throws PresentationLogicException { initialize(); if (isPracticeAdminDialog()) { OrganisationWithSitesVo voOrgWithSites = form.getGlobalContext().Admin.getPractice(); if(voOrgWithSites != null) { if(voOrgWithSites.getID_OrganisationIsNotNull()) { form.customControlPracticeAdmin().addPractice(voOrgWithSites); form.customControlPracticeAdmin().setValue(voOrgWithSites); editPractice(); } else { form.ctnDetails().txtDetailsName().setValue(voOrgWithSites.getNameIsNotNull() ? voOrgWithSites.getName() : ""); populateAddress(voOrgWithSites.getAddressIsNotNull() ? voOrgWithSites.getAddress() : null); if (voOrgWithSites.getCodeMappingsIsNotNull()) if (voOrgWithSites.getCodeMappings().size() > 0) populateOrgMappingsGrid(voOrgWithSites.getCodeMappings()); form.getGlobalContext().Admin.setPractice(null); //this was only set to hold search criteria. now needs to be cleared. newInstance(); newPractice(); } } } else { open(); } }
private boolean removePractice() { OrganisationWithSitesVo voOrgWithSites = form.customControlPracticeAdmin().getSelectedPractice(); if(voOrgWithSites == null) return false; try { OrganisationVo voOrgganisation = domain.getOrg(voOrgWithSites); if(canUseSurgery()) { //WDEV-12000 if !null if(voOrgganisation!=null) domain.deletePractice(voOrgganisation); } else { //Delete the Surgery first, then the Practice //WDEV-12000 if !null if(voOrgganisation!=null) domain.deletePractice(voOrgganisation, Boolean.TRUE); } form.getLocalContext().setSurgery(null); setPracticeToContext(null); form.customControlPracticeAdmin().removePracticeFromGrid(voOrgWithSites); open(); } catch (ForeignKeyViolationException excp) { engine.showMessage(getGpListMessage(voOrgWithSites, excp)); return false; } return true; }
private void updateControlsState() { if (form.getMode().equals(FormMode.EDIT)) { form.setcustomControlGpSearchEnabled(false); form.customControlGpSearch().setVisibleContextMenu(Boolean.FALSE); form.getContextMenus().getGPAdminContactsADDItem().setVisible(true); form.getContextMenus().getGPAdminContactsREMOVEItem().setVisible(form.ctnGPDetails().lyrGPDetails().tabGPDetails().grdContacts().getSelectedRowIndex() >= 0); form.getContextMenus().getGPAdminMappingsADDItem().setVisible(true); form.getContextMenus().getGPAdminMappingsREMOVEItem().setVisible(form.ctnGPDetails().lyrGPDetails().tabGPDetails().grdMappings().getSelectedRowIndex() >= 0); form.getContextMenus().getGpPracticeGridSearchAddPracticeItem().setVisible(true); form.getContextMenus().getGpPracticeGridRemovePracticeItem().setVisible((form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getValue() instanceof GpToPracticesVo || form.ctnGPDetails().lyrGPDetails().tabPractices().dyngrdPractices().getValue() instanceof OrganisationWithSitesVo)); form.btnClose().setEnabled(false); form.ctnGPDetails().setCollapsed(false); form.ctnGPDetails().lyrGPDetails().tabGPDetails().cmbGPStatus().setEnabled(!engine.getFormName().equals(form.getForms().Admin.GPAdminDialog) || (engine.getFormName().equals(form.getForms().Admin.GPAdminDialog)) && (form.lnkBack().isVisible())); } else { form.setcustomControlGpSearchEnabled(true); form.customControlGpSearch().setVisibleContextMenu(Boolean.TRUE); form.btnEdit().setVisible(form.customControlGpSearch().getValue() != null); form.getContextMenus().getGPAdminContactsADDItem().setVisible(false); form.getContextMenus().getGPAdminContactsREMOVEItem().setVisible(false); form.getContextMenus().getGPAdminMappingsADDItem().setVisible(false); form.getContextMenus().getGPAdminMappingsREMOVEItem().setVisible(false); form.getContextMenus().getGpPracticeGridSearchAddPracticeItem().setVisible(false); form.getContextMenus().getGpPracticeGridRemovePracticeItem().setVisible(false); form.ctnGPDetails().setCollapsed(!(form.customControlGpSearch().getValue() != null)); form.btnClose().setEnabled(true); } }
private void enableContextMenu() { boolean canBeVisible = getCanMakeVisibleContextMenu() && form.getMode().equals(FormMode.VIEW); boolean orgRecordSelected = form.grdSearch().getSelectedRowIndex() >= 0 && form.grdSearch().getValue() instanceof OrganisationWithSitesVo; boolean locSiteRecordSelected = form.grdSearch().getSelectedRowIndex() >= 0 && form.grdSearch().getValue() instanceof LocSiteVo; boolean canMakeRemovePracticeVisible = canBeVisible && orgRecordSelected && isRemoveContextMenuVisible(); boolean canMakeSurgeryVisible = canBeVisible /*&& ConfigFlag.DOM.GP_USE_SURGERIES.getValue()*/ && !isSurgeryContextMenuInvisible(); form.getContextMenus().getPracticeAdminNewPracticeItem().setVisible(canBeVisible); form.getContextMenus().getPracticeAdminEditPracticeItem().setVisible(canBeVisible && orgRecordSelected); form.getContextMenus().getPracticeAdminRemovePracticeItem().setVisible(canMakeRemovePracticeVisible); form.getContextMenus().getPracticeAdminNewSurgeryItem().setVisible(canMakeSurgeryVisible && orgRecordSelected); form.getContextMenus().getPracticeAdminEditSurgeryItem().setVisible(canMakeSurgeryVisible && locSiteRecordSelected); form.getContextMenus().getPracticeAdminRemoveSurgeryItem().setVisible(canMakeSurgeryVisible && locSiteRecordSelected); }
private void populateGridFromData(OrganisationWithSitesVoCollection voCollPractices) { form.grdSearch().getRows().clear(); if(voCollPractices == null) return; for (int i = 0; i < voCollPractices.size(); i++) { OrganisationWithSitesVo organisationWithSitesVo = voCollPractices.get(i); addPracticeToGrid(organisationWithSitesVo, form.grdSearch().getRows().newRow()); } }
public Boolean addPractice(OrganisationWithSitesVo organisationWithSitesVo) { if(organisationWithSitesVo == null) return Boolean.FALSE; return addPracticeToGrid(organisationWithSitesVo, getGridRow(organisationWithSitesVo)); }