private void selectInstance() throws PresentationLogicException { if (form.grdHospAtNight().getValue() instanceof HospitalAtNightCutOffPointsConfigVo) { HospitalAtNightCutOffPointsConfigVo selectedHospital = null; try { selectedHospital = domain.getHospitalConfig(form.grdHospAtNight().getValue()); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); } form.getLocalContext().setSelectedHospital(selectedHospital); populateInstanceControlsFromData(selectedHospital); } }
private void populateInstanceControlsFromData(HospitalAtNightCutOffPointsConfigVo hospitalConfig) { clearInstanceControls(); if (hospitalConfig == null) return; if (hospitalConfig.getHospitalIsNotNull()) { form.ctnHospDetails().qmbHospital().newRow(hospitalConfig.getHospital(), hospitalConfig.getHospital().getName()); form.ctnHospDetails().qmbHospital().setValue(hospitalConfig.getHospital()); } form.ctnHospDetails().EndTime().setValue(hospitalConfig.getEndTime()); form.ctnHospDetails().StartTime().setValue(hospitalConfig.getStartTime()); }
public ims.clinical.vo.HospitalAtNightCutOffPointsConfigVo saveHospitalAtNight(ims.clinical.vo.HospitalAtNightCutOffPointsConfigVo hospitalConfig) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if (hospitalConfig == null) throw new CodingRuntimeException("Cannot save null hospitalConfig"); if (!hospitalConfig.isValidated()) throw new DomainRuntimeException("HospitalVo Not Validated."); try { DomainFactory factory = getDomainFactory(); HospitalAtNightCutOverPointsConfig domainHospital = HospitalAtNightCutOffPointsConfigVoAssembler.extractHospitalAtNightCutOverPointsConfig(factory, hospitalConfig); factory.save(domainHospital); return HospitalAtNightCutOffPointsConfigVoAssembler.create(domainHospital); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("Hospital already exists in the system.", e); } }
public void deleteHospitalConfig(HospitalAtNightCutOffPointsConfigVo hospitalConfig) throws ForeignKeyViolationException { if (hospitalConfig == null) throw new CodingRuntimeException("Cannot delete null hospitalConfig"); try { DomainFactory factory = getDomainFactory(); HospitalAtNightCutOverPointsConfig domainHospital = HospitalAtNightCutOffPointsConfigVoAssembler.extractHospitalAtNightCutOverPointsConfig(factory, hospitalConfig); factory.delete(domainHospital); } catch (ForeignKeyViolationException e) { throw new ForeignKeyViolationException("Hospital configuration is used in the system.", e); } }
public Boolean isStale(HospitalAtNightCutOffPointsConfigVo selectedHospitalConfig) { DomainFactory factory = getDomainFactory(); HospitalAtNightCutOverPointsConfig domainHospital = (HospitalAtNightCutOverPointsConfig) factory.getDomainObject(HospitalAtNightCutOverPointsConfig.class, selectedHospitalConfig.getID_HospitalAtNightCutOverPointsConfig()); if (domainHospital == null) { return true; } if (domainHospital.getVersion() > selectedHospitalConfig.getVersion_HospitalAtNightCutOverPointsConfig()) { return true; } return false; }
private void populateHospitalConfigGrid(HospitalAtNightCutOffPointsConfigVoCollection configCollection) throws PresentationLogicException { form.grdHospAtNight().getRows().clear(); if (configCollection == null) return; for (int i = 0; i < configCollection.size(); i++) { HospitalAtNightCutOffPointsConfigVo hospitalConfig = configCollection.get(i); grdHospAtNightRow row = form.grdHospAtNight().getRows().newRow(); row.setHospName(hospitalConfig.getHospital().getName()); row.setEndTime(hospitalConfig.getEndTime().toString()); row.setStartTime(hospitalConfig.getStartTime().toString()); row.setValue(hospitalConfig); } if (form.getLocalContext().getSelectedHospital() != null) { try { form.getLocalContext().setSelectedHospital(domain.getHospitalConfig(form.getLocalContext().getSelectedHospital())); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getLocalContext().setSelectedHospital(null); open(); return ; } form.grdHospAtNight().setValue(form.getLocalContext().getSelectedHospital()); } }
public void updateControlsState() { form.ctnHospDetails().setCollapsed(!((form.grdHospAtNight().getValue() != null && form.getMode().equals(FormMode.VIEW)) || form.getMode().equals(FormMode.EDIT))); if (form.getMode() == FormMode.VIEW) { form.btnEdit().setVisible(form.grdHospAtNight().getValue() != null); form.btnEdit().setEnabled(form.grdHospAtNight().getValue() != null); } form.getContextMenus().Clinical.getHospAtNightCMNewItem().setVisible(form.getMode().equals(FormMode.VIEW)); form.getContextMenus().Clinical.getHospAtNightCMEditItem().setVisible(form.getMode().equals(FormMode.VIEW) && form.grdHospAtNight().getValue() instanceof HospitalAtNightCutOffPointsConfigVo); form.getContextMenus().Clinical.getHospAtNightCMRemoveItem().setVisible(form.getMode().equals(FormMode.VIEW) && form.grdHospAtNight().getValue() instanceof HospitalAtNightCutOffPointsConfigVo); }
public ims.clinical.vo.HospitalAtNightCutOffPointsConfigVo getHospitalConfig(ims.clinical.configuration.vo.HospitalAtNightCutOverPointsConfigRefVo hospitalConfigId) throws StaleObjectException { if (hospitalConfigId == null || hospitalConfigId.getID_HospitalAtNightCutOverPointsConfig() == null) throw new CodingRuntimeException("Cannot get HospitalAtNightCutOffPointsConfigBTVo on null Id."); DomainFactory factory = getDomainFactory(); HospitalAtNightCutOverPointsConfig domainHospital = (HospitalAtNightCutOverPointsConfig) factory.getDomainObject(HospitalAtNightCutOverPointsConfig.class, hospitalConfigId.getID_HospitalAtNightCutOverPointsConfig()); if (domainHospital == null) throw new StaleObjectException(domainHospital); return HospitalAtNightCutOffPointsConfigVoAssembler.create(domainHospital); }