public ims.core.vo.PatientHomeSituationVo saveHomeSituation(ims.core.vo.PatientHomeSituationVo homesituation) throws ims.domain.exceptions.StaleObjectException { if(homesituation == null) throw new CodingRuntimeException("Cannot save null homesituation"); if(!homesituation.isValidated()) throw new CodingRuntimeException("PatientHomeSituationVo has not been validated"); if (homesituation.getID_PatientHomeSituation() == null && getHomeSituationByCareContext(homesituation.getCareContext()) != null) throw new StaleObjectException(null, "A Home Situation record already exists for this Care Context, the screen will be refreshed."); DomainFactory factory = getDomainFactory(); PatientHomeSituation doHomeSituation = PatientHomeSituationVoAssembler.extractPatientHomeSituation(factory, homesituation); factory.save(doHomeSituation); return PatientHomeSituationVoAssembler.create(doHomeSituation); }
public PatientHomeSituationVo getHomeSituationByCareContext(CareContextRefVo careContext) { if (careContext == null) throw new RuntimeException("Cannot get PatientHomeSituationVo for null CareContextRefVo"); String hql = new String("from PatientHomeSituation p1_1 where p1_1.careContext.id = :CARECONTEXT_ID"); java.util.List list = getDomainFactory().find(hql, "CARECONTEXT_ID", careContext.getID_CareContext()); if (list.size() == 0) return null; else if (list.size() > 1) throw new RuntimeException("More than one Home Situation for current CareContext found"); return PatientHomeSituationVoAssembler.createPatientHomeSituationVoCollectionFromPatientHomeSituation(list).get(0); }
public void open() throws ims.framework.exceptions.PresentationLogicException { form.setMode(FormMode.VIEW); PatientHomeSituationVo voHomeSituation = domain.getHomeSituationByCareContext(form.getGlobalContext().Core.getCurrentCareContext()); if(voHomeSituation != null) populateScreenFromData(voHomeSituation); updateControlsState(); }
private boolean save() { PatientHomeSituationVo voHomeSituation = form.getLocalContext().getSelectedRecord(); populateDataFromScreen(voHomeSituation); if(voHomeSituation.countFieldsWithValue() == 0) { //TODO this code will be removed upon completion of WDEV-2153 if(voHomeSituation.getAuthoringInformationIsNotNull() && voHomeSituation.getAuthoringInformation().getAuthoringDateTime() == null && voHomeSituation.getAuthoringInformation().getAuthoringHcp() == null) { engine.showErrors(new String[]{"There has been no data provided. Please provide at least one value before saving."}); return false; } } String[] uIErrors = voHomeSituation.validate(); //WDEV-2217 if(uIErrors != null || !getUiErrors()) { engine.showErrors(uIErrors); return false; } try { voHomeSituation = domain.saveHomeSituation(voHomeSituation); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); } return true; }
protected void onBtnNewClick() throws ims.framework.exceptions.PresentationLogicException { form.setMode(FormMode.EDIT); clearScreen(); updateControlsState(); form.getLocalContext().setSelectedRecord(new PatientHomeSituationVo()); form.customControlAuthoringInfo().initializeComponent(); displaySocialHistory(); }
protected PatientHomeSituationVo populateDataFromScreen(PatientHomeSituationVo value) { value.setAuthoringInformation(form.customControlAuthoringInfo().getValue()); value.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); value.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); return super.populateDataFromScreen(value); }
protected void populateScreenFromData(PatientHomeSituationVo value) { form.getLocalContext().setSelectedRecord(value); super.populateScreenFromData(value); form.customControlAuthoringInfo().setValue(value.getAuthoringInformation()); }