@Override protected NeonatalVo populateDataFromScreen(NeonatalVo value) { value = super.populateDataFromScreen(value); value.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); if(!form.GroupHealthVisitor().getValue().equals(GroupHealthVisitorEnumeration.None)) value.setIsHealthVisitor(form.GroupHealthVisitor().getValue().equals(GroupHealthVisitorEnumeration.rdoVisitorYes)); if(!form.GroupMidwife().getValue().equals(GroupMidwifeEnumeration.None)) value.setIsMidwife(form.GroupMidwife().getValue().equals(GroupMidwifeEnumeration.rdoMidwifeYes)); if(!form.GroupVitaminK().getValue().equals(GroupVitaminKEnumeration.None)) value.setIsVitaminKGiven(form.GroupVitaminK().getValue().equals(GroupVitaminKEnumeration.rdoVitaminKGivenYes)); value.setDischargingNurse(form.ccDischargingNurse().getValue()); return value; }
@Override protected void populateScreenFromData(NeonatalVo value) { if(value == null) return; super.populateScreenFromData(value); if(value.getIsHealthVisitorIsNotNull()) form.GroupHealthVisitor().setValue(value.getIsHealthVisitor() ? GroupHealthVisitorEnumeration.rdoVisitorYes : GroupHealthVisitorEnumeration.rdoVisitorNo); if(value.getIsMidwifeIsNotNull()) form.GroupMidwife().setValue(value.getIsMidwife() ? GroupMidwifeEnumeration.rdoMidwifeYes : GroupMidwifeEnumeration.rdoMidwifeNo); if(value.getIsVitaminKGivenIsNotNull()) form.GroupVitaminK().setValue(value.getIsVitaminKGiven() ? GroupVitaminKEnumeration.rdoVitaminKGivenYes : GroupVitaminKEnumeration.rdoVitaminKGivenNo); form.ccDischargingNurse().setValue(value.getDischargingNurse()); }
private boolean save() { NeonatalVo voNeonatal = form.getLocalContext().getSelectedInstance(); ArrayList<String> screenErrors = new ArrayList<String>(); if (form.ccDischargingNurse().getValue() == null) screenErrors.add("Discharging Midwife/Nurse is a mandatory item."); if (form.GroupVitaminK().getValue().equals(GroupVitaminKEnumeration.rdoVitaminKGivenYes) && form.cmbHowAdministered().getValue() == null) screenErrors.add("Route for Vitamin K is a mandatory item."); String[] arrErrors = voNeonatal.validate(); String[] arrScreenAndVoErrors = addScreenErrorsToVOErrors(screenErrors, arrErrors); if(arrScreenAndVoErrors != null) { engine.showErrors(arrScreenAndVoErrors); return false; } try { domain.saveNeonatal(voNeonatal, form.getLocalContext().getSTHKSummary()); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getLocalContext().setLastEvent(EDischargeLastEvent.EDISCHARGE_SAVE); setMode(FormMode.VIEW); open(); form.fireCustomControlValueChanged(); return false; } form.getLocalContext().setLastEvent(EDischargeLastEvent.EDISCHARGE_SAVE); form.fireCustomControlValueChanged(); return true; }