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; }
@Override protected void onCmbTreatmentTypeValueChanged() throws PresentationLogicException { TreatmentInterventionType type = null; if(!ALL_TYPE.equals(form.cmbTreatmentType().getValue())) { type = form.cmbTreatmentType().getValue(); } populateHotlistTreatmentInterventions(domain.listTreatmentsInterventionsFromHotlist(getListOfAddedTreatmentsInterventions(), type)); updateControlsState(); }
public ims.clinicaladmin.vo.TreatmentInterventionLiteVoCollection listTreatmentsInterventionsFromHotlist(String listOfTreatmentsInterventionsAllreadyAdded, TreatmentInterventionType type) { DomainFactory factory = getDomainFactory(); StringBuilder query = new StringBuilder("select ti from TreatmentInterventionHotlist as th left join th.hotListItem as titem left join titem.treatmentIntervention as ti left join th.specialty as sp left join ti.treatmentInterventionType as tType where sp.id = :Emergency and ti.isActive = 1 "); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); markers.add("Emergency"); values.add(Specialty.EMERGENCY.getID()); if(listOfTreatmentsInterventionsAllreadyAdded != null && listOfTreatmentsInterventionsAllreadyAdded.length() > 0) { query.append(" and ti.id not in (" + listOfTreatmentsInterventionsAllreadyAdded + ") "); } if(type != null) { query.append(" and tType.id = :TType "); markers.add("TType"); values.add(type.getID()); } query.append(" order by UPPER(tType.text) asc, UPPER(ti.treatmentInterventionName) asc"); List<?> tiList = factory.find(query.toString(), markers, values); return TreatmentInterventionLiteVoAssembler.createTreatmentInterventionLiteVoCollectionFromTreatmentIntervention(tiList); }
private String[] validateUIControls() { ArrayList<String> errors = new ArrayList<String>(); int emptyRowsNo = 0; if (form.grdSelected().getRows() == null || form.grdSelected().getRows().size() == 0) errors.add("At least one treatment/intervention is mandatory for selection"); else { for (int i=0; i<form.grdSelected().getRows().size(); i++) { if (form.grdSelected().getRows().get(i) == null) { emptyRowsNo++; continue; } if (form.grdSelected().getRows().get(i).getValue() instanceof TreatmentInterventionType && form.grdSelected().getRows().get(i).getRows().size() == 0) emptyRowsNo++; } if (emptyRowsNo > 0 && emptyRowsNo == form.grdSelected().getRows().size()) errors.add("At least one treatment/intervention is mandatory for selection"); } if (errors.size() != 0) // validate UI for Authoring Info, else they are validated in the VO { if (Boolean.TRUE.equals(form.getLocalContext().getAuthoringInfoControlIsEnabled()) && form.ccAuthoringInfo().getErrors() != null) errors.add(form.ccAuthoringInfo().getErrors()); } return errors.toArray(new String[errors.size()]); }
@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(); }