public ims.admin.vo.OrganisationPCTLinkConfigVo save(ims.admin.vo.OrganisationPCTLinkConfigVo organisationPCTCodeConfig) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if (organisationPCTCodeConfig == null ) throw new CodingRuntimeException("Cannot save organisationPCTCodeConfig if null or get organisationPCTCodeConfig on null ID . "); if (!organisationPCTCodeConfig.isValidated()) throw new CodingRuntimeException("OrganisationPCTLinkConfigVo not Validated"); try { DomainFactory factory = getDomainFactory(); OrganisationPCTLinkConfig orgPctCode = OrganisationPCTLinkConfigVoAssembler.extractOrganisationPCTLinkConfig(factory, organisationPCTCodeConfig); factory.save(orgPctCode); return OrganisationPCTLinkConfigVoAssembler.create(orgPctCode); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("This Configuration Already Exist!", e); } }
public Boolean isStale(OrganisationPCTLinkConfigVo orgPCTCode) { if (orgPCTCode == null || orgPCTCode.getID_OrganisationPCTLinkConfig()== null) { throw new CodingRuntimeException("Cannot get OrganisationPCTLinkConfigVo on null Id "); } DomainFactory factory = getDomainFactory(); OrganisationPCTLinkConfig domainOrgPCTCode = (OrganisationPCTLinkConfig) factory.getDomainObject(OrganisationPCTLinkConfig.class, orgPCTCode.getID_OrganisationPCTLinkConfig()); if(domainOrgPCTCode==null) { return true; } if (domainOrgPCTCode.getVersion() > orgPCTCode.getVersion_OrganisationPCTLinkConfig()) { return true; } return false; }
private void addPCTCodeToOrganisation(TreeNode nodeOrganisation,OrganisationPCTLinkConfigVo orgPct) { TreeNode nodePCT =nodeOrganisation.getNodes().add(orgPct.getPctCode(), orgPct.getPctCode()); nodePCT.setValue(orgPct); nodePCT.setExpandedImage(form.getImages().Admin.LocationSite); nodePCT.setCollapsedImage(form.getImages().Admin.LocationSite); }
private void newPCTCode() { form.getGlobalContext().Admin.setOrganisationPCTLinkConfigGlobalContext(new OrganisationPCTLinkConfigVo()); form.getGlobalContext().Admin.getOrganisationPCTLinkConfigGlobalContext().setOrganisationCode(form.treOrgPCTCode().getSelectedNode().getText()); engine.open(form.getForms().Admin.OrganisationCodeAndPCTLinksConfigDialog); }
private void updateOrganisationCode() { if (form.treOrgPCTCode().getSelectedNode().getNodes().get(0).getValue() instanceof OrganisationPCTLinkConfigVo) { form.getGlobalContext().Admin.setOrganisationPCTLinkConfigGlobalContext((OrganisationPCTLinkConfigVo)form.treOrgPCTCode().getSelectedNode().getNodes().get(0).getValue()); } form.getLocalContext().setEditOrganisationLocalContext(true); Object[] parameters =new Object[1]; parameters[0]=EDITORGANISATION; engine.open(form.getForms().Admin.OrganisationCodeAndPCTLinksConfigDialog ,parameters); }
private void updatePCTCode() { if (form.treOrgPCTCode().getSelectedNode().getValue() instanceof OrganisationPCTLinkConfigVo) { form.getGlobalContext().Admin.setOrganisationPCTLinkConfigGlobalContext((OrganisationPCTLinkConfigVo)form.treOrgPCTCode().getValue()); } engine.open(form.getForms().Admin.OrganisationCodeAndPCTLinksConfigDialog); }
private void removeInstance() { if (form.treOrgPCTCode().getValue() instanceof OrganisationPCTLinkConfigVo) { form.getLocalContext().setLocalContextOrgPCTCode((OrganisationPCTLinkConfigVo)form.treOrgPCTCode().getValue()); } else { form.getLocalContext().setLocalContextOrgPCTCode((OrganisationPCTLinkConfigVo)form.treOrgPCTCode().getSelectedNode().getNodes().get(0).getValue()); } if (domain.isStale(form.getLocalContext().getLocalContextOrgPCTCode())) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getLocalContext().setLocalContextOrgPCTCode(null); return; } try { domain.removeOrgPCTCode(form.getLocalContext().getLocalContextOrgPCTCode()); } catch (ForeignKeyViolationException e) { engine.showMessage("This Configuration is in use!"); return ; } return ; }
public void updateControlsState() { form.getContextMenus().Admin.getOrganisationAndPCTCodeAddOrganisationCodeItem().setVisible(true); form.getContextMenus().Admin.getOrganisationAndPCTCodeEditOrganisationCodeItem().setVisible(form.treOrgPCTCode().getSelectedNode()!=null && (!(form.treOrgPCTCode().getValue() instanceof OrganisationPCTLinkConfigVo))); form.getContextMenus().Admin.getOrganisationAndPCTCodeRemoveOrganisationCodeItem().setVisible(form.treOrgPCTCode().getSelectedNode()!=null && (!(form.treOrgPCTCode().getValue() instanceof OrganisationPCTLinkConfigVo))&& (form.treOrgPCTCode().getSelectedNode().getNodes().size()==1)); form.getContextMenus().Admin.getOrganisationAndPCTCodeAddPCTCodeItem().setVisible(form.treOrgPCTCode().getSelectedNode()!=null && (!(form.treOrgPCTCode().getValue() instanceof OrganisationPCTLinkConfigVo))); form.getContextMenus().Admin.getOrganisationAndPCTCodeEditPCTCodeItem().setVisible(form.treOrgPCTCode().getValue() instanceof OrganisationPCTLinkConfigVo); form.getContextMenus().Admin.getOrganisationAndPCTCodeRemovePCTCodeItem().setVisible(form.treOrgPCTCode().getValue() instanceof OrganisationPCTLinkConfigVo); }
public void removeOrgPCTCode(OrganisationPCTLinkConfigVo orgPCTCode)throws ForeignKeyViolationException { if (orgPCTCode == null) throw new CodingRuntimeException("Cannot remove OrganisationPCTCode if null . "); DomainFactory factory = getDomainFactory(); OrganisationPCTLinkConfig domainOrgPCTCode = OrganisationPCTLinkConfigVoAssembler.extractOrganisationPCTLinkConfig(factory, orgPCTCode); factory.delete(domainOrgPCTCode); }
private void newOrganisationCode() { form.getGlobalContext().Admin.setOrganisationPCTLinkConfigGlobalContext(new OrganisationPCTLinkConfigVo()); engine.open(form.getForms().Admin.OrganisationCodeAndPCTLinksConfigDialog); }