protected void onBtnNewClick() throws PresentationLogicException { clearScreen(); form.setMode(FormMode.EDIT); form.txtComments().setFocus(); TransferNote voTran = new TransferNote(); form.getLocalContext().setRecord(voTran); if (domain.getMosUser() != null) form.txtHCP().setValue(((MemberOfStaffShortVo) domain.getMosUser()).toString()); form.dteRecording().setValue(new Date()); form.timRecording().setValue(new Time()); form.dteTransfer().setValue(new Date()); form.timTransfer().setValue(new Time()); form.btnUpdate().setEnabled(false); }
protected void populateScreenFromData(ims.nursing.vo.TransferNote value) { clearScreen(); if (value == null) return; super.populateScreenFromData(value); if (value.getSysInfoIsNotNull()) this.form.timRecording().setValue(value.getSysInfo().getCreationDateTime().getTime()); else this.form.timRecording().setValue(null); if (value.getSysInfoIsNotNull()) this.form.dteRecording().setValue(value.getSysInfo().getCreationDateTime().getDate()); else this.form.dteRecording().setValue(null); // if (value.getSysInfoIsNotNull() && // value.getSysInfo().getCreationUser() != null) if (value.getAuthoringCP() != null) form.txtHCP().setValue(domain.getHCP(value.getAuthoringCP()).getName().toShortForm()); }
protected ims.nursing.vo.TransferNote populateDataFromScreen(ims.nursing.vo.TransferNote value) { value = super.populateDataFromScreen(value); if (value == null) return null; if (value.getTransferDateIsNotNull()) { if (form.timTransfer().getValue() == null) { Date date = value.getTransferDate().getDate(); value.getTransferDate().setDateTime(date, new Time()); } } if (value.getClinicalContact() == null) value.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); if (value.getCareContext() == null) value.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); MemberOfStaffShortVo memStaffShortVo = (MemberOfStaffShortVo) domain.getMosUser(); if (memStaffShortVo != null && memStaffShortVo.getHcp() != null) value.setAuthoringCP(memStaffShortVo.getHcp()); return value; }
protected void onBtnSaveClick() throws PresentationLogicException { TransferNote voTran = form.getLocalContext().getRecord(); voTran = this.populateDataFromScreen(voTran); if (voTran == null) return; String[] errors = voTran.validate(); if (errors != null) { engine.showErrors("Transfer Errors", errors); return; } try { form.getLocalContext().setRecord(domain.saveTransferNote(voTran)); } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); load(); return; } clearScreen(); load(); form.grdTransfer().setValue(form.getLocalContext().getRecord()); onGrdTransferSelectionChanged(); }
protected void onGrdTransferSelectionChanged() throws PresentationLogicException { TransferNote voTran = form.grdTransfer().getValue(); populateScreenFromData(voTran); form.getGlobalContext().COE.setTransferNote(voTran); form.getLocalContext().setRecord(voTran); form.btnUpdate().setEnabled(true); form.btnPrint().setEnabled(true); }
/** * Save Transfer note */ public TransferNote saveTransferNote(TransferNote voTransferNote) throws StaleObjectException { if (!voTransferNote.isValidated()) throw new DomainRuntimeException("The transfer note value object has not been validated"); DomainFactory factory = getDomainFactory(); ims.nursing.domain.objects.TransferNote doTransferNote = TransferNoteAssembler.extractTransferNote(factory, voTransferNote); factory.save(doTransferNote); return (TransferNoteAssembler.create(doTransferNote)); }