Commit 7066de30 authored by Gerrit Hübbers's avatar Gerrit Hübbers 🃏
Browse files

Rename BundleSetSource to BundlesSetSource. And rename BundleStreamSource to BundlesStreamSource.

parent 24c2dc08
......@@ -33,6 +33,10 @@ Before you can build this project, you must install and configure the following
1. [Node.js][]: We use Node to run a development web server and build the project.
Depending on your system, you can install Node either from source or as a pre-packaged bundle.
DDA was generated with jHipster 2.27.1. If you want to extend the DDA source code base with additional jHipster entities, you will need exactly that version:
npm install -g yo
npm install -g generator-jhipster@2.27.1
We use [Grunt][] as our build system. Install the grunt command-line tool globally with:
......
......@@ -2,6 +2,6 @@ package org.gesis.dda.publishing.domain;
import java.util.Set;
public interface BundleSetSource {
Set<Bundle> getBundleSet();
public interface BundlesSetSource {
Set<Bundle> getBundlesSet();
}
......@@ -2,6 +2,6 @@ package org.gesis.dda.publishing.domain;
import java.util.stream.Stream;
public interface BundleStreamSource {
Stream<Bundle> getBundleStream();
public interface BundlesStreamSource {
Stream<Bundle> getBundlesStream();
}
......@@ -17,7 +17,7 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.BundleSetSource;
import org.gesis.dda.publishing.domain.BundlesSetSource;
import org.gesis.dda.publishing.domain.Metadatum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -25,16 +25,16 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
public abstract class AbstractTemplateExcelSheetBundlesSource implements BundleSetSource {
private final static Logger log = LoggerFactory.getLogger(AbstractTemplateExcelSheetBundlesSource.class);
public abstract class AbstractTemplateExcelSheetBundlesSetSource implements BundlesSetSource {
private final static Logger log = LoggerFactory.getLogger(AbstractTemplateExcelSheetBundlesSetSource.class);
protected Sheet sheet;
protected AbstractTemplateExcelSheetBundlesSource(Sheet sheet) {
protected AbstractTemplateExcelSheetBundlesSetSource(Sheet sheet) {
this.sheet = sheet;
}
@Override
public Set<Bundle> getBundleSet() {
public Set<Bundle> getBundlesSet() {
Set<Bundle> bundles = new HashSet<>();
for (Row row : sheet) {
if ( isValidRow(row) ) {
......@@ -92,7 +92,7 @@ public abstract class AbstractTemplateExcelSheetBundlesSource implements BundleS
if (isNotBlank(rawValues) ) {
Arrays.stream( rawValues.split(delimiterRegex) )
.filter(StringUtils::isNotBlank)
.map(AbstractTemplateExcelSheetBundlesSource::sanitizeString)
.map(AbstractTemplateExcelSheetBundlesSetSource::sanitizeString)
.map(validValue -> new SimpleMetadatum(key, validValue) )
.forEach( metadataBuilder::add );
}
......
......@@ -8,11 +8,11 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableSet.Builder;
public class CollectionSheetBundlesSource extends AbstractTemplateExcelSheetBundlesSource {
public class CollectionSheetBundlesSetSource extends AbstractTemplateExcelSheetBundlesSetSource {
private final static Logger log = LoggerFactory.getLogger(CollectionSheetBundlesSource.class);
private final static Logger log = LoggerFactory.getLogger(CollectionSheetBundlesSetSource.class);
public CollectionSheetBundlesSource(Sheet journalArticleSheet) {
public CollectionSheetBundlesSetSource(Sheet journalArticleSheet) {
super(journalArticleSheet);
}
......
......@@ -12,27 +12,27 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.BundleSetSource;
import org.gesis.dda.publishing.domain.BundlesSetSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExcelSpreadsheetBundleSetSource implements BundleSetSource {
private final static Logger log = LoggerFactory.getLogger(ExcelSpreadsheetBundleSetSource.class);
public class ExcelSpreadsheetBundlesSetSource implements BundlesSetSource {
private final static Logger log = LoggerFactory.getLogger(ExcelSpreadsheetBundlesSetSource.class);
private InputStream is;
public ExcelSpreadsheetBundleSetSource(InputStream excelInputStream) {
public ExcelSpreadsheetBundlesSetSource(InputStream excelInputStream) {
this.is = excelInputStream;
}
@Override
public Set<Bundle> getBundleSet() {
public Set<Bundle> getBundlesSet() {
try ( Workbook wb = WorkbookFactory.create(is) ) {
Set<Bundle> bundles = StreamSupport.stream(wb.spliterator(), true) // From wb, create a Stream of Sheets
.map(SmartExcelSheetBundleSetSource::new)
.map(SmartExcelSheetBundlesSetSource::new)
.filter(Objects::nonNull)
.map(BundleSetSource::getBundleSet) // get the actual bundles as a Set<Metadatum>
.map(BundlesSetSource::getBundlesSet) // get the actual bundles as a Set<Metadatum>
.flatMap(Set::stream) // flatten these Sets of metadata to a single set of metadata
.collect( Collectors.toSet() );
......
......@@ -8,11 +8,11 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableSet.Builder;
public class InCollectionSheetBundlesSource extends AbstractTemplateExcelSheetBundlesSource {
public class InCollectionSheetBundlesSetSource extends AbstractTemplateExcelSheetBundlesSetSource {
private final static Logger log = LoggerFactory.getLogger(InCollectionSheetBundlesSource.class);
private final static Logger log = LoggerFactory.getLogger(InCollectionSheetBundlesSetSource.class);
protected InCollectionSheetBundlesSource(Sheet journalArticleSheet) {
protected InCollectionSheetBundlesSetSource(Sheet journalArticleSheet) {
super(journalArticleSheet);
}
......
......@@ -8,11 +8,11 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableSet.Builder;
public class JournalArticleSheetBundlesSource extends AbstractTemplateExcelSheetBundlesSource {
public class JournalArticleSheetBundlesSetSource extends AbstractTemplateExcelSheetBundlesSetSource {
private final static Logger log = LoggerFactory.getLogger(JournalArticleSheetBundlesSource.class);
private final static Logger log = LoggerFactory.getLogger(JournalArticleSheetBundlesSetSource.class);
protected JournalArticleSheetBundlesSource(Sheet journalArticleSheet) {
protected JournalArticleSheetBundlesSetSource(Sheet journalArticleSheet) {
super(journalArticleSheet);
}
......
......@@ -11,7 +11,7 @@ import org.gesis.dda.harvester.oaipmh.impl.HarvestSpecification;
import org.gesis.dda.harvester.oaipmh.impl.HarvestSpecificationBuilder;
import org.gesis.dda.harvester.oaipmh.impl.HarvestingIntervalType;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.BundleStreamSource;
import org.gesis.dda.publishing.domain.BundlesStreamSource;
import org.gesis.dda.publishing.domain.Metadatum;
import org.gesis.yoai.client.OaiClient;
import org.gesis.yoai.client.impl.ApacheHttpOaiClient;
......@@ -25,36 +25,36 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
public class KnownMetadataHarvestingOaiPmhBundleStreamSource implements BundleStreamSource {
public class KnownMetadataHarvestingOaiPmhBundlesStreamSource implements BundlesStreamSource {
private final static Logger log = LoggerFactory.getLogger(KnownMetadataHarvestingOaiPmhBundleStreamSource.class);
private final static Logger log = LoggerFactory.getLogger(KnownMetadataHarvestingOaiPmhBundlesStreamSource.class);
private final static Set<String> KNOWN_METADATA_PREFIXES = Sets.newHashSet("xoai", "oai_dc", "marcxml", "marc", "nlm");
private OaiClient oaiClient;
private HarvestSpecification spec;
public KnownMetadataHarvestingOaiPmhBundleStreamSource(String oaiPmhEndpoint) {
public KnownMetadataHarvestingOaiPmhBundlesStreamSource(String oaiPmhEndpoint) {
this.spec = new HarvestSpecificationBuilder().build();
oaiClient = new ApacheHttpOaiClient(oaiPmhEndpoint);
}
public KnownMetadataHarvestingOaiPmhBundleStreamSource(String oaiPmhEndpoint, LocalDate from, LocalDate until) {
public KnownMetadataHarvestingOaiPmhBundlesStreamSource(String oaiPmhEndpoint, LocalDate from, LocalDate until) {
this.spec = new HarvestSpecificationBuilder().withDayIntervalFromUntil(from, until).build();
oaiClient = new ApacheHttpOaiClient(oaiPmhEndpoint);
}
public KnownMetadataHarvestingOaiPmhBundleStreamSource(String oaiPmhEndpoint, Instant from, Instant until) {
public KnownMetadataHarvestingOaiPmhBundlesStreamSource(String oaiPmhEndpoint, Instant from, Instant until) {
this.spec = new HarvestSpecificationBuilder().withSecondIntervalFromUntil(from, until).build();
oaiClient = new ApacheHttpOaiClient(oaiPmhEndpoint);
}
public KnownMetadataHarvestingOaiPmhBundleStreamSource(String oaiPmhEndpoint, HarvestSpecification spec) {
public KnownMetadataHarvestingOaiPmhBundlesStreamSource(String oaiPmhEndpoint, HarvestSpecification spec) {
this.spec = spec;
oaiClient = new ApacheHttpOaiClient(oaiPmhEndpoint);
}
@Override
public Stream<Bundle> getBundleStream() {
public Stream<Bundle> getBundlesStream() {
Stream<Bundle> result;
Stream<Header> oaiCurrentHeadersResult;
......
......@@ -10,11 +10,11 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableSet.Builder;
public class MonographSheetBundlesSource extends AbstractTemplateExcelSheetBundlesSource {
public class MonographSheetBundlesSetSource extends AbstractTemplateExcelSheetBundlesSetSource {
private final static Logger log = LoggerFactory.getLogger(MonographSheetBundlesSource.class);
private final static Logger log = LoggerFactory.getLogger(MonographSheetBundlesSetSource.class);
public MonographSheetBundlesSource(Sheet monographSheet) {
public MonographSheetBundlesSetSource(Sheet monographSheet) {
super(monographSheet);
}
......
......@@ -9,7 +9,7 @@ import org.gesis.dda.harvester.oaipmh.impl.HarvestSpecification;
import org.gesis.dda.harvester.oaipmh.impl.HarvestSpecificationBuilder;
import org.gesis.dda.harvester.oaipmh.impl.HarvestingIntervalType;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.BundleStreamSource;
import org.gesis.dda.publishing.domain.BundlesStreamSource;
import org.gesis.dda.publishing.domain.Metadatum;
import org.gesis.yoai.client.OaiClient;
import org.gesis.yoai.client.impl.ApacheHttpOaiClient;
......@@ -17,34 +17,34 @@ import org.gesis.yoai.model.Record;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OaiPmhBundleStreamSource implements BundleStreamSource {
public class OaiPmhBundlesStreamSource implements BundlesStreamSource {
private final static Logger log = LoggerFactory.getLogger(OaiPmhBundleStreamSource.class);
private final static Logger log = LoggerFactory.getLogger(OaiPmhBundlesStreamSource.class);
private OaiClient oaiClient;
private HarvestSpecification spec;
public OaiPmhBundleStreamSource(String oaiPmhEndpoint) {
public OaiPmhBundlesStreamSource(String oaiPmhEndpoint) {
this.spec = new HarvestSpecificationBuilder().build();
oaiClient = new ApacheHttpOaiClient(oaiPmhEndpoint);
}
public OaiPmhBundleStreamSource(String oaiPmhEndpoint, LocalDate from, LocalDate until) {
public OaiPmhBundlesStreamSource(String oaiPmhEndpoint, LocalDate from, LocalDate until) {
this.spec = new HarvestSpecificationBuilder().withDayIntervalFromUntil(from, until).build();
oaiClient = new ApacheHttpOaiClient(oaiPmhEndpoint);
}
public OaiPmhBundleStreamSource(String oaiPmhEndpoint, Instant from, Instant until) {
public OaiPmhBundlesStreamSource(String oaiPmhEndpoint, Instant from, Instant until) {
this.spec = new HarvestSpecificationBuilder().withSecondIntervalFromUntil(from, until).build();
oaiClient = new ApacheHttpOaiClient(oaiPmhEndpoint);
}
public OaiPmhBundleStreamSource(String oaiPmhEndpoint, HarvestSpecification spec) {
public OaiPmhBundlesStreamSource(String oaiPmhEndpoint, HarvestSpecification spec) {
this.spec = spec;
oaiClient = new ApacheHttpOaiClient(oaiPmhEndpoint);
}
@Override
public Stream<Bundle> getBundleStream() {
public Stream<Bundle> getBundlesStream() {
Stream<Bundle> result;
Stream<Record> oaiResultBuilder = Stream.empty();
Stream<Record> oaiCurrentResult;
......
package org.gesis.dda.publishing.domain.impl;
import org.apache.poi.ss.usermodel.Sheet;
import org.gesis.dda.publishing.domain.BundleSetSource;
import org.gesis.dda.publishing.domain.BundlesSetSource;
public class SheetBundlesSourceFactory {
public class SheetBundlesSetSourceFactory {
public static BundleSetSource getBundlesSourceForSheet(Sheet sheet) {
public static BundlesSetSource getBundlesSourceForSheet(Sheet sheet) {
switch ( sheet.getSheetName() ) {
case "monograph": return new MonographSheetBundlesSource(sheet);
case "collection": return new CollectionSheetBundlesSource(sheet);
case "incollection": return new InCollectionSheetBundlesSource(sheet);
case "journal article": return new JournalArticleSheetBundlesSource(sheet);
case "monograph": return new MonographSheetBundlesSetSource(sheet);
case "collection": return new CollectionSheetBundlesSetSource(sheet);
case "incollection": return new InCollectionSheetBundlesSetSource(sheet);
case "journal article": return new JournalArticleSheetBundlesSetSource(sheet);
default: return null;
}
}
......
......@@ -15,18 +15,18 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.BundleSetSource;
import org.gesis.dda.publishing.domain.BundlesSetSource;
import org.gesis.dda.publishing.domain.Metadatum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SmartExcelSheetBundleSetSource implements BundleSetSource {
public class SmartExcelSheetBundlesSetSource implements BundlesSetSource {
private final static Logger log = LoggerFactory.getLogger(SmartExcelSheetBundleSetSource.class);
private final static Logger log = LoggerFactory.getLogger(SmartExcelSheetBundlesSetSource.class);
private Sheet sheet;
private Metadatum dcTypeStockMetadatum;
private Map<Integer, String> columnIndex2MetadatumKey = new HashMap<>();
public SmartExcelSheetBundleSetSource(Sheet sheet) {
public SmartExcelSheetBundlesSetSource(Sheet sheet) {
String sheetName = sheet.getSheetName();
switch (sheetName) {
......@@ -82,7 +82,7 @@ public class SmartExcelSheetBundleSetSource implements BundleSetSource {
return doesMatch;
}
@Override
public Set<Bundle> getBundleSet() {
public Set<Bundle> getBundlesSet() {
Set<Bundle> resultBundleSet = new HashSet<>();
Set< Map.Entry<Integer, String> > columnIndex2MetadatumSet = columnIndex2MetadatumKey.entrySet();
......@@ -264,7 +264,7 @@ public class SmartExcelSheetBundleSetSource implements BundleSetSource {
if (isNotBlank(rawValues) ) {
result = Arrays.stream( rawValues.split(delimiter) )
.filter(StringUtils::isNotBlank)
.map(SmartExcelSheetBundleSetSource::removeRedundantWhitespace)
.map(SmartExcelSheetBundlesSetSource::removeRedundantWhitespace)
.map(validValue -> new SimpleMetadatum(metadataKey, validValue) )
.collect( Collectors.toSet() );
}
......
......@@ -2,7 +2,7 @@ package org.gesis.dda.wizard.service;
import com.codahale.metrics.annotation.Timed;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.impl.ExcelSpreadsheetBundleSetSource;
import org.gesis.dda.publishing.domain.impl.ExcelSpreadsheetBundlesSetSource;
import org.gesis.dda.publishing.domain.impl.SsoarXmlWorkflowRepository;
import org.gesis.dda.wizard.security.SecurityUtils;
import org.slf4j.Logger;
......@@ -32,8 +32,8 @@ public class TemplateService {
public boolean validate(InputStream templateIs) {
log.debug("Importing Excel spreadsheet content into SSOAR");
ExcelSpreadsheetBundleSetSource bundlesSource = new ExcelSpreadsheetBundleSetSource(templateIs);
Set<Bundle> bundles = bundlesSource.getBundleSet();
ExcelSpreadsheetBundlesSetSource bundlesSource = new ExcelSpreadsheetBundlesSetSource(templateIs);
Set<Bundle> bundles = bundlesSource.getBundlesSet();
bundles.stream().map(Object::toString).forEach(log::info);
bundles.stream().forEach(ssoarXmlWorkflowRepository::addBundle);
......
......@@ -10,7 +10,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.BundleSetSource;
import org.gesis.dda.publishing.domain.BundlesSetSource;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -26,8 +26,8 @@ public class CollectionSheetBundlesSourceTest {
try ( Workbook wb = WorkbookFactory.create(exampleXlsFile, null, true) ) {
for (Sheet sheet : wb) {
if ( sheet.getSheetName().equals("collection") ) {
BundleSetSource bundlesSource = new CollectionSheetBundlesSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundleSet();
BundlesSetSource bundlesSource = new CollectionSheetBundlesSetSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundlesSet();
bundles.stream().forEach(bundle -> log.info( bundle.toString() ) );
}
......@@ -41,8 +41,8 @@ public class CollectionSheetBundlesSourceTest {
try ( Workbook wb = WorkbookFactory.create(exampleXlsFile, null, true) ) {
for (Sheet sheet : wb) {
if ( sheet.getSheetName().equals("collection") ) {
BundleSetSource bundlesSource = new CollectionSheetBundlesSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundleSet();
BundlesSetSource bundlesSource = new CollectionSheetBundlesSetSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundlesSet();
bundles.stream().forEach(bundle -> log.info( bundle.toString() ) );
}
......
......@@ -20,8 +20,8 @@ public class ExcelSpreadsheetBundleSetSourceTest {
public void retrieveBundlesFromOldTemplateVersion() {
InputStream oldTemplateExcelIs = getClass().getClassLoader().getResourceAsStream("csv_muster_import_dda_Beispieldokumente.xls");
log.info("{}", oldTemplateExcelIs);
ExcelSpreadsheetBundleSetSource underTest = new ExcelSpreadsheetBundleSetSource(oldTemplateExcelIs);
Set<Bundle> bundles = underTest.getBundleSet();
ExcelSpreadsheetBundlesSetSource underTest = new ExcelSpreadsheetBundlesSetSource(oldTemplateExcelIs);
Set<Bundle> bundles = underTest.getBundlesSet();
bundles.stream().map(Object::toString).forEach(log::info);
......@@ -56,8 +56,8 @@ public class ExcelSpreadsheetBundleSetSourceTest {
@Test
public void retrieveBundlesFromNewTemplateVersion() {
InputStream newTemplateExcelIs = getClass().getClassLoader().getResourceAsStream("DSA-OA2016-vollstaendig.xlsx");
ExcelSpreadsheetBundleSetSource underTest = new ExcelSpreadsheetBundleSetSource(newTemplateExcelIs);
Set<Bundle> bundles = underTest.getBundleSet();
ExcelSpreadsheetBundlesSetSource underTest = new ExcelSpreadsheetBundlesSetSource(newTemplateExcelIs);
Set<Bundle> bundles = underTest.getBundlesSet();
bundles.stream().map(Object::toString).forEach(log::info);
......
......@@ -10,7 +10,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.BundleSetSource;
import org.gesis.dda.publishing.domain.BundlesSetSource;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -26,8 +26,8 @@ public class InCollectionSheetBundlesSourceTest {
try ( Workbook wb = WorkbookFactory.create(exampleXlsFile, null, true) ) {
for (Sheet sheet : wb) {
if ( sheet.getSheetName().equals("incollection") ) {
BundleSetSource bundlesSource = new InCollectionSheetBundlesSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundleSet();
BundlesSetSource bundlesSource = new InCollectionSheetBundlesSetSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundlesSet();
bundles.stream().forEach(bundle -> log.info( bundle.toString() ) );
}
......@@ -41,8 +41,8 @@ public class InCollectionSheetBundlesSourceTest {
try ( Workbook wb = WorkbookFactory.create(exampleXlsFile, null, true) ) {
for (Sheet sheet : wb) {
if ( sheet.getSheetName().equals("incollection") ) {
BundleSetSource bundlesSource = new InCollectionSheetBundlesSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundleSet();
BundlesSetSource bundlesSource = new InCollectionSheetBundlesSetSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundlesSet();
bundles.stream().forEach(bundle -> log.info( bundle.toString() ) );
}
......
......@@ -10,7 +10,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.BundleSetSource;
import org.gesis.dda.publishing.domain.BundlesSetSource;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -26,8 +26,8 @@ public class JournalArticleSheetBundlesSourceTest {
try (Workbook wb = WorkbookFactory.create(exampleXlsFile, null, true)) {
for (Sheet sheet : wb) {
if ( sheet.getSheetName().equals("journal article") ) {
BundleSetSource bundlesSource = new JournalArticleSheetBundlesSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundleSet();
BundlesSetSource bundlesSource = new JournalArticleSheetBundlesSetSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundlesSet();
bundles.stream().forEach(bundle -> log.info( bundle.toString() ) );
}
......@@ -41,8 +41,8 @@ public class JournalArticleSheetBundlesSourceTest {
try (Workbook wb = WorkbookFactory.create(exampleXlsFile, null, true)) {
for (Sheet sheet : wb) {
if ( sheet.getSheetName().equals("journal article") ) {
BundleSetSource bundlesSource = new JournalArticleSheetBundlesSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundleSet();
BundlesSetSource bundlesSource = new JournalArticleSheetBundlesSetSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundlesSet();
bundles.stream().forEach(bundle -> log.info( bundle.toString() ) );
}
......
......@@ -12,7 +12,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.BundleSetSource;
import org.gesis.dda.publishing.domain.BundlesSetSource;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -28,8 +28,8 @@ public class MonographSheetBundlesSourceTest {
try ( Workbook wb = WorkbookFactory.create(exampleXlsFile, null, true) ) {
for (Sheet sheet : wb) {
if ( sheet.getSheetName().equals("monograph") ) {
BundleSetSource bundlesSource = new MonographSheetBundlesSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundleSet();
BundlesSetSource bundlesSource = new MonographSheetBundlesSetSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundlesSet();
bundles.stream().forEach(bundle -> log.info( bundle.toString() ) );
}
......@@ -43,8 +43,8 @@ public class MonographSheetBundlesSourceTest {
try ( Workbook wb = WorkbookFactory.create(exampleXlsFile, null, true) ) {
for (Sheet sheet : wb) {
if ( sheet.getSheetName().equals("monograph") ) {
BundleSetSource bundlesSource = new MonographSheetBundlesSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundleSet();
BundlesSetSource bundlesSource = new MonographSheetBundlesSetSource(sheet);
Set<Bundle> bundles = bundlesSource.getBundlesSet();
bundles.stream().forEach(bundle -> log.info( bundle.toString() ) );
}
......
......@@ -14,7 +14,7 @@ import java.util.stream.Stream;
import org.gesis.dda.harvester.oaipmh.impl.HarvestSpecification;
import org.gesis.dda.harvester.oaipmh.impl.HarvestSpecificationBuilder;
import org.gesis.dda.publishing.domain.BundleStreamSource;
import org.gesis.dda.publishing.domain.BundlesStreamSource;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -35,8 +35,8 @@ public class OaiPmhBundleStreamSourceTest {
.withMetadataPrefixes( ImmutableSet.of("oai_dc") )
.withDayIntervalFromUntil(LocalDate.parse("2016-08-02"), LocalDate.parse("2016-08-04") )
.build();
BundleStreamSource bundleSource = new OaiPmhBundleStreamSource(OAI_ENDPOINT, spec);
bundleSource.getBundleStream().map(Object::toString).forEach(log::info);
BundlesStreamSource bundleSource = new OaiPmhBundlesStreamSource(OAI_ENDPOINT, spec);
bundleSource.getBundlesStream().map(Object::toString).forEach(log::info);
}
@Test
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment