private void loadOrganisations() { form.lyrDetails().tabGenDetails().cmbRepOrganisation().clear(); form.lyrDetails().tabGenDetails().cmbRequestingOrg().clear(); OrgLiteVoCollection voColl = null; if (form.getLocalContext().getLoadedOrganisationsIsNotNull()) voColl = form.getLocalContext().getLoadedOrganisations(); else { voColl = domain.listOrganisationsLite(new OrgShortVo()); form.getLocalContext().setLoadedOrganisations(voColl); } for (int i = 0 ; voColl != null && i < voColl.size() ; i++) { if (voColl.get(i).getIsActiveIsNotNull() && voColl.get(i).getIsActive().booleanValue()) { form.lyrDetails().tabGenDetails().cmbRepOrganisation().newRow(voColl.get(i), voColl.get(i).getName(), null, null); form.lyrDetails().tabGenDetails().cmbRequestingOrg().newRow(voColl.get(i), voColl.get(i).getName(), null, null); } } }
private void addSupplier() { form.setMode(FormMode.EDIT); form.btnSave().setEnabled(true); form.treSuppliers().setEnabled(false); enableDetailsTab(true); showContextMenus(false); clearDetailsTab(); OrgShortVo voOrg = new OrgShortVo(); voOrg.setIsActive(Boolean.TRUE); form.getLocalContext().setSupplier(voOrg); form.lyr1().tabOrg().txtOrgName().setFocus(); form.btnSave().setVisible(true); form.btnCancel().setVisible(true); form.getContextMenus().getGenericGridAddItem().setVisible(true); }
protected void onBtnCancelClick() throws ims.framework.exceptions.PresentationLogicException { enableDetailsTab(false); clearDetailsTab(); open(); form.getLocalContext().setbFullSaveRequired(Boolean.FALSE); //----------------------------------------------------------- form.getContextMenus().getGenericGridAddItem().setVisible(false); //----------------------------------------------------------- form.setMode(FormMode.VIEW); //--------------------------------- updateContextMenu(null); if (form.getLocalContext().getSupplierIsNotNull()) { onBtnSearchClick(); form.treSuppliers().setValue(form.getLocalContext().getSupplier()); } //-------------------------------- if (form.treSuppliers().getSelectedNode() != null) { populateScreenFromData((OrgShortVo) form.treSuppliers().getSelectedNode().getValue()); updateContextMenu(form.treSuppliers().getSelectedNode()); } form.getLocalContext().setbUpdateSupplier(false); }
protected ims.core.vo.OrgShortVo populateDataFromScreen(ims.core.vo.OrgShortVo value) { if(value == null) value = new ims.core.vo.OrgShortVo(); PersonAddress voPersonAdress = new PersonAddress(); voPersonAdress.setCounty(form.lyr1().tabOrg().cmbOrgCounty().getValue()); voPersonAdress.setFax(form.lyr1().tabOrg().txtOrgFax().getValue()); voPersonAdress.setLine1(form.lyr1().tabOrg().txtOrgAdd1().getValue()); voPersonAdress.setLine2(form.lyr1().tabOrg().txtOrgAdd2().getValue()); voPersonAdress.setLine3(form.lyr1().tabOrg().txtOrgAdd3().getValue()); voPersonAdress.setLine4(form.lyr1().tabOrg().txtOrgAdd4().getValue()); voPersonAdress.setLine5(form.lyr1().tabOrg().txtOrgAdd5().getValue()); voPersonAdress.setPhone(form.lyr1().tabOrg().txtOrgPhone().getValue()); voPersonAdress.setPostCode(form.lyr1().tabOrg().txtOrgPostCode().getValue()); value.setAddress(voPersonAdress); value.setCodeMappings(getCodeMappings(form.lyr1().tabOrg().grdMappings())); value.setComment(form.lyr1().tabOrg().txtOrgComment().getValue()); value.setType(ims.core.vo.lookups.OrganisationType.SUPPLIER); value.setName(form.lyr1().tabOrg().txtOrgName().getValue()); return value; }
protected void populateScreenFromData(ims.core.vo.OrgShortVo value) { clearDetailsTab(); if(value == null) return; PersonAddress voPersonAdress = new PersonAddress(); voPersonAdress = value.getAddressIsNotNull() ? value.getAddress() : null; if (voPersonAdress != null) { form.lyr1().tabOrg().txtOrgAdd1().setValue(voPersonAdress.getLine1IsNotNull() ? voPersonAdress.getLine1() : null ); form.lyr1().tabOrg().txtOrgAdd2().setValue(voPersonAdress.getLine2IsNotNull() ? voPersonAdress.getLine2() : null ); form.lyr1().tabOrg().txtOrgAdd3().setValue(voPersonAdress.getLine3IsNotNull() ? voPersonAdress.getLine3() : null ); form.lyr1().tabOrg().txtOrgAdd4().setValue(voPersonAdress.getLine4IsNotNull() ? voPersonAdress.getLine4() : null ); form.lyr1().tabOrg().txtOrgAdd5().setValue(voPersonAdress.getLine5IsNotNull() ? voPersonAdress.getLine5() : null ); form.lyr1().tabOrg().txtOrgFax().setValue(voPersonAdress.getFaxIsNotNull()? voPersonAdress.getFax() : null ); form.lyr1().tabOrg().txtOrgPhone().setValue(voPersonAdress.getPhoneIsNotNull() ? voPersonAdress.getPhone() : null ); form.lyr1().tabOrg().txtOrgPostCode().setValue(voPersonAdress.getPostCodeIsNotNull() ? voPersonAdress.getPostCode() : null ); form.lyr1().tabOrg().cmbOrgCounty().setValue(voPersonAdress.getCountyIsNotNull()? voPersonAdress.getCounty() : null); } populateMappingsGrid(value.getCodeMappings()); form.lyr1().tabOrg().txtOrgComment().setValue(value.getCommentIsNotNull() ? value.getComment(): null); form.lyr1().tabOrg().txtOrgName().setValue(value.getNameIsNotNull() ? value.getName(): null); }
private void updateSupplier() { if (form.treSuppliers().getSelectedNode() != null) { form.setMode(FormMode.EDIT); form.getLocalContext().setSupplier((OrgShortVo) form.treSuppliers().getSelectedNode().getValue()); populateScreenFromData((OrgShortVo) form.treSuppliers().getSelectedNode().getValue()); form.btnSave().setEnabled(true); form.treSuppliers().setEnabled(false); enableDetailsTab(true); showContextMenus(false); form.lyr1().tabOrg().txtOrgName().setFocus(); form.btnSave().setVisible(true); form.btnCancel().setVisible(true); form.getContextMenus().getGenericGridAddItem().setVisible(true); } }
/** * Move a location site */ @SuppressWarnings("unchecked") public void moveLocSite(ims.core.vo.LocSiteVo locSiteToMove, OrgShortVo currentParent, OrgShortVo destParent) throws StaleObjectException { DomainFactory factory = getDomainFactory(); LocSite doLocSite = LocSiteVoAssembler.extractLocSite(factory, locSiteToMove); Organisation doOrgCurrentParent = OrgShortVoAssembler.extractOrganisation(factory, currentParent); Organisation doOrgDestParent = OrgShortVoAssembler.extractOrganisation(factory, destParent); //strange hibernate(v3) error was being generated here and session refresh problems so hence the factory.refresh() calls doLocSite.setParentOrganisation(doOrgDestParent); doOrgCurrentParent.getLocationSites().remove(doLocSite); factory.refresh(doOrgCurrentParent); doOrgDestParent.getLocationSites().add(doLocSite); factory.save(doLocSite); factory.refresh(doOrgCurrentParent); //WDEV-10574 REMOTE_LOC_CACHE.clear(); }
public OrgShortVo saveOrganisationShort(OrgShortVo organisation) throws StaleObjectException, UniqueKeyViolationException { /*String result = "";*/ DomainFactory factory = getDomainFactory(); Organisation doOrg = OrgShortVoAssembler.extractOrganisation(factory, organisation); /*String serviceActivityUnique = isTaxonomyUnique(organisation.getCodeMappings()); result += serviceActivityUnique; if(result.length() > 0) throw new UniqueKeyViolationException(result); */ try { doOrg.setUpperNames(); factory.save(doOrg); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("An Organisation with this details already exists within the system, please change", e); } return OrgShortVoAssembler.create(doOrg); }
private void listOrganisation(DynamicGridCell cell) { if (cell == null) return; OrgShortVo filter = new OrgShortVo(); filter.setName(cell.getTypedText()); filter.setIsActive(Boolean.TRUE); populateCellItems(cell, domain.listOrganisationsShort(filter)); }
protected void onFormModeChanged() { form.getContextMenus().getSupplierTreeMenuEDITSUPPLIERItem().setVisible(form.treSuppliers().getSelectedNode() != null ? (OrgShortVo) form.treSuppliers().getSelectedNode().getValue() != null : false); if (form.getMode().equals(FormMode.EDIT)) { form.btnSearch().setEnabled(false); form.chkMyRecycleBin().setEnabled(false); } else { form.btnSearch().setEnabled(true); form.chkMyRecycleBin().setEnabled(true); } }
protected void onTreSuppliersTreeViewSelectionChanged(TreeNode node) throws PresentationLogicException { if ((OrgShortVo) node.getValue() != null) { form.getLocalContext().setSupplier((OrgShortVo) node.getValue()); populateScreenFromData((OrgShortVo) node.getValue()); enableDetailsTab(false); } else clearDetailsTab(); updateContextMenu(node); }
/** * @param b */ private void populateSupplierCollection(Boolean bActive) { OrgShortVo voOrg = new OrgShortVo(); voOrg.setName(form.txtSupplierName().getValue()); OrgShortVoCollection voCollOrg = domain.listOrganisationForType(OrganisationType.SUPPLIER, voOrg, bActive); if(voCollOrg == null || voCollOrg.size() == 0) { engine.showMessage("No results found."); } OrgShortVoCollection voCollActiveOrgs = new OrgShortVoCollection(); OrgShortVoCollection voCollInactiveOrgs = new OrgShortVoCollection(); for(int i=0;i<voCollOrg.size();i++) { if(voCollOrg.get(i).getIsActiveIsNotNull() && voCollOrg.get(i).getIsActive().booleanValue()) voCollActiveOrgs.add(voCollOrg.get(i)); else voCollInactiveOrgs.add(voCollOrg.get(i)); } form.getLocalContext().setActiveSuppliers(voCollActiveOrgs); form.getLocalContext().setInActiveSuppliers(voCollInactiveOrgs); }
/** * @throws PresentationLogicException * */ private void removeSupplier() throws PresentationLogicException { if (form.treSuppliers().getSelectedNode() == null) return; if (form.treSuppliers().getSelectedNode().getValue() instanceof OrgShortVo) { form.getLocalContext().setbFullSaveRequired(Boolean.FALSE); form.btnSave().setEnabled(true); OrgShortVo voOrg = (OrgShortVo) form.treSuppliers().getSelectedNode().getValue(); voOrg.setIsActive(Boolean.FALSE); OrgShortVoCollection voCollInActiveSuppliers = form.getLocalContext().getInActiveSuppliers(); voCollInActiveSuppliers.add(voOrg); form.getLocalContext().setInActiveSuppliers(voCollInActiveSuppliers); form.treSuppliers().getNodes().remove(form.treSuppliers().getSelectedNode()); OrgShortVoCollection voCollActiveSuppliers = form.getLocalContext().getActiveSuppliers(); for (int i = 0; i < voCollActiveSuppliers.size(); i++) { if (voCollActiveSuppliers.get(i).equals(voOrg)) { voCollActiveSuppliers.remove(i); saveSupplier(voOrg); break; } } form.getLocalContext().setActiveSuppliers(voCollActiveSuppliers); onBtnSearchClick(); //populateSuppliersTree(); form.getContextMenus().getSupplierTreeMenuADDSUPPLIERItem().setVisible(true); } }
/** * @param voOrg */ private boolean saveSupplier(OrgShortVo voOrg) { String[] arrErrors = null; if(voOrg != null) arrErrors = voOrg.validate(); if(arrErrors != null) { engine.showErrors(arrErrors); return false; } try { if(voOrg != null) { form.getLocalContext().setSupplier(domain.saveOrganisationShort(voOrg)); } } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } catch (UniqueKeyViolationException e1) { engine.showMessage(e1.getMessage()); return false; } return true; }