private InterventionTreatmentDetailVo createInterventionTreatmentDetail(TreatmentInterventionLiteVo value) { if(value == null) return null; InterventionTreatmentDetailVo record = new InterventionTreatmentDetailVo(); //wdev-17444 if( Boolean.TRUE.equals(form.getLocalContext().getAuthoringInfoControlIsEnabled()) ) record.setAuthoringInformation(form.ccAuthoringInfo().getValue()); else record.setAuthoringInformation(form.getLocalContext().getLoggedInAuthoring()); //---------- record.setTreatmentIntervention(value); record.setTreatmentInterventionDescription(value.getTreatmentInterventionName()); if(Boolean.TRUE.equals(form.getLocalContext().getAddedDuringCoding())) { record.setAddedDuringCoding(true); } return record; }
private InterventionTreatmentDetailVo createInterventionTreatmentDetail(TreatmentInterventionLiteVo value) { if(value == null) return null; InterventionTreatmentDetailVo record = new InterventionTreatmentDetailVo(); //wdev-17444 if( Boolean.TRUE.equals(form.getLocalContext().getAuthoringInfoControlIsEnabled()) ) record.setAuthoringInformation(form.ccAuthoringInfo().getValue()); else record.setAuthoringInformation(form.getLocalContext().getLoggedInAuthoring()); //---------- record.setTreatmentIntervention(value); record.setTreatmentInterventionDescription(value.getTreatmentInterventionName()); if(Boolean.TRUE.equals(form.getLocalContext().getAddedDuringCoding())) { record.setAddedDuringCoding(true); } //WDEV-19058 record.setInterventionTreatmentComplete(YesNo.YES); return record; }
private boolean saveTreatmentIntervention(grdInterventionsTreatmentsRow row, boolean isChecked) { InterventionTreatmentDetailVo interventionTreatToSave = (InterventionTreatmentDetailVo) row.getValue(); interventionTreatToSave.setInterventionTreatmentComplete(isChecked ? YesNo.YES : YesNo.NO ); String[] errors = interventionTreatToSave.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { domain.saveInterventionTreatmentDetailVo(interventionTreatToSave); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); refresh(); return false; } return true; }
private String getListOfAddedTreatmentsInterventions() { if(form.grdSelected().getRows().size() == 0) return null; String listOfTreatmentsInterventionsAllreadyAdded = ""; for(int i=0; i<form.grdSelected().getRows().size(); i++) { grdSelectedRow parentRow = form.grdSelected().getRows().get(i); Object rowValue = form.grdSelected().getRows().get(i).getValue(); if(rowValue instanceof TreatmentInterventionType) { for(int j=0; j<parentRow.getRows().size(); j++) { Object childRowValue = parentRow.getRows().get(j).getValue(); if(childRowValue instanceof TreatmentInterventionLiteVo) { listOfTreatmentsInterventionsAllreadyAdded += (listOfTreatmentsInterventionsAllreadyAdded.length() == 0 ? "" : ",") + ((TreatmentInterventionLiteVo) childRowValue).getID_TreatmentIntervention(); } else if(childRowValue instanceof InterventionTreatmentDetailVo) { if(((InterventionTreatmentDetailVo) childRowValue).getTreatmentIntervention() != null) { listOfTreatmentsInterventionsAllreadyAdded += (listOfTreatmentsInterventionsAllreadyAdded.length() == 0 ? "" : ",") + ((InterventionTreatmentDetailVo) childRowValue).getTreatmentIntervention().getID_TreatmentIntervention(); } } } } } return listOfTreatmentsInterventionsAllreadyAdded.length() > 0 ? listOfTreatmentsInterventionsAllreadyAdded : null; }
private void populateSelectedGrid(InterventionTreatmentDetailVoCollection interventionTreatments) { form.grdSelected().getRows().clear(); if(interventionTreatments == null || interventionTreatments.size() == 0) return; for(InterventionTreatmentDetailVo intTreat : interventionTreatments) { addInterventionTreatmentDetailsRow(intTreat); } }
private void addInterventionTreatmentDetailsRow(InterventionTreatmentDetailVo intTreat) { if(intTreat == null) return; grdSelectedRow row = getSelectedParentRow(intTreat); if(row == null) return; grdSelectedRow childRow = row.getRows().newRow(); childRow.setColTreatmentIntervention(intTreat.getTreatmentInterventionDescription()); childRow.setValue(intTreat); }
@Override protected void onGrdSelectedSelectionChanged() { if(form.grdSelected().getValue() instanceof InterventionTreatmentDetailVo) { form.ccAuthoringInfo().setValue(((InterventionTreatmentDetailVo) form.grdSelected().getValue()).getAuthoringInformation()); } else { form.ccAuthoringInfo().initializeComponent(); } updateControlsState(); }
private InterventionTreatmentDetailVoCollection populateInterventionsTreatmentsFromScreen() { if(form.grdSelected().getRows().size() == 0) return null; InterventionTreatmentDetailVoCollection coll = new InterventionTreatmentDetailVoCollection(); for(int i=0; i<form.grdSelected().getRows().size(); i++) { if(form.grdSelected().getRows().get(i) == null) continue; for(int j=0; j<form.grdSelected().getRows().get(i).getRows().size(); j++) { if(form.grdSelected().getRows().get(i).getRows().get(j).getValue() instanceof InterventionTreatmentDetailVo) { coll.add((InterventionTreatmentDetailVo) form.grdSelected().getRows().get(i).getRows().get(j).getValue()); } else if(form.grdSelected().getRows().get(i).getRows().get(j).getValue() instanceof TreatmentInterventionLiteVo) { coll.add(createInterventionTreatmentDetail((TreatmentInterventionLiteVo) form.grdSelected().getRows().get(i).getRows().get(j).getValue())); } } } return coll; }
private void populateInterventionsTreatmentsGrid() { form.grdInterventionsTreatments().getRows().clear(); InterventionTreatmentDetailVoCollection coll = null; if(form.getGlobalContext().Emergency.getInterventionsTreatmentsForAttendence() != null) coll = form.getGlobalContext().Emergency.getInterventionsTreatmentsForAttendence().getInterventionTreatments(); if(coll == null || coll.size() == 0) return; if(Boolean.TRUE.equals(form.getLocalContext().getAddedDuringCoding())) coll.sort(); for(InterventionTreatmentDetailVo intTreat : coll) { if(intTreat == null) continue; grdInterventionsTreatmentsRow row = null; if(Boolean.FALSE.equals(form.getLocalContext().getAddedDuringCoding())) { row = getSelectedParentRow(intTreat); if(row == null) return; } grdInterventionsTreatmentsRow childRow = null; if (row == null) childRow = form.grdInterventionsTreatments().getRows().newRow(); else childRow = row.getRows().newRow(); childRow.setColIntervention(intTreat.getTreatmentInterventionDescription()); childRow.setValue(intTreat); } }
private void saveInterventionSequence() { InterventionsTreatmentsForAttendenceVo record = form.getGlobalContext().Emergency.getInterventionsTreatmentsForAttendence(); if(record == null || record.getInterventionTreatments() == null || record.getInterventionTreatments().size() == 0) return; //Need to save the sequence of Interventions for (int i = 0 ; i < form.grdInterventionsTreatments().getRows().size() ; i++) { InterventionTreatmentDetailVo interventionVo = (InterventionTreatmentDetailVo)form.grdInterventionsTreatments().getRows().get(i).getValue(); interventionVo.setCodingSequence(i); record.getInterventionTreatments().set(record.getInterventionTreatments().indexOf(interventionVo), interventionVo); } String[] errors = record.validate(); if(errors != null && errors.length >0) { engine.showErrors(errors); } try { domain.save(record); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getGlobalContext().Emergency.setInterventionsTreatmentsForAttendence(domain.getInterventionsTreatmentsForAttendence(form.getLocalContext().getCareContext())); } }
private InterventionTreatmentDetailVoCollection populateInterventionsTreatmentsFromScreen() { if(form.grdSelected().getRows().size() == 0) return null; InterventionTreatmentDetailVoCollection coll = new InterventionTreatmentDetailVoCollection(); for(int i=0; i<form.grdSelected().getRows().size(); i++) { if(form.grdSelected().getRows().get(i) == null) continue; for(int j=0; j<form.grdSelected().getRows().get(i).getRows().size(); j++) { if(form.grdSelected().getRows().get(i).getRows().get(j).getValue() instanceof InterventionTreatmentDetailVo) { //WDEV-19058 InterventionTreatmentDetailVo tempTreatInterv = (InterventionTreatmentDetailVo) form.grdSelected().getRows().get(i).getRows().get(j).getValue(); //tempTreatInterv.setInterventionTreatmentComplete(YesNo.YES); coll.add(tempTreatInterv); } else if(form.grdSelected().getRows().get(i).getRows().get(j).getValue() instanceof TreatmentInterventionLiteVo) { coll.add(createInterventionTreatmentDetail((TreatmentInterventionLiteVo) form.grdSelected().getRows().get(i).getRows().get(j).getValue())); } } } return coll; }
private void saveInterventionSequence() { InterventionsTreatmentsForAttendenceVo record = form.getGlobalContext().Emergency.getInterventionsTreatmentsForAttendence(); if(record == null || record.getInterventionTreatments() == null || record.getInterventionTreatments().size() == 0) return; //Need to save the sequence of Interventions for (int i = 0 ; i < form.grdInterventionsTreatments().getRows().size() ; i++) { InterventionTreatmentDetailVo interventionVo = (InterventionTreatmentDetailVo)form.grdInterventionsTreatments().getRows().get(i).getValue(); interventionVo.setCodingSequence(i); record.getInterventionTreatments().set(record.getInterventionTreatments().indexOf(interventionVo), interventionVo); } String[] errors = record.validate(); if(errors != null && errors.length >0) { engine.showErrors(errors); } try { domain.save(record, null, form.getLocalContext().getAddedDuringCoding()); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getGlobalContext().Emergency.setInterventionsTreatmentsForAttendence(domain.getInterventionsTreatmentsForAttendence(form.getLocalContext().getCareContext())); } }
public InterventionTreatmentDetailVo saveInterventionTreatmentDetailVo(InterventionTreatmentDetailVo interventionTreatToSave) throws StaleObjectException { if(interventionTreatToSave == null) throw new CodingRuntimeException("Cannot save a null InterventionTreatmentDetailVo."); DomainFactory factory = getDomainFactory(); InterventionTreatmentDetail doIntervTreat = InterventionTreatmentDetailVoAssembler.extractInterventionTreatmentDetail(factory, interventionTreatToSave); factory.save(doIntervTreat); return InterventionTreatmentDetailVoAssembler.create(doIntervTreat); }
@Override protected void onBtnRemoveSelectedClick() throws ims.framework.exceptions.PresentationLogicException { if(form.grdSelected().getSelectedRow() != null) { grdSelectedRow parentRow = null; if(form.grdSelected().getSelectedRow().getValue() instanceof TreatmentInterventionLiteVo) { parentRow = getParentRowInSelectedGrid((TreatmentInterventionLiteVo) form.grdSelected().getSelectedRow().getValue()); } else if(form.grdSelected().getSelectedRow().getValue() instanceof InterventionTreatmentDetailVo) { parentRow = getSelectedParentRow((InterventionTreatmentDetailVo) form.grdSelected().getSelectedRow().getValue()); } form.grdSelected().removeSelectedRow(); if(parentRow != null && parentRow.getRows().size() == 0) { removeSelectedRow(parentRow); } } //WDEV-17533 if( form.grdSelected().getRows().size() == 0 ) { form.getLocalContext().setAuthoringInfoControlIsEnabled(true); } TreatmentInterventionType type = null; if(!ALL_TYPE.equals(form.cmbTreatmentType().getValue())) { type = form.cmbTreatmentType().getValue(); } populateHotlistTreatmentInterventions(domain.listTreatmentsInterventionsFromHotlist(getListOfAddedTreatmentsInterventions(), type)); form.ccAuthoringInfo().initializeComponent(); updateControlsState(); }
private boolean removeTreatmentIntervention() { InterventionsTreatmentsForAttendenceVo record = form.getGlobalContext().Emergency.getInterventionsTreatmentsForAttendence(); if(record == null || record.getInterventionTreatments() == null || record.getInterventionTreatments().size() == 0) return false; if(!(form.grdInterventionsTreatments().getValue() instanceof InterventionTreatmentDetailVo)) return false; //WDEV-17648 if the sequence was changed, do an update if (form.getLocalContext().getInterventionSequenceChanged()) { for (int x = 0; x < form.grdInterventionsTreatments().getRows().size(); x++) { InterventionTreatmentDetailVo interventionVo = (InterventionTreatmentDetailVo) form.grdInterventionsTreatments().getRows().get(x).getValue(); interventionVo.setCodingSequence(x); record.getInterventionTreatments().set(record.getInterventionTreatments().indexOf(interventionVo), interventionVo); } form.getLocalContext().setInterventionSequenceChanged(false); } InterventionTreatmentDetailVo treatmenttoRemove = (InterventionTreatmentDetailVo) form.grdInterventionsTreatments().getValue(); record.getInterventionTreatments().remove(treatmenttoRemove); String[] errors = record.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { form.getGlobalContext().Emergency.setInterventionsTreatmentsForAttendence(domain.save(record)); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getGlobalContext().Emergency.setInterventionsTreatmentsForAttendence(domain.getInterventionsTreatmentsForAttendence(form.getLocalContext().getCareContext())); populateInterventionsTreatmentsGrid(); return false; } return true; }
private void populateInterventionsTreatmentsGrid() { form.chkNoneInterventions().setValue(form.getLocalContext().getAttendDiagInvTreatStatus() != null && Boolean.TRUE.equals(form.getLocalContext().getAttendDiagInvTreatStatus().getNoTreatments())); form.chkNoKnownInterventions().setValue(form.getLocalContext().getAttendDiagInvTreatStatus() != null && Boolean.TRUE.equals(form.getLocalContext().getAttendDiagInvTreatStatus().getTreatmentsNotRecorded())); form.lblNoKnownInterventions().setTooltip(getNoKnownInterventionsTreatmentsDetails(form.getLocalContext().getAttendDiagInvTreatStatus())); form.grdInterventionsTreatments().getRows().clear(); InterventionTreatmentDetailVoCollection coll = null; if(form.getGlobalContext().Emergency.getInterventionsTreatmentsForAttendence() != null) coll = form.getGlobalContext().Emergency.getInterventionsTreatmentsForAttendence().getInterventionTreatments(); if(coll == null || coll.size() == 0) return; if(Boolean.TRUE.equals(form.getLocalContext().getAddedDuringCoding())) coll.sort(); for(InterventionTreatmentDetailVo intTreat : coll) { if(intTreat == null) continue; if(Boolean.FALSE.equals(form.getLocalContext().getAddedDuringCoding()) && Boolean.TRUE.equals(intTreat.getAddedDuringCoding())) continue; grdInterventionsTreatmentsRow row = null; if(Boolean.FALSE.equals(form.getLocalContext().getAddedDuringCoding())) { row = getSelectedParentRow(intTreat); if(row == null) return; } grdInterventionsTreatmentsRow childRow = null; if (row == null) childRow = form.grdInterventionsTreatments().getRows().newRow(); else childRow = row.getRows().newRow(); childRow.setColIntervention(intTreat.getTreatmentInterventionDescription()); childRow.setColComplete(YesNo.YES.equals(intTreat.getInterventionTreatmentComplete()) ? true : false); //WDEV-19058 childRow.setValue(intTreat); } }
private boolean removeTreatmentIntervention() { InterventionsTreatmentsForAttendenceVo record = form.getGlobalContext().Emergency.getInterventionsTreatmentsForAttendence(); if(record == null || record.getInterventionTreatments() == null || record.getInterventionTreatments().size() == 0) return false; if(!(form.grdInterventionsTreatments().getValue() instanceof InterventionTreatmentDetailVo)) return false; //WDEV-17648 if the sequence was changed, do an update if (form.getLocalContext().getInterventionSequenceChanged()) { for (int x = 0; x < form.grdInterventionsTreatments().getRows().size(); x++) { InterventionTreatmentDetailVo interventionVo = (InterventionTreatmentDetailVo) form.grdInterventionsTreatments().getRows().get(x).getValue(); interventionVo.setCodingSequence(x); record.getInterventionTreatments().set(record.getInterventionTreatments().indexOf(interventionVo), interventionVo); } form.getLocalContext().setInterventionSequenceChanged(false); } InterventionTreatmentDetailVo treatmenttoRemove = (InterventionTreatmentDetailVo) form.grdInterventionsTreatments().getValue(); record.getInterventionTreatments().remove(treatmenttoRemove); String[] errors = record.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { form.getGlobalContext().Emergency.setInterventionsTreatmentsForAttendence(domain.save(record, ((record.getInterventionTreatments() == null || record.getInterventionTreatments().size() == 0) ? populateAttendDiagInvTreatStatus(null, null, null, null, false, true) : null), form.getLocalContext().getAddedDuringCoding())); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getGlobalContext().Emergency.setInterventionsTreatmentsForAttendence(domain.getInterventionsTreatmentsForAttendence(form.getLocalContext().getCareContext())); populateInterventionsTreatmentsGrid(); return false; } return true; }