private void newParentNode(StretchingVo voNewParent) { if (voNewParent == null) return; StretchingShortVo voParentShort = new StretchingShortVo(); voParentShort.setAuthoringCP(voNewParent.getAuthoringCP()); voParentShort.setAuthoringDateTime(voNewParent.getAuthoringDateTime()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); GenForm.grdAreaRow parentRow = form.grdArea().getRows().newRow(); if(voParentShort.getAuthoringCP() != null) parentRow.setColArea(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdArea().setValue(voParentShort); }
private void populateChildCollectionFromGrid(StretchingVo voStretching) { if (form.grdArea().getValue() == null) return; if (voStretching.getStretchingDetails() == null) voStretching.setStretchingDetails(new StretchingDetailsVoCollection()); GenForm.grdAreaRow parentRow = form.grdArea().getValue() instanceof StretchingShortVo ? form.grdArea().getSelectedRow() : form.grdArea().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voStretching.getStretchingDetails().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voStretching.getStretchingDetails().add((StretchingDetailsVo) parentRow.getRows().get(i).getValue()); } }
/** * Save a stretching Record for a Clinical Contact */ public StretchingVo saveStretchingVo(StretchingVo stretching) throws StaleObjectException, ForeignKeyViolationException { // Ensure the value object has been validated if (!stretching.isValidated()) throw new DomainRuntimeException("Stretching has not been validated"); // if a new Stretching record is created check if a Stretching record already exists for this SOAP clinical contact if (stretching != null && stretching.getID_Stretching() == null) { if (existsRecord(stretching.getClinicalContact())) throw new ForeignKeyViolationException("A Stretch record already exists for this SOAP clinical contact"); } DomainFactory factory = getDomainFactory(); Stretching doStretching = StretchingVoAssembler.extractStretching(factory, stretching); factory.save(doStretching); return StretchingVoAssembler.create(doStretching); }
private void populateParentInstanceControls(StretchingVo voStretchingParent) { if(voStretchingParent != null) { form.ctnStretching().lyrStretching().tabHeader().dtimAuthoring().setValue(voStretchingParent.getAuthoringDateTime()); if(voStretchingParent.getAuthoringCP() != null) form.ctnStretching().lyrStretching().tabHeader().qmbAuthoringHcp().newRow(voStretchingParent.getAuthoringCP(), voStretchingParent.getAuthoringCP().toString()); form.ctnStretching().lyrStretching().tabHeader().qmbAuthoringHcp().setValue(voStretchingParent.getAuthoringCP()); } }
private void expandParentNode(grdAreaRow selectedRow) { if (selectedRow.getValue() instanceof StretchingShortVo == false ) return; StretchingVo voStretching = getParentFromDomain((StretchingShortVo) form.grdArea().getValue()); if(voStretching.getStretchingDetails()==null || voStretching.getStretchingDetails().size()==0){ try { domain.deleteStretchingVo((StretchingShortVo) selectedRow.getValue()); } catch (ForeignKeyViolationException e) { // TODO Auto-generated catch block e.printStackTrace(); } open(); return; } form.getLocalContext().setSelectedParentInstance(getParentFromDomain((StretchingShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; StretchingVo 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.getStretchingDetailsIsNotNull()) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getStretchingDetails()); } populateParentInstanceControls(voParentInstance); }
private void newParentInstance() { StretchingVo voNewParent = new StretchingVo(); voNewParent.setAuthoringCP((Hcp) domain.getHcpUser()); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setStretchingDetails(new StretchingDetailsVoCollection()); populateParentInstanceControls(voNewParent); form.getLocalContext().setSelectedParentInstance(voNewParent); }
/** * Get the stretching */ public StretchingVo getStretchingVo(StretchingRefVo stretchingRef) { // Check for parameter if (stretchingRef == null || !stretchingRef.getID_StretchingIsNotNull()) throw new DomainRuntimeException("Invalid parameter Stretching Ref"); return StretchingVoAssembler.create((Stretching) getDomainFactory().getDomainObject(Stretching.class, stretchingRef.getID_Stretching())); }
private StretchingVo getParentFromDomain(StretchingShortVo voStretchingShort) { return domain.getStretchingVo(voStretchingShort); }
private void populateParentInstanceData(StretchingVo voStretching) { voStretching.setAuthoringCP(form.ctnStretching().lyrStretching().tabHeader().qmbAuthoringHcp().getValue()); voStretching.setAuthoringDateTime(form.ctnStretching().lyrStretching().tabHeader().dtimAuthoring().getValue()); }