private void newInstance() { LeadConsultantForSpecialtyConfigVo spec = new LeadConsultantForSpecialtyConfigVo(); if (form.treLeadCons().getSelectedNode().getValue() instanceof LeadConsultantForSpecialtyConfigVo) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return; } if (form.treLeadCons().getSelectedNode().getValue() instanceof Specialty) { spec.setSpecialty((Specialty) form.treLeadCons().getSelectedNode().getValue()); form.getGlobalContext().OCRR.setLeadConsultantForSpecialtyConfigFB(spec); engine.open(form.getForms().OCRR.LeadConsultantForSpecialtyConfigDialog); } }
private void populateLeadConsforSpecTree() { LeadConsultantForSpecialtyConfigVoCollection leadConsCollection=domain.listLeadConsultantForSpecialty(); if (leadConsCollection == null) return; for (int i = 0; i < leadConsCollection.size(); i++) { LeadConsultantForSpecialtyConfigVo leadCons = leadConsCollection.get(i); TreeNode nodeSpecialty = form.treLeadCons().getNodeByValue(leadCons.getSpecialty()); if (nodeSpecialty != null) { addLeadConsultantToSpecialty(nodeSpecialty, leadCons); } } }
public void removeLeadCons(LeadConsultantForSpecialtyConfigVo leadCons) throws ForeignKeyViolationException { if (leadCons == null) throw new CodingRuntimeException("Cannot remove LeadConsultant if null . "); try { DomainFactory factory = getDomainFactory(); SpecialtyLeadConsultant domainLeadCons = LeadConsultantForSpecialtyConfigVoAssembler.extractSpecialtyLeadConsultant(factory, leadCons); factory.delete(domainLeadCons); } catch (ForeignKeyViolationException e) { throw new ForeignKeyViolationException("This Configuration is in use!", e); } }
public Boolean isStale(LeadConsultantForSpecialtyConfigVo globalContext) { if (globalContext == null || globalContext.getID_SpecialtyLeadConsultant()== null) { throw new CodingRuntimeException("Cannot get LeadConsultantForSpecialtyConfigFBVo on null Id "); } DomainFactory factory = getDomainFactory(); SpecialtyLeadConsultant domainLeadCons = (SpecialtyLeadConsultant) factory.getDomainObject(SpecialtyLeadConsultant.class, globalContext.getID_SpecialtyLeadConsultant()); if(domainLeadCons==null) { return true; } if (domainLeadCons.getVersion() > globalContext.getVersion_SpecialtyLeadConsultant()) { return true; } return false; }
@Override protected void onFormOpen(Object[] args) throws ims.framework.exceptions.PresentationLogicException { LeadConsultantForSpecialtyConfigVo globalContext = form.getGlobalContext().OCRR.getLeadConsultantForSpecialtyConfigFB(); form.txtSpecialty().setValue(globalContext.getSpecialty().toString()); if (globalContext.getLeadConsultant()!=null) { form.qmbLeadCons().newRow(globalContext.getLeadConsultant(), globalContext.getLeadConsultant().getIHcpName().toString()); form.qmbLeadCons().setValue(globalContext.getLeadConsultant()); } }
private void setGlobalContext() { if (form.treLeadCons().getValue() instanceof LeadConsultantForSpecialtyConfigVo) form.getGlobalContext().OCRR.setLeadConsultantForSpecialtyConfigFB((LeadConsultantForSpecialtyConfigVo) form.treLeadCons().getSelectedNode().getValue()); else if (form.treLeadCons().getSelectedNode().getValue() instanceof HcpLiteVo) form.getGlobalContext().OCRR.setLeadConsultantForSpecialtyConfigFB((LeadConsultantForSpecialtyConfigVo) form.treLeadCons().getSelectedNode().getParent().getValue()); }
public void updateControlsState() { form.getContextMenus().OCRR.getLeadConsultantForSpecialtyConfigADDItem().setVisible(form.getMode().equals(FormMode.VIEW) && form.treLeadCons().getValue() instanceof Specialty); //to appear edit and remove for the parent and for the child form.getContextMenus().OCRR.getLeadConsultantForSpecialtyConfigEDITItem().setVisible(form.getMode().equals(FormMode.VIEW) &&((form.treLeadCons().getValue() instanceof LeadConsultantForSpecialtyConfigVo ) || ((form.treLeadCons().getSelectedNode() != null) && (form.treLeadCons().getSelectedNode().getValue() instanceof HcpLiteVo )))); form.getContextMenus().OCRR.getLeadConsultantForSpecialtyConfigREMOVEItem().setVisible(form.getMode().equals(FormMode.VIEW) &&((form.treLeadCons().getValue() instanceof LeadConsultantForSpecialtyConfigVo ) || ((form.treLeadCons().getSelectedNode() != null) && (form.treLeadCons().getSelectedNode().getValue() instanceof HcpLiteVo )))); }
private void addLeadConsultantToSpecialty(TreeNode nodeSpecialty, LeadConsultantForSpecialtyConfigVo leadCons) { TreeNode nodeLeadCons =nodeSpecialty.getNodes().add(leadCons.getLeadConsultant(), leadCons.getLeadConsultant().getIHcpName()); nodeSpecialty.setValue(leadCons); nodeSpecialty.setExpanded(true); // TreeNode nodeLeadCons=form.treLeadCons().getNodeByValue(leadCons.getLeadConsultant()); //put images to LeadCons Node nodeLeadCons.setExpandedImage(form.getImages().Admin.StaffRed); nodeLeadCons.setCollapsedImage(form.getImages().Admin.StaffRed); }
public LeadConsultantForSpecialtyConfigVo saveLeadConsultant(LeadConsultantForSpecialtyConfigVo leadConsultant) throws StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if (leadConsultant == null ) throw new CodingRuntimeException("Cannot save leadConsultant if null or get LeadConsultant on null ID . "); if (!leadConsultant.isValidated()) throw new CodingRuntimeException("LeadConsultantForSpecialtyConfigFBVo not Validated"); try { DomainFactory factory = getDomainFactory(); SpecialtyLeadConsultant hcpMedic = LeadConsultantForSpecialtyConfigVoAssembler.extractSpecialtyLeadConsultant(factory, leadConsultant); if (getLeadConsultantBySpecialty(leadConsultant.getSpecialty()) && leadConsultant.getID_SpecialtyLeadConsultant()==null) { throw new StaleObjectException(hcpMedic); } factory.save(hcpMedic); return LeadConsultantForSpecialtyConfigVoAssembler.create(hcpMedic); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("This Lead Consultant already exist for this specialty!", e); } }