private void populateInstanceControls(SentToXrayVo selectedSendToXRay) { clearInstanceControls(); if (selectedSendToXRay == null) { return; } selectedSendToXRay = domain.getSentToXRay(selectedSendToXRay); form.ccAllocatedBy().setValue(selectedSendToXRay.getSentBy()); form.dtimSent().setValue(selectedSendToXRay.getSentDateTime()); form.dtimReturned().setValue(selectedSendToXRay.getReturnedDateTime()); if (selectedSendToXRay.getReturnedDateTime()!=null) { form.chkReturned().setValue(true); form.dtimReturned().setValue(selectedSendToXRay.getReturnedDateTime()); if (form.getLocalContext().getcurrentTracking().getCurrentStatus()!=null) { form.cmbSetCurrentStatus().setValue(form.getLocalContext().getcurrentTracking().getCurrentStatus().getStatus()); } } }
public SentToXrayVo save(SentToXrayVo sentToXRayToSave, TrackingForSendToXRayVo tracking) throws StaleObjectException { if (sentToXRayToSave == null) throw new CodingRuntimeException("Cannot save null SentToXRay "); if (!sentToXRayToSave.isValidated()) throw new DomainRuntimeException("SentToXrayVo Not Validated."); DomainFactory factory = getDomainFactory(); SentToXray domainSentToXRay = SentToXrayVoAssembler.extractSentToXray(factory, sentToXRayToSave); factory.save(domainSentToXRay); if (tracking!=null) { if (!tracking.isValidated()) throw new DomainRuntimeException("TrackingForAllocatedMedicVo Not Validated."); Tracking domainTracking = TrackingForSendToXRayVoAssembler.extractTracking(factory, tracking); factory.save(domainTracking); } return SentToXrayVoAssembler.create(domainSentToXRay); }
public Boolean isStale(SentToXrayVo sentToXRayToSave) { if (sentToXRayToSave == null || sentToXRayToSave.getID_SentToXray() == null) { throw new CodingRuntimeException("Cannot get SentToXrayVo on null Id "); } DomainFactory factory = getDomainFactory(); SentToXray domainSentToXRay = (SentToXray) factory.getDomainObject(SentToXray.class,sentToXRayToSave.getID_SentToXray()); if(domainSentToXRay==null) { return true; } if (domainSentToXRay.getVersion() > sentToXRayToSave.getVersion_SentToXray()) { return true; } return false; }
public Boolean isMostRecentRecordReturned(CareContextRefVo careContextRef) { if (careContextRef == null || careContextRef.getID_CareContext() == null) { throw new CodingRuntimeException("Cannot get AllocatedMedicVoCollection on null Id for CareContext "); } DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append("select allSentToXRay from SentToXray as allSentToXRay where allSentToXRay.attendance.id = :attID order by allSentToXRay.sentDateTime desc "); List<?> list = factory.find(hql.toString(), new String[] {"attID"}, new Object[] {careContextRef.getID_CareContext()}); if (list.size()>0) { SentToXrayVo lastRec = SentToXrayVoAssembler.createSentToXrayVoCollectionFromSentToXray(list).get(0); if (lastRec.getReturnedDateTimeIsNotNull()) return true; else return false; } else return true; }
private void addSentToXrayTimeRowToGrid(SentToXrayVo sentToXrayVo) { if(sentToXrayVo == null) return; grdSentToXrayRow newrow = form.ctnTimes().grdSentToXray().getRows().newRow(); if (sentToXrayVo.getSentBy() != null) { newrow.setColNurse(sentToXrayVo.getSentBy().getIMosName()); } if (sentToXrayVo.getSentDateTime() != null) { newrow.setColSentDate(sentToXrayVo.getSentDateTime().toString()); } if(sentToXrayVo.getReturnedDateTime() != null) { newrow.setColReturnedDate(sentToXrayVo.getReturnedDateTime().toString()); } newrow.setValue(sentToXrayVo); }
public SentToXrayVo getSentToXRay(SentToXrayRefVo sentToXRay) { if (sentToXRay == null || sentToXRay.getID_SentToXray() == null) { throw new CodingRuntimeException("Cannot get SentToXrayVo on null Id "); } DomainFactory factory = getDomainFactory(); SentToXray domainSentToXRay = (SentToXray) factory.getDomainObject(SentToXray.class, sentToXRay.getID_SentToXray()); return SentToXrayVoAssembler.create(domainSentToXRay); }
public SentToXrayVo save(SentToXrayVo sentToXRayToSave) throws ims.domain.exceptions.StaleObjectException { if (sentToXRayToSave == null) throw new CodingRuntimeException("Cannot save null SentToXRay "); if (!sentToXRayToSave.isValidated()) throw new DomainRuntimeException("SentToXrayVo Not Validated."); DomainFactory factory = getDomainFactory(); SentToXray domainSentToXRay = SentToXrayVoAssembler.extractSentToXray(factory, sentToXRayToSave); factory.save(domainSentToXRay); return SentToXrayVoAssembler.create(domainSentToXRay); }
public Boolean isLastEntry(CareContextRefVo careContext, SentToXrayVo sentToXRay) { if (careContext == null || careContext.getID_CareContext() == null) throw new CodingRuntimeException("Logical error - Care context is mandatory to check the record 'Send To X-Ray"); String query = "SELECT COUNT (xRay) FROM SentToXray AS xRay LEFT JOIN xRay.attendance AS context WHERE xRay.systemInformation.creationDateTime >= :DATE_TIME AND xRay.id <> :XRAY_ID AND context.id = :CONTEXT_ID"; long records = getDomainFactory().countWithHQL(query, new String[] {"DATE_TIME", "XRAY_ID", "CONTEXT_ID"}, new Object[] {sentToXRay.getSystemInformation().getCreationDateTime().getJavaDate(), sentToXRay.getID_SentToXray(), careContext.getID_CareContext()}); if (records > 0) return false; return true; }
private void populateScreenFromData(SentToXrayVo sentToXrayVo) { clearScreen(); if(sentToXrayVo == null) return; form.txtSentBy().setValue(sentToXrayVo.getSentBy() != null ? sentToXrayVo.getSentBy().getIMosName() : null); form.dtimSent().setValue(sentToXrayVo.getSentDateTime()); form.dtimReturned().setValue(sentToXrayVo.getReturnedDateTime()); }
private boolean save() { SentToXrayVo record = populateDataFromScreen(form.getLocalContext().getCurrentRecord()); String[] errors = validateUIRules(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } errors = record.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { domain.save(record); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); engine.close(DialogResult.ABORT); return false; } return true; }
private SentToXrayVo populateDataFromScreen(SentToXrayVo currentRecord) { if(currentRecord == null) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); engine.close(DialogResult.ABORT); } currentRecord.setSentDateTime(form.dtimSent().getValue()); currentRecord.setReturnedDateTime(form.dtimReturned().getValue()); return currentRecord; }
private void populateRecordBrowser() { form.recbrSentToXRay().clear(); SentToXrayVoCollection collSentToXRay = domain.getAllSentToXRay(form.getGlobalContext().Core.getCurrentCareContext()); if (collSentToXRay == null) { return; } for (int i = 0; i < collSentToXRay.size(); i++) { SentToXrayVo sentToXRay = collSentToXRay.get(i); StringBuffer string = new StringBuffer(); if (sentToXRay.getSentDateTimeIsNotNull()) { string.append("Sent on: "+sentToXRay.getSentDateTime()); } if (sentToXRay.getSentByIsNotNull()) { string.append(" - "+sentToXRay.getSentBy().getName()); } if (sentToXRay.getReturnedDateTimeIsNotNull()) { string.append(" - Returned on: "+sentToXRay.getReturnedDateTime()); } form.recbrSentToXRay().newRow(sentToXRay, string.toString()); } if (collSentToXRay.size() > 0 && form.getLocalContext().getselectedSendToXRay() == null) { form.getLocalContext().setselectedSendToXRay(collSentToXRay.get(0)); } form.recbrSentToXRay().setValue(form.getLocalContext().getselectedSendToXRay()); populateInstanceControls(form.getLocalContext().getselectedSendToXRay()); }