@Test public void processAddsAllSectionsToConfig() throws ComponentLookupException { final UIExtensionManager uixManager = this.mocker.getInstance(UIExtensionManager.class); final UIExtensionFilter orderFilter = this.mocker.getInstance(UIExtensionFilter.class, "sortByParameter"); final UIExtension extensionA = mock(UIExtension.class); final UIExtension extensionB = mock(UIExtension.class); final UIExtension extensionC = mock(UIExtension.class); final List<UIExtension> extensions = Arrays.asList(extensionA, extensionB, extensionC); final Map<String, String> param = new HashMap<>(); param.put(ENABLED_LABEL, TRUE_LABEL); param.put(EXPANDED_BY_DEFAULT_LABEL, TRUE_LABEL); when(uixManager.get("org.phenotips.patientSheet.content")).thenReturn(extensions); when(orderFilter.filter(extensions, SORT_PARAMETER_NAME)).thenReturn(extensions); final Map<String, String> paramA = new HashMap<>(param); paramA.put(TITLE_LABEL, SECTION_A_LABEL); when(extensionA.getParameters()).thenReturn(paramA); final Map<String, String> paramB = new HashMap<>(param); paramB.put(TITLE_LABEL, SECTION_B_LABEL); when(extensionB.getParameters()).thenReturn(paramB); final Map<String, String> paramC = new HashMap<>(param); paramC.put(TITLE_LABEL, SECTION_C_LABEL); when(extensionC.getParameters()).thenReturn(paramC); this.mocker.getComponentUnderTest().process(this.config); final List<String> sectionNames = Arrays.asList(SECTION_A_LABEL, SECTION_B_LABEL, SECTION_C_LABEL); final List<RecordSection> sections = this.sectionsCapture.getLastValue(); Assert.assertEquals(3, sections.size()); Assert.assertTrue(sectionNames.contains(sections.get(0).getName())); Assert.assertTrue(sectionNames.contains(sections.get(1).getName())); Assert.assertTrue(sectionNames.contains(sections.get(2).getName())); }
@Override public RecordConfiguration process(RecordConfiguration config) { if (config == null) { return null; } final List<UIExtension> sectionExtensions = getOrderedSectionUIExtensions(); final List<RecordSection> recordSections = new LinkedList<>(); for (final UIExtension sectionExtension : sectionExtensions) { final RecordSection section = new UIXRecordSection(sectionExtension, this.uixManager, this.orderFilter); recordSections.add(section); } config.setSections(recordSections); DocumentReference mapping = getPhenotypeMapping(); if (mapping != null) { config.setPhenotypeMapping(mapping); } String dobFormat = getDateOfBirthFormat(); if (StringUtils.isNotBlank(dobFormat)) { config.setDateOfBirthFormat(dobFormat); } return config; }
GlobalPatientRecordConfigurationModule implements RecordConfigurationModule { @Override public RecordConfiguration process(RecordConfiguration config) { if (config == null) { return null; } final List<UIExtension> sectionExtensions = getOrderedSectionUIExtensions(); final List<RecordSection> recordSections = new LinkedList<>(); for (final UIExtension sectionExtension : sectionExtensions) { final RecordSection section = new UIXRecordSection(sectionExtension, this.uixManager, this.orderFilter); recordSections.add(section); } config.setSections(recordSections); DocumentReference mapping = getPhenotypeMapping(); if (mapping != null) { config.setPhenotypeMapping(mapping); } String dobFormat = getDateOfBirthFormat(); if (StringUtils.isNotBlank(dobFormat)) { config.setDateOfBirthFormat(dobFormat); } return config; } }
GlobalPatientRecordConfigurationModule implements RecordConfigurationModule { @Override public RecordConfiguration process(RecordConfiguration config) { if (config == null) { return null; } final List<UIExtension> sectionExtensions = getOrderedSectionUIExtensions(); final List<RecordSection> recordSections = new LinkedList<>(); for (final UIExtension sectionExtension : sectionExtensions) { final RecordSection section = new UIXRecordSection(sectionExtension, this.uixManager, this.orderFilter); recordSections.add(section); } config.setSections(recordSections); DocumentReference mapping = getPhenotypeMapping(); if (mapping != null) { config.setPhenotypeMapping(mapping); } String dobFormat = getDateOfBirthFormat(); if (StringUtils.isNotBlank(dobFormat)) { config.setDateOfBirthFormat(dobFormat); } return config; }  }
GlobalPatientRecordConfigurationModule implements RecordConfigurationModule { @Override public RecordConfiguration process(RecordConfiguration config) { if (config == null) { return null; } final List<UIExtension> sectionExtensions = getOrderedSectionUIExtensions(); final List<RecordSection> recordSections = new LinkedList<>(); for (final UIExtension sectionExtension : sectionExtensions) { final RecordSection section = new UIXRecordSection(sectionExtension, this.uixManager, this.orderFilter); recordSections.add(section); } config.setSections(recordSections); DocumentReference mapping = getPhenotypeMapping(); if (mapping != null) { config.setPhenotypeMapping(mapping); } String dobFormat = getDateOfBirthFormat(); if (StringUtils.isNotBlank(dobFormat)) { config.setDateOfBirthFormat(dobFormat); } return config; }  @Override RecordConfiguration process(RecordConfiguration config); @Override int getPriority(); @Override boolean supportsRecordType(final String recordType); }
GlobalPatientRecordConfigurationModule implements RecordConfigurationModule { @Override public RecordConfiguration process(RecordConfiguration config) { if (config == null) { return null; } final List<UIExtension> sectionExtensions = getOrderedSectionUIExtensions(); final List<RecordSection> recordSections = new LinkedList<>(); for (final UIExtension sectionExtension : sectionExtensions) { final RecordSection section = new UIXRecordSection(sectionExtension, this.uixManager, this.orderFilter); recordSections.add(section); } config.setSections(recordSections); DocumentReference mapping = getPhenotypeMapping(); if (mapping != null) { config.setPhenotypeMapping(mapping); } String dobFormat = getDateOfBirthFormat(); if (StringUtils.isNotBlank(dobFormat)) { config.setDateOfBirthFormat(dobFormat); } return config; }  @Override RecordConfiguration process(RecordConfiguration config); @Override int getPriority(); @Override boolean supportsRecordType(final String recordType);  }