private void expandParentNode(grdFunctionalTransRow selectedRow) { if (selectedRow.getValue() instanceof FunctionalTransfersShortVo == false) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((FunctionalTransfersShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null) return; FunctionalTransfersVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && (voParentInstance.getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))) { // If this is the Golden Node then we'll colour it golden (ok then // beige). form.getLocalContext().setGoldenInstanceFound(new Boolean(true)); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); selectedRow.setBackColor(Color.Beige); } if (voParentInstance.getMovementsIsNotNull()) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getMovements()); } populateParentInstanceControls(voParentInstance); }
private void newParentNode(FunctionalTransfersVo voNewParent) { if (voNewParent == null) return; FunctionalTransfersShortVo voParentShort = new FunctionalTransfersShortVo(); voParentShort.setAuthoringCP(voNewParent.getAuthoringCP()); voParentShort.setAuthoringDateTime(voNewParent.getAuthoringDateTime()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); GenForm.grdFunctionalTransRow parentRow = form.grdFunctionalTrans().getRows().newRow(); if (voParentShort.getAuthoringCP() != null) parentRow.setcolStartingPositionParent(voParentShort.getAuthoringDateTime().toString() + " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdFunctionalTrans().setValue(voParentShort); }
private void populateChildCollectionFromGrid(FunctionalTransfersVo voFunctionalTransfers) { if (form.grdFunctionalTrans().getValue() == null) return; if (voFunctionalTransfers.getMovements() == null) voFunctionalTransfers.setMovements(new FunctionalTransfersTechniqueVoCollection()); GenForm.grdFunctionalTransRow parentRow = form.grdFunctionalTrans().getValue() instanceof FunctionalTransfersShortVo ? form.grdFunctionalTrans().getSelectedRow() : form.grdFunctionalTrans().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0) voFunctionalTransfers.getMovements().clear(); for (int i = 0; i < parentRow.getRows().size(); i++) { voFunctionalTransfers.getMovements().add((FunctionalTransfersTechniqueVo) parentRow.getRows().get(i).getValue()); } }
/** * Domain Interface function used to save a Functional Transfer */ public FunctionalTransfersVo saveFunctionalTransfers(FunctionalTransfersVo functionalTransfers) throws StaleObjectException, UniqueKeyViolationException, ForeignKeyViolationException { // Ensure the value object has been validated if (!functionalTransfers.isValidated()) throw new DomainRuntimeException("FunctionalTransfers record has not been validated"); // Creating a new record if (!functionalTransfers.getID_FunctionalTransfersIsNotNull()) { if (existsRecord(functionalTransfers.getClinicalContact())) throw new ForeignKeyViolationException("A Functional Transfer record already exists for this Clinical Contact"); } DomainFactory factory = getDomainFactory(); FunctionalTransfers domFunctionalTransfers = FunctionalTransfersVoAssembler.extractFunctionalTransfers(factory, functionalTransfers); factory.save(domFunctionalTransfers); return FunctionalTransfersVoAssembler.create(domFunctionalTransfers); }
private void populateParentInstanceControls(FunctionalTransfersVo voFunctTransParent) { if (voFunctTransParent != null) { form.ctnFunctTrans().lyrFunctTransfers().tabHeader().dtimAuthoringDateTime().setValue(voFunctTransParent.getAuthoringDateTime()); if (voFunctTransParent.getAuthoringCP() != null) form.ctnFunctTrans().lyrFunctTransfers().tabHeader().qmbAuthoringCP().newRow(voFunctTransParent.getAuthoringCP(), voFunctTransParent.getAuthoringCP().toString()); form.ctnFunctTrans().lyrFunctTransfers().tabHeader().qmbAuthoringCP().setValue(voFunctTransParent.getAuthoringCP()); } }
private void newParentInstance() { FunctionalTransfersVo voNewParent = new FunctionalTransfersVo(); voNewParent.setAuthoringCP((HcpLiteVo) domain.getHcpLiteUser()); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setMovements(new FunctionalTransfersTechniqueVoCollection()); populateParentInstanceControls(voNewParent); loadEquipment(); loadTechnique(); form.getLocalContext().setSelectedParentInstance(voNewParent); }
/** * Domain Interface function used to retrieve a specific Functional Transfer */ public FunctionalTransfersVo getFunctionalTransfers(FunctionalTransfersRefVo functionalTransferRef) { // Check parameter if (functionalTransferRef == null || !functionalTransferRef.getID_FunctionalTransfersIsNotNull()) throw new DomainRuntimeException("Invalid parameter FunctionalTransfer"); return FunctionalTransfersVoAssembler.create((FunctionalTransfers) getDomainFactory().getDomainObject(FunctionalTransfers.class, functionalTransferRef.getID_FunctionalTransfers())); }
private FunctionalTransfersVo getParentFromDomain(FunctionalTransfersShortVo voFunctTransShort) { return domain.getFunctionalTransfers(voFunctTransShort); }
private void populateParentInstanceData(FunctionalTransfersVo voFunctionalTransfers) { voFunctionalTransfers.setAuthoringCP(form.ctnFunctTrans().lyrFunctTransfers().tabHeader().qmbAuthoringCP().getValue()); voFunctionalTransfers.setAuthoringDateTime(form.ctnFunctTrans().lyrFunctTransfers().tabHeader().dtimAuthoringDateTime().getValue()); }