@Test public void processReordersAndDisablesSections() throws ComponentLookupException { when(this.studyObject.getListValue(SECTIONS_LABEL)).thenReturn(Arrays.asList("sectionB", "sectionA")); when(this.studyObject.getListValue(FIELDS_LABEL)) .thenReturn(Arrays.asList("elementB2", "elementB1", "elementA2")); Assert.assertSame(this.config, this.mocker.getComponentUnderTest().process(this.config)); verify(this.sectionA, never()).setEnabled(false); verify(this.elementA1).setEnabled(false); verify(this.elementA2, never()).setEnabled(false); verify(this.sectionA).setElements(Arrays.asList(this.elementA2, this.elementA1)); verify(this.sectionB, never()).setEnabled(false); verify(this.elementB1, never()).setEnabled(false); verify(this.elementB2, never()).setEnabled(false); verify(this.elementB3).setEnabled(false); verify(this.sectionB).setElements(Arrays.asList(this.elementB2, this.elementB1, this.elementB3)); verify(this.sectionC).setEnabled(false); }
@Override public RecordConfiguration process(RecordConfiguration config) { if (config == null) { return null; } final StudyConfiguration configObj = getBoundConfiguration(); if (configObj == null) { return config; } String customPhenotypeMapping = configObj.getPhenotypeMapping(); if (StringUtils.isNotBlank(customPhenotypeMapping)) { config.setPhenotypeMapping(this.referenceParser.resolve(customPhenotypeMapping)); } final List<String> sectionOverrides = configObj.getSectionsOverride(); final List<String> fieldOverrides = configObj.getFieldsOverride(); if (CollectionUtils.isEmpty(sectionOverrides) || CollectionUtils.isEmpty(fieldOverrides)) { return config; } updateStudyConfiguration(config, sectionOverrides, fieldOverrides); return config; }
StudyRecordConfigurationModule implements RecordConfigurationModule { @Override public RecordConfiguration process(RecordConfiguration config) { if (config == null) { return null; } final StudyConfiguration configObj = getBoundConfiguration(); if (configObj == null) { return config; } String customPhenotypeMapping = configObj.getPhenotypeMapping(); if (StringUtils.isNotBlank(customPhenotypeMapping)) { config.setPhenotypeMapping(this.referenceParser.resolve(customPhenotypeMapping)); } final List<String> sectionOverrides = configObj.getSectionsOverride(); final List<String> fieldOverrides = configObj.getFieldsOverride(); if (CollectionUtils.isEmpty(sectionOverrides) || CollectionUtils.isEmpty(fieldOverrides)) { return config; } updateStudyConfiguration(config, sectionOverrides, fieldOverrides); return config; } }
StudyRecordConfigurationModule implements RecordConfigurationModule { @Override public RecordConfiguration process(RecordConfiguration config) { if (config == null) { return null; } final StudyConfiguration configObj = getBoundConfiguration(); if (configObj == null) { return config; } String customPhenotypeMapping = configObj.getPhenotypeMapping(); if (StringUtils.isNotBlank(customPhenotypeMapping)) { config.setPhenotypeMapping(this.referenceParser.resolve(customPhenotypeMapping)); } final List<String> sectionOverrides = configObj.getSectionsOverride(); final List<String> fieldOverrides = configObj.getFieldsOverride(); if (CollectionUtils.isEmpty(sectionOverrides) || CollectionUtils.isEmpty(fieldOverrides)) { return config; } updateStudyConfiguration(config, sectionOverrides, fieldOverrides); return config; }  }
StudyRecordConfigurationModule implements RecordConfigurationModule { @Override public RecordConfiguration process(RecordConfiguration config) { if (config == null) { return null; } final StudyConfiguration configObj = getBoundConfiguration(); if (configObj == null) { return config; } String customPhenotypeMapping = configObj.getPhenotypeMapping(); if (StringUtils.isNotBlank(customPhenotypeMapping)) { config.setPhenotypeMapping(this.referenceParser.resolve(customPhenotypeMapping)); } final List<String> sectionOverrides = configObj.getSectionsOverride(); final List<String> fieldOverrides = configObj.getFieldsOverride(); if (CollectionUtils.isEmpty(sectionOverrides) || CollectionUtils.isEmpty(fieldOverrides)) { return config; } updateStudyConfiguration(config, sectionOverrides, fieldOverrides); return config; }  @Override RecordConfiguration process(RecordConfiguration config); @Override int getPriority(); @Override boolean supportsRecordType(String recordType); }
StudyRecordConfigurationModule implements RecordConfigurationModule { @Override public RecordConfiguration process(RecordConfiguration config) { if (config == null) { return null; } final StudyConfiguration configObj = getBoundConfiguration(); if (configObj == null) { return config; } String customPhenotypeMapping = configObj.getPhenotypeMapping(); if (StringUtils.isNotBlank(customPhenotypeMapping)) { config.setPhenotypeMapping(this.referenceParser.resolve(customPhenotypeMapping)); } final List<String> sectionOverrides = configObj.getSectionsOverride(); final List<String> fieldOverrides = configObj.getFieldsOverride(); if (CollectionUtils.isEmpty(sectionOverrides) || CollectionUtils.isEmpty(fieldOverrides)) { return config; } updateStudyConfiguration(config, sectionOverrides, fieldOverrides); return config; }  @Override RecordConfiguration process(RecordConfiguration config); @Override int getPriority(); @Override boolean supportsRecordType(String recordType); static final EntityReference STUDY_CLASS_REFERENCE; static final EntityReference STUDY_BINDING_CLASS_REFERENCE; static final String STUDY_REFERENCE_PROPERTY_LABEL; }