@Test public void configureModel_fragment() { FragmentRequest fragRequest = new FragmentRequest("kenyaemr", "test"); FragmentContext fragContext = new FragmentContext(fragRequest, pageContext); configurator.configureModel(fragContext); Assert.assertThat(fragContext.getModel(), hasEntry("kenyaEmrUi", (Object) kenyaEmrUi)); }
@Override public void configureModel(PageContext pageContext) { String patientId = pageContext.getRequest().getRequest().getParameter("patientId"); String visitId = pageContext.getRequest().getRequest().getParameter("visitId"); String encounterId = pageContext.getRequest().getRequest().getParameter("encounterId"); Patient currentPatient = null; Visit currentVisit = null, activeVisit = null; if (!StringUtils.isEmpty(patientId)) { currentPatient = patientFromParam(patientId); } if (!StringUtils.isEmpty(visitId)) { currentVisit = visitFromParam(visitId); if (currentVisit != null) { if (currentPatient == null) { currentPatient = currentVisit.getPatient(); } if (!currentPatient.equals(currentVisit.getPatient())) { throw new RuntimeException("Mismatch between patient and visit request parameters"); } } } if (currentPatient != null) { activeVisit = getActiveVisit(currentPatient); } if (!StringUtils.isEmpty(encounterId)) { Encounter currentEncounter = encounterFromParam(encounterId); if (currentEncounter != null) { currentPatient = currentEncounter.getPatient(); currentVisit = currentEncounter.getVisit(); } } pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_CURRENT_PATIENT, currentPatient); pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_CURRENT_VISIT, currentVisit); pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_ACTIVE_VISIT, activeVisit); pageContext.getModel().addAttribute("kenyaEmrUi", kenyaEmrUiUtils); }
EmrModelConfigurator implements PageModelConfigurator, FragmentModelConfigurator { @Override public void configureModel(PageContext pageContext) { String patientId = pageContext.getRequest().getRequest().getParameter("patientId"); String visitId = pageContext.getRequest().getRequest().getParameter("visitId"); String encounterId = pageContext.getRequest().getRequest().getParameter("encounterId"); Patient currentPatient = null; Visit currentVisit = null, activeVisit = null; if (!StringUtils.isEmpty(patientId)) { currentPatient = patientFromParam(patientId); } if (!StringUtils.isEmpty(visitId)) { currentVisit = visitFromParam(visitId); if (currentVisit != null) { if (currentPatient == null) { currentPatient = currentVisit.getPatient(); } if (!currentPatient.equals(currentVisit.getPatient())) { throw new RuntimeException("Mismatch between patient and visit request parameters"); } } } if (currentPatient != null) { activeVisit = getActiveVisit(currentPatient); } if (!StringUtils.isEmpty(encounterId)) { Encounter currentEncounter = encounterFromParam(encounterId); if (currentEncounter != null) { currentPatient = currentEncounter.getPatient(); currentVisit = currentEncounter.getVisit(); } } pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_CURRENT_PATIENT, currentPatient); pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_CURRENT_VISIT, currentVisit); pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_ACTIVE_VISIT, activeVisit); pageContext.getModel().addAttribute("kenyaEmrUi", kenyaEmrUiUtils); } }
EmrModelConfigurator implements PageModelConfigurator, FragmentModelConfigurator { @Override public void configureModel(PageContext pageContext) { String patientId = pageContext.getRequest().getRequest().getParameter("patientId"); String visitId = pageContext.getRequest().getRequest().getParameter("visitId"); String encounterId = pageContext.getRequest().getRequest().getParameter("encounterId"); Patient currentPatient = null; Visit currentVisit = null, activeVisit = null; if (!StringUtils.isEmpty(patientId)) { currentPatient = patientFromParam(patientId); } if (!StringUtils.isEmpty(visitId)) { currentVisit = visitFromParam(visitId); if (currentVisit != null) { if (currentPatient == null) { currentPatient = currentVisit.getPatient(); } if (!currentPatient.equals(currentVisit.getPatient())) { throw new RuntimeException("Mismatch between patient and visit request parameters"); } } } if (currentPatient != null) { activeVisit = getActiveVisit(currentPatient); } if (!StringUtils.isEmpty(encounterId)) { Encounter currentEncounter = encounterFromParam(encounterId); if (currentEncounter != null) { currentPatient = currentEncounter.getPatient(); currentVisit = currentEncounter.getVisit(); } } pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_CURRENT_PATIENT, currentPatient); pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_CURRENT_VISIT, currentVisit); pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_ACTIVE_VISIT, activeVisit); pageContext.getModel().addAttribute("kenyaEmrUi", kenyaEmrUiUtils); }  }
EmrModelConfigurator implements PageModelConfigurator, FragmentModelConfigurator { @Override public void configureModel(PageContext pageContext) { String patientId = pageContext.getRequest().getRequest().getParameter("patientId"); String visitId = pageContext.getRequest().getRequest().getParameter("visitId"); String encounterId = pageContext.getRequest().getRequest().getParameter("encounterId"); Patient currentPatient = null; Visit currentVisit = null, activeVisit = null; if (!StringUtils.isEmpty(patientId)) { currentPatient = patientFromParam(patientId); } if (!StringUtils.isEmpty(visitId)) { currentVisit = visitFromParam(visitId); if (currentVisit != null) { if (currentPatient == null) { currentPatient = currentVisit.getPatient(); } if (!currentPatient.equals(currentVisit.getPatient())) { throw new RuntimeException("Mismatch between patient and visit request parameters"); } } } if (currentPatient != null) { activeVisit = getActiveVisit(currentPatient); } if (!StringUtils.isEmpty(encounterId)) { Encounter currentEncounter = encounterFromParam(encounterId); if (currentEncounter != null) { currentPatient = currentEncounter.getPatient(); currentVisit = currentEncounter.getVisit(); } } pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_CURRENT_PATIENT, currentPatient); pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_CURRENT_VISIT, currentVisit); pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_ACTIVE_VISIT, activeVisit); pageContext.getModel().addAttribute("kenyaEmrUi", kenyaEmrUiUtils); }  @Override void configureModel(PageContext pageContext); @Override void configureModel(FragmentContext fragmentContext); }
EmrModelConfigurator implements PageModelConfigurator, FragmentModelConfigurator { @Override public void configureModel(PageContext pageContext) { String patientId = pageContext.getRequest().getRequest().getParameter("patientId"); String visitId = pageContext.getRequest().getRequest().getParameter("visitId"); String encounterId = pageContext.getRequest().getRequest().getParameter("encounterId"); Patient currentPatient = null; Visit currentVisit = null, activeVisit = null; if (!StringUtils.isEmpty(patientId)) { currentPatient = patientFromParam(patientId); } if (!StringUtils.isEmpty(visitId)) { currentVisit = visitFromParam(visitId); if (currentVisit != null) { if (currentPatient == null) { currentPatient = currentVisit.getPatient(); } if (!currentPatient.equals(currentVisit.getPatient())) { throw new RuntimeException("Mismatch between patient and visit request parameters"); } } } if (currentPatient != null) { activeVisit = getActiveVisit(currentPatient); } if (!StringUtils.isEmpty(encounterId)) { Encounter currentEncounter = encounterFromParam(encounterId); if (currentEncounter != null) { currentPatient = currentEncounter.getPatient(); currentVisit = currentEncounter.getVisit(); } } pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_CURRENT_PATIENT, currentPatient); pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_CURRENT_VISIT, currentVisit); pageContext.getModel().addAttribute(EmrWebConstants.MODEL_ATTR_ACTIVE_VISIT, activeVisit); pageContext.getModel().addAttribute("kenyaEmrUi", kenyaEmrUiUtils); }  @Override void configureModel(PageContext pageContext); @Override void configureModel(FragmentContext fragmentContext);  }