@Test public void getFilteredFields() { assertThat(csvExportStrategy.getFieldNames(new MetadataNode[]{mock(MetadataNode.class)}, Collections.singletonList("authors")), hasSize(1)); }
@Override public List<FieldInfo<?>> getFieldNames(final MetadataNode[] metadataNodes, final Collection<String> selectedFieldIds) { final Stream<FieldInfo<?>> metadataStream = Arrays.stream(metadataNodes) .filter(metadataNode -> selected(selectedFieldIds, metadataNode.getName())) .map(this::metadataNodeToFieldInfo); final Stream<FieldInfo<?>> nonMetadataStream = getFieldsInfo().getFieldConfig() .values() .stream() .filter(fieldInfo -> selected(selectedFieldIds, fieldInfo.getId())) .map(this::populateMissingDisplayNames); return Stream.concat(metadataStream, nonMetadataStream).collect(Collectors.toList()); }
CsvExportStrategy implements PlatformDataExportStrategy { @Override public List<FieldInfo<?>> getFieldNames(final MetadataNode[] metadataNodes, final Collection<String> selectedFieldIds) { final Stream<FieldInfo<?>> metadataStream = Arrays.stream(metadataNodes) .filter(metadataNode -> selected(selectedFieldIds, metadataNode.getName())) .map(this::metadataNodeToFieldInfo); final Stream<FieldInfo<?>> nonMetadataStream = getFieldsInfo().getFieldConfig() .values() .stream() .filter(fieldInfo -> selected(selectedFieldIds, fieldInfo.getId())) .map(this::populateMissingDisplayNames); return Stream.concat(metadataStream, nonMetadataStream).collect(Collectors.toList()); } }
CsvExportStrategy implements PlatformDataExportStrategy { @Override public List<FieldInfo<?>> getFieldNames(final MetadataNode[] metadataNodes, final Collection<String> selectedFieldIds) { final Stream<FieldInfo<?>> metadataStream = Arrays.stream(metadataNodes) .filter(metadataNode -> selected(selectedFieldIds, metadataNode.getName())) .map(this::metadataNodeToFieldInfo); final Stream<FieldInfo<?>> nonMetadataStream = getFieldsInfo().getFieldConfig() .values() .stream() .filter(fieldInfo -> selected(selectedFieldIds, fieldInfo.getId())) .map(this::populateMissingDisplayNames); return Stream.concat(metadataStream, nonMetadataStream).collect(Collectors.toList()); } @Autowired  CsvExportStrategy(final ConfigService<? extends HavenSearchCapable> configService,
                             final FieldPathNormaliser fieldPathNormaliser,
                             final FieldDisplayNameGenerator fieldDisplayNameGenerator); }
CsvExportStrategy implements PlatformDataExportStrategy { @Override public List<FieldInfo<?>> getFieldNames(final MetadataNode[] metadataNodes, final Collection<String> selectedFieldIds) { final Stream<FieldInfo<?>> metadataStream = Arrays.stream(metadataNodes) .filter(metadataNode -> selected(selectedFieldIds, metadataNode.getName())) .map(this::metadataNodeToFieldInfo); final Stream<FieldInfo<?>> nonMetadataStream = getFieldsInfo().getFieldConfig() .values() .stream() .filter(fieldInfo -> selected(selectedFieldIds, fieldInfo.getId())) .map(this::populateMissingDisplayNames); return Stream.concat(metadataStream, nonMetadataStream).collect(Collectors.toList()); } @Autowired  CsvExportStrategy(final ConfigService<? extends HavenSearchCapable> configService,
                             final FieldPathNormaliser fieldPathNormaliser,
                             final FieldDisplayNameGenerator fieldDisplayNameGenerator); @Override void writeHeader(final OutputStream outputStream, final Collection<FieldInfo<?>> fieldNames); @Override List<FieldInfo<?>> getFieldNames(final MetadataNode[] metadataNodes, final Collection<String> selectedFieldIds); @Override Map<String, FieldInfo<?>> getConfiguredFieldsById(); @Override Optional<FieldInfo<Serializable>> getFieldInfoForMetadataNode(final String nodeName, final Map<String, ? extends MetadataNode> metadataNodes, final Collection<String> selectedFieldIds); @SuppressWarnings({"unchecked", "rawtypes"}) @Override Optional<FieldInfo<?>> getFieldInfoForNode(final String nodeName, final Collection<String> selectedFieldIds); @Override String getDisplayValue(final FieldInfo<?> fieldInfo, final T value); @Override void exportRecord(final OutputStream outputStream, final Iterable<String> values); @Override // CAUTION: Method has more than one exit point. String combineValues(final List<String> maybeValues); @Override ExportFormat getExportFormat(); }
CsvExportStrategy implements PlatformDataExportStrategy { @Override public List<FieldInfo<?>> getFieldNames(final MetadataNode[] metadataNodes, final Collection<String> selectedFieldIds) { final Stream<FieldInfo<?>> metadataStream = Arrays.stream(metadataNodes) .filter(metadataNode -> selected(selectedFieldIds, metadataNode.getName())) .map(this::metadataNodeToFieldInfo); final Stream<FieldInfo<?>> nonMetadataStream = getFieldsInfo().getFieldConfig() .values() .stream() .filter(fieldInfo -> selected(selectedFieldIds, fieldInfo.getId())) .map(this::populateMissingDisplayNames); return Stream.concat(metadataStream, nonMetadataStream).collect(Collectors.toList()); } @Autowired  CsvExportStrategy(final ConfigService<? extends HavenSearchCapable> configService,
                             final FieldPathNormaliser fieldPathNormaliser,
                             final FieldDisplayNameGenerator fieldDisplayNameGenerator); @Override void writeHeader(final OutputStream outputStream, final Collection<FieldInfo<?>> fieldNames); @Override List<FieldInfo<?>> getFieldNames(final MetadataNode[] metadataNodes, final Collection<String> selectedFieldIds); @Override Map<String, FieldInfo<?>> getConfiguredFieldsById(); @Override Optional<FieldInfo<Serializable>> getFieldInfoForMetadataNode(final String nodeName, final Map<String, ? extends MetadataNode> metadataNodes, final Collection<String> selectedFieldIds); @SuppressWarnings({"unchecked", "rawtypes"}) @Override Optional<FieldInfo<?>> getFieldInfoForNode(final String nodeName, final Collection<String> selectedFieldIds); @Override String getDisplayValue(final FieldInfo<?> fieldInfo, final T value); @Override void exportRecord(final OutputStream outputStream, final Iterable<String> values); @Override // CAUTION: Method has more than one exit point. String combineValues(final List<String> maybeValues); @Override ExportFormat getExportFormat();  }