diff --git a/src/main/java/nl/knaw/dans/dvingest/BagProcessorFactoryImpl.java b/src/main/java/nl/knaw/dans/dvingest/BagProcessorFactoryImpl.java new file mode 100644 index 0000000..510566f --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/BagProcessorFactoryImpl.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest; + +import io.dropwizard.configuration.ConfigurationException; +import lombok.AllArgsConstructor; +import nl.knaw.dans.dvingest.core.DataverseIngestBag; +import nl.knaw.dans.dvingest.core.bagprocessor.BagProcessor; +import nl.knaw.dans.dvingest.core.bagprocessor.BagProcessorFactory; +import nl.knaw.dans.dvingest.core.service.DataverseService; +import nl.knaw.dans.dvingest.core.service.UtilityServices; + +import java.io.IOException; +import java.util.UUID; + +@AllArgsConstructor +public class BagProcessorFactoryImpl implements BagProcessorFactory { + private final DataverseService dataverseService; + private final UtilityServices utilityServices; + + @Override + public BagProcessor createBagProcessor(UUID depositId, DataverseIngestBag bag) throws ConfigurationException, IOException { + return BagProcessor.builder() + .depositId(depositId) + .bag(bag) + .dataverseService(dataverseService) + .utilityServices(utilityServices) + .build(); + } +} diff --git a/src/main/java/nl/knaw/dans/dvingest/DansDepositSupportDisabledFactory.java b/src/main/java/nl/knaw/dans/dvingest/DansDepositSupportDisabledFactory.java new file mode 100644 index 0000000..990bc24 --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/DansDepositSupportDisabledFactory.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest; + +import nl.knaw.dans.dvingest.core.DataverseIngestDeposit; +import nl.knaw.dans.dvingest.core.Deposit; +import nl.knaw.dans.dvingest.core.dansbag.DansDepositSupportFactory; + +public class DansDepositSupportDisabledFactory implements DansDepositSupportFactory { + @Override + public Deposit addDansDepositSupportIfEnabled(DataverseIngestDeposit deposit) { + return deposit; + } +} diff --git a/src/main/java/nl/knaw/dans/dvingest/core/DepositInboxTaskFactory.java b/src/main/java/nl/knaw/dans/dvingest/DansDepositSupportFactoryImpl.java similarity index 64% rename from src/main/java/nl/knaw/dans/dvingest/core/DepositInboxTaskFactory.java rename to src/main/java/nl/knaw/dans/dvingest/DansDepositSupportFactoryImpl.java index ce2f7d1..176c176 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/DepositInboxTaskFactory.java +++ b/src/main/java/nl/knaw/dans/dvingest/DansDepositSupportFactoryImpl.java @@ -13,31 +13,29 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package nl.knaw.dans.dvingest.core; +package nl.knaw.dans.dvingest; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import nl.knaw.dans.dvingest.client.ValidateDansBagService; +import nl.knaw.dans.dvingest.core.DataverseIngestDeposit; +import nl.knaw.dans.dvingest.core.Deposit; import nl.knaw.dans.dvingest.core.dansbag.DansBagMappingService; +import nl.knaw.dans.dvingest.core.dansbag.DansDepositSupport; +import nl.knaw.dans.dvingest.core.dansbag.DansDepositSupportFactory; import nl.knaw.dans.dvingest.core.service.DataverseService; -import nl.knaw.dans.dvingest.core.service.UtilityServices; import nl.knaw.dans.dvingest.core.service.YamlService; -import nl.knaw.dans.lib.util.inbox.InboxTaskFactory; - -import java.nio.file.Path; +@Slf4j @AllArgsConstructor -public class DepositInboxTaskFactory implements InboxTaskFactory { - private final Path outputDir; - private final boolean onlyConvertDansDeposit; - private final DataverseService dataverseService; - private final UtilityServices utilityServices; +public class DansDepositSupportFactoryImpl implements DansDepositSupportFactory { private final ValidateDansBagService validateDansBagService; private final DansBagMappingService dansBagMappingService; + private final DataverseService dataverseService; private final YamlService yamlService; @Override - public Runnable createInboxTask(Path path) { - var deposit = new DataverseIngestDeposit(path, yamlService); - return new DepositTask(deposit, outputDir, onlyConvertDansDeposit, validateDansBagService, dataverseService, utilityServices, dansBagMappingService, yamlService); + public Deposit addDansDepositSupportIfEnabled(DataverseIngestDeposit deposit) { + return new DansDepositSupport(deposit, validateDansBagService, dansBagMappingService, dataverseService, yamlService); } } diff --git a/src/main/java/nl/knaw/dans/dvingest/DataverseIngestDepositFactoryImpl.java b/src/main/java/nl/knaw/dans/dvingest/DataverseIngestDepositFactoryImpl.java new file mode 100644 index 0000000..5ed45a8 --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/DataverseIngestDepositFactoryImpl.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest; + +import lombok.AllArgsConstructor; +import nl.knaw.dans.dvingest.core.DataverseIngestDeposit; +import nl.knaw.dans.dvingest.core.DataverseIngestDepositFactory; +import nl.knaw.dans.dvingest.core.service.YamlService; + +import java.nio.file.Path; + +@AllArgsConstructor +public class DataverseIngestDepositFactoryImpl implements DataverseIngestDepositFactory { + private final YamlService yamlService; + + @Override + public DataverseIngestDeposit createDataverseIngestDeposit(Path location) { + return new DataverseIngestDeposit(location, yamlService); + } +} diff --git a/src/main/java/nl/knaw/dans/dvingest/DdDataverseIngestApplication.java b/src/main/java/nl/knaw/dans/dvingest/DdDataverseIngestApplication.java index f2716d6..4e32127 100644 --- a/src/main/java/nl/knaw/dans/dvingest/DdDataverseIngestApplication.java +++ b/src/main/java/nl/knaw/dans/dvingest/DdDataverseIngestApplication.java @@ -23,10 +23,12 @@ import nl.knaw.dans.dvingest.client.ValidateDansBagServiceImpl; import nl.knaw.dans.dvingest.config.DansDepositConversionConfig; import nl.knaw.dans.dvingest.config.DdDataverseIngestConfiguration; +import nl.knaw.dans.dvingest.config.IngestAreaConfig; import nl.knaw.dans.dvingest.core.AutoIngestArea; import nl.knaw.dans.dvingest.core.IngestArea; import nl.knaw.dans.dvingest.core.dansbag.DansBagMappingService; import nl.knaw.dans.dvingest.core.dansbag.DansBagMappingServiceImpl; +import nl.knaw.dans.dvingest.core.dansbag.DansDepositSupportFactory; import nl.knaw.dans.dvingest.core.dansbag.SupportedLicenses; import nl.knaw.dans.dvingest.core.dansbag.mapper.DepositToDvDatasetMetadataMapper; import nl.knaw.dans.dvingest.core.service.DataverseService; @@ -38,6 +40,7 @@ import nl.knaw.dans.dvingest.resources.IngestApiResource; import nl.knaw.dans.lib.dataverse.DataverseException; import nl.knaw.dans.lib.util.MappingLoader; +import nl.knaw.dans.lib.util.inbox.Inbox; import org.apache.commons.io.FileUtils; import java.io.IOException; @@ -77,42 +80,47 @@ public void run(final DdDataverseIngestConfiguration configuration, final Enviro .maxNumberOfFilesPerUpload(configuration.getIngest().getMaxNumberOfFilesPerUploadBatch()) .maxUploadSize(configuration.getIngest().getMaxByteSizePerUploadBatch().toBytes()) .build(); - var dansBagMappingForImport = createDansBagMappingService(false, configuration.getDansDepositConversion(), dataverseService); - var dansBagMappingForMigration = createDansBagMappingService(true, configuration.getDansDepositConversion(), dataverseService); var yamlService = new YamlServiceImpl(); - var importAreaConfig = configuration.getIngest().getImportConfig(); - var validateDansBagMigration = new ValidateDansBagServiceImpl(configuration.getDansDepositConversion().getValidateDansBag(), true); - var validateDansBagImport = new ValidateDansBagServiceImpl(configuration.getDansDepositConversion().getValidateDansBag(), false); - var importArea = IngestArea.builder() - .executorService(environment.lifecycle().executorService("import").minThreads(1).maxThreads(1).build()) - .dataverseService(dataverseService) - .utilityServices(utilityServices) - .yamlService(yamlService) - .inbox(importAreaConfig.getInbox()) - .outbox(importAreaConfig.getOutbox()) - .validateDansBagService(validateDansBagImport) - .dansBagMappingService(dansBagMappingForImport).build(); - var migrationAreaConfig = configuration.getIngest().getMigration(); - var migrationArea = IngestArea.builder() - .executorService(environment.lifecycle().executorService("migration").minThreads(1).maxThreads(1).build()) - .dataverseService(dataverseService) - .utilityServices(utilityServices) - .yamlService(yamlService) - .inbox(migrationAreaConfig.getInbox()) - .outbox(migrationAreaConfig.getOutbox()) - .validateDansBagService(validateDansBagMigration) - .dansBagMappingService(dansBagMappingForMigration).build(); + var dataverseIngestDepositFactory = new DataverseIngestDepositFactoryImpl(yamlService); + var bagProcessorFactory = new BagProcessorFactoryImpl(dataverseService, utilityServices); + + /* + * Import area + */ + DansDepositConversionConfig dansDepositConversionConfig = configuration.getDansDepositConversion(); + DansDepositSupportFactory dansDepositSupportFactoryImport = new DansDepositSupportDisabledFactory(); + if (dansDepositConversionConfig != null) { + var dansBagMappingServiceImport = createDansBagMappingService(false, dansDepositConversionConfig, dataverseService); + var validateDansBagImportImport = new ValidateDansBagServiceImpl(dansDepositConversionConfig.getValidateDansBag(), false); + dansDepositSupportFactoryImport = new DansDepositSupportFactoryImpl(validateDansBagImportImport, dansBagMappingServiceImport, dataverseService, yamlService); + } + var depositTaskFactoryImport = new DepositTaskFactoryImpl(bagProcessorFactory, dansDepositSupportFactoryImport); + var importJobFactory = new ImportJobFactoryImpl(dataverseIngestDepositFactory, depositTaskFactoryImport); + IngestAreaConfig importConfig = configuration.getIngest().getImportConfig(); + var importArea = new IngestArea(importJobFactory, importConfig.getInbox(), importConfig.getOutbox(), + environment.lifecycle().executorService("import").minThreads(1).maxThreads(1).build()); + + /* + * Migration area + */ + DansDepositSupportFactory dansDepositSupportFactoryMigration = new DansDepositSupportDisabledFactory(); + if (dansDepositConversionConfig != null) { + var dansBagMappingService = createDansBagMappingService(true, dansDepositConversionConfig, dataverseService); + var validateDansBagImport = new ValidateDansBagServiceImpl(dansDepositConversionConfig.getValidateDansBag(), true); + dansDepositSupportFactoryMigration = new DansDepositSupportFactoryImpl(validateDansBagImport, dansBagMappingService, dataverseService, yamlService); + } + var depositTaskFactoryMigration = new DepositTaskFactoryImpl(bagProcessorFactory, dansDepositSupportFactoryMigration); + var migrationJobFactory = new ImportJobFactoryImpl(dataverseIngestDepositFactory, depositTaskFactoryMigration); + IngestAreaConfig migrationConfig = configuration.getIngest().getMigration(); + var migrationArea = new IngestArea(migrationJobFactory, migrationConfig.getInbox(), migrationConfig.getOutbox(), + environment.lifecycle().executorService("migration").minThreads(1).maxThreads(1).build()); + /* + * Auto ingest area + */ var autoIngestConfig = configuration.getIngest().getAutoIngest(); - var autoIngestArea = AutoIngestArea.autoIngestAreaBuilder() - .inbox(autoIngestConfig.getInbox()) - .outbox(autoIngestConfig.getOutbox()) - .dansBagMappingService(dansBagMappingForImport) - .dataverseService(dataverseService) - .utilityServices(utilityServices) - .validateDansBagService(validateDansBagImport) - .yamlService(yamlService) - .executorService(environment.lifecycle().executorService("auto-ingest").minThreads(1).maxThreads(1).build()) - .build(); + var inboxTaskFactory = new InboxTaskFactoryImpl(dataverseIngestDepositFactory, depositTaskFactoryImport, autoIngestConfig.getOutbox()); + var inbox = Inbox.builder().inbox(autoIngestConfig.getInbox()).taskFactory(inboxTaskFactory).build(); + var autoIngestArea = new AutoIngestArea(inbox, autoIngestConfig.getOutbox()); /* * Register components with Dropwizard @@ -124,10 +132,6 @@ public void run(final DdDataverseIngestConfiguration configuration, final Enviro } private DansBagMappingService createDansBagMappingService(boolean isMigration, DansDepositConversionConfig dansDepositConversionConfig, DataverseService dataverseService) { - if (dansDepositConversionConfig == null) { - log.info("DANS Deposit conversion is disabled"); - return null; - } log.info("Configuring DANS Deposit conversion"); try { var mapper = createMapper(isMigration, dansDepositConversionConfig, dataverseService); diff --git a/src/main/java/nl/knaw/dans/dvingest/DepositTaskFactoryImpl.java b/src/main/java/nl/knaw/dans/dvingest/DepositTaskFactoryImpl.java new file mode 100644 index 0000000..8ce341e --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/DepositTaskFactoryImpl.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest; + +import lombok.AllArgsConstructor; +import nl.knaw.dans.dvingest.core.DataverseIngestDeposit; +import nl.knaw.dans.dvingest.core.DepositTask; +import nl.knaw.dans.dvingest.core.DepositTaskFactory; +import nl.knaw.dans.dvingest.core.bagprocessor.BagProcessorFactory; +import nl.knaw.dans.dvingest.core.dansbag.DansDepositSupportFactory; + +import java.nio.file.Path; + +@AllArgsConstructor +public class DepositTaskFactoryImpl implements DepositTaskFactory { + private final BagProcessorFactory bagProcessorFactory; + private final DansDepositSupportFactory dansDepositSupportFactory; + + @Override + public Runnable createDepositTask(DataverseIngestDeposit deposit, Path outputDir, boolean onlyConvertDansDeposit) { + return new DepositTask(deposit, outputDir, onlyConvertDansDeposit, bagProcessorFactory, dansDepositSupportFactory); + } +} diff --git a/src/main/java/nl/knaw/dans/dvingest/ImportJobFactoryImpl.java b/src/main/java/nl/knaw/dans/dvingest/ImportJobFactoryImpl.java new file mode 100644 index 0000000..0d94fb8 --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/ImportJobFactoryImpl.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest; + +import lombok.AllArgsConstructor; +import lombok.NonNull; +import nl.knaw.dans.dvingest.api.ImportCommandDto; +import nl.knaw.dans.dvingest.core.DataverseIngestDepositFactory; +import nl.knaw.dans.dvingest.core.DepositTaskFactory; +import nl.knaw.dans.dvingest.core.ImportJob; +import nl.knaw.dans.dvingest.core.ImportJobFactory; + +import java.nio.file.Path; + +@AllArgsConstructor +public class ImportJobFactoryImpl implements ImportJobFactory { + @NonNull + private final DataverseIngestDepositFactory dataverseIngestDepositFactory; + @NonNull + private final DepositTaskFactory depositTaskFactory; + + @Override + public ImportJob createImportJob(ImportCommandDto importCommand, Path outputDir, boolean onlyConvertDansDeposit) { + return new ImportJob(importCommand, outputDir, onlyConvertDansDeposit, dataverseIngestDepositFactory, depositTaskFactory); + } +} diff --git a/src/main/java/nl/knaw/dans/dvingest/InboxTaskFactoryImpl.java b/src/main/java/nl/knaw/dans/dvingest/InboxTaskFactoryImpl.java new file mode 100644 index 0000000..8644f59 --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/InboxTaskFactoryImpl.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest; + +import lombok.AllArgsConstructor; +import nl.knaw.dans.dvingest.core.DataverseIngestDepositFactory; +import nl.knaw.dans.dvingest.core.DepositTaskFactory; +import nl.knaw.dans.lib.util.inbox.InboxTaskFactory; + +import java.nio.file.Path; + +@AllArgsConstructor +public class InboxTaskFactoryImpl implements InboxTaskFactory { + private final DataverseIngestDepositFactory dataverseIngestDepositFactory; + private final DepositTaskFactory depositTaskFactory; + private final Path outputDir; + + @Override + public Runnable createInboxTask(Path path) { + var dataVerseIngestDeposit = dataverseIngestDepositFactory.createDataverseIngestDeposit(path); + return depositTaskFactory.createDepositTask(dataVerseIngestDeposit, outputDir, false); + } +} diff --git a/src/main/java/nl/knaw/dans/dvingest/core/AutoIngestArea.java b/src/main/java/nl/knaw/dans/dvingest/core/AutoIngestArea.java index c2c7727..ebc0d11 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/AutoIngestArea.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/AutoIngestArea.java @@ -16,35 +16,17 @@ package nl.knaw.dans.dvingest.core; import io.dropwizard.lifecycle.Managed; -import lombok.Builder; -import lombok.NonNull; +import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import nl.knaw.dans.dvingest.client.ValidateDansBagService; -import nl.knaw.dans.dvingest.core.dansbag.DansBagMappingService; -import nl.knaw.dans.dvingest.core.service.DataverseService; -import nl.knaw.dans.dvingest.core.service.UtilityServices; -import nl.knaw.dans.dvingest.core.service.YamlService; import nl.knaw.dans.lib.util.inbox.Inbox; import java.nio.file.Path; -import java.util.concurrent.ExecutorService; @Slf4j -public class AutoIngestArea extends IngestArea implements Managed { +@AllArgsConstructor +public class AutoIngestArea implements Managed { private final Inbox autoIngestInbox; - - @Builder(builderMethodName = "autoIngestAreaBuilder") - public AutoIngestArea(@NonNull ExecutorService executorService, @NonNull ValidateDansBagService validateDansBagService, @NonNull DataverseService dataverseService, - @NonNull UtilityServices utilityServices, - DansBagMappingService dansBagMappingService /* may be null if disabled !*/, @NonNull YamlService yamlService, - Path inbox, Path outbox) { - super(executorService, validateDansBagService, dataverseService, utilityServices, dansBagMappingService, yamlService, inbox, outbox); - var inboxTaskFactory = new DepositInboxTaskFactory(outbox, false, dataverseService, utilityServices, validateDansBagService, dansBagMappingService, yamlService); - autoIngestInbox = Inbox.builder() - .inbox(inbox) - .taskFactory(inboxTaskFactory) - .build(); - } + private final Path outbox; private void initOutputDir() { log.debug("Initializing output directory: {}", outbox); diff --git a/src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestDepositFactory.java b/src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestDepositFactory.java new file mode 100644 index 0000000..741d4d6 --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestDepositFactory.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest.core; + +import java.nio.file.Path; + +public interface DataverseIngestDepositFactory { + + DataverseIngestDeposit createDataverseIngestDeposit(Path location); +} diff --git a/src/main/java/nl/knaw/dans/dvingest/core/DepositTask.java b/src/main/java/nl/knaw/dans/dvingest/core/DepositTask.java index 924bf3b..2585d6f 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/DepositTask.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/DepositTask.java @@ -17,14 +17,9 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import nl.knaw.dans.dvingest.client.ValidateDansBagService; -import nl.knaw.dans.dvingest.core.bagprocessor.BagProcessor; -import nl.knaw.dans.dvingest.core.dansbag.DansBagMappingService; -import nl.knaw.dans.dvingest.core.dansbag.DansDepositSupport; +import nl.knaw.dans.dvingest.core.bagprocessor.BagProcessorFactory; +import nl.knaw.dans.dvingest.core.dansbag.DansDepositSupportFactory; import nl.knaw.dans.dvingest.core.dansbag.exception.RejectedDepositException; -import nl.knaw.dans.dvingest.core.service.DataverseService; -import nl.knaw.dans.dvingest.core.service.UtilityServices; -import nl.knaw.dans.dvingest.core.service.YamlService; import java.io.IOException; import java.nio.file.Path; @@ -41,20 +36,17 @@ public enum Status { private final Deposit deposit; private final Path outputDir; private final boolean onlyConvertDansDeposit; - private final DataverseService dataverseService; - private final UtilityServices utilityServices; + private final BagProcessorFactory bagProcessorFactory; @Getter private Status status = Status.TODO; - public DepositTask(DataverseIngestDeposit dataverseIngestDeposit, Path outputDir, boolean onlyConvertDansDeposit, ValidateDansBagService validateDansBagService, DataverseService dataverseService, UtilityServices utilityServices, - DansBagMappingService dansBagMappingService, - YamlService yamlService) { - this.deposit = dansBagMappingService == null ? dataverseIngestDeposit : new DansDepositSupport(dataverseIngestDeposit, validateDansBagService, dansBagMappingService, dataverseService, yamlService); - this.dataverseService = dataverseService; - this.onlyConvertDansDeposit = onlyConvertDansDeposit; - this.utilityServices = utilityServices; + public DepositTask(DataverseIngestDeposit dataverseIngestDeposit, Path outputDir, boolean onlyConvertDansDeposit, BagProcessorFactory bagProcessorFactory, + DansDepositSupportFactory dansDepositSupportFactory) { + this.deposit = dansDepositSupportFactory.addDansDepositSupportIfEnabled(dataverseIngestDeposit); this.outputDir = outputDir; + this.onlyConvertDansDeposit = onlyConvertDansDeposit; + this.bagProcessorFactory = bagProcessorFactory; } @Override @@ -70,13 +62,7 @@ public void run() { for (DataverseIngestBag bag : deposit.getBags()) { log.info("START processing deposit / bag: {} / {}", deposit.getId(), bag); - pid = BagProcessor.builder() - .depositId(deposit.getId()) - .bag(bag) - .dataverseService(dataverseService) - .utilityServices(utilityServices) - .build() - .run(pid); + pid = bagProcessorFactory.createBagProcessor(deposit.getId(), bag).run(pid); log.info("END processing deposit / bag: {} / {}", deposit.getId(), bag); } deposit.onSuccess(pid, "Deposit processed successfully"); diff --git a/src/main/java/nl/knaw/dans/dvingest/core/DepositTaskFactory.java b/src/main/java/nl/knaw/dans/dvingest/core/DepositTaskFactory.java new file mode 100644 index 0000000..1fc0598 --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/core/DepositTaskFactory.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest.core; + +import java.nio.file.Path; + +public interface DepositTaskFactory { + + Runnable createDepositTask(DataverseIngestDeposit deposit, Path outputDir, boolean onlyConvertDansDeposit); +} diff --git a/src/main/java/nl/knaw/dans/dvingest/core/ImportJob.java b/src/main/java/nl/knaw/dans/dvingest/core/ImportJob.java index b19e41d..815e636 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/ImportJob.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/ImportJob.java @@ -15,18 +15,13 @@ */ package nl.knaw.dans.dvingest.core; -import lombok.Builder; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import nl.knaw.dans.dvingest.api.ImportCommandDto; import nl.knaw.dans.dvingest.api.ImportJobStatusDto; import nl.knaw.dans.dvingest.api.ImportJobStatusDto.StatusEnum; -import nl.knaw.dans.dvingest.client.ValidateDansBagService; -import nl.knaw.dans.dvingest.core.dansbag.DansBagMappingService; -import nl.knaw.dans.dvingest.core.service.DataverseService; -import nl.knaw.dans.dvingest.core.service.UtilityServices; -import nl.knaw.dans.dvingest.core.service.YamlService; import java.io.IOException; import java.nio.file.Files; @@ -34,7 +29,7 @@ import java.util.TreeSet; @Slf4j -@Builder +@AllArgsConstructor public class ImportJob implements Runnable { @NonNull @Getter @@ -42,37 +37,12 @@ public class ImportJob implements Runnable { @NonNull private final Path outputDir; private boolean onlyConvertDansDeposit; - @NonNull - private final DataverseService dataverseService; - @NonNull - private final UtilityServices utilityServices; - @NonNull - private final YamlService yamlService; - @NonNull - private final DansBagMappingService dansBagMappingService; - @NonNull - private final ValidateDansBagService validateDansBagService; + private final DataverseIngestDepositFactory depositFactory; + private final DepositTaskFactory depositTaskFactory; @Getter private final ImportJobStatusDto status = new ImportJobStatusDto(); - private ImportJob(@NonNull ImportCommandDto importCommand, - @NonNull Path outputDir, - boolean onlyConvertDansDeposit, - @NonNull DataverseService dataverseService, - @NonNull UtilityServices utilityServices, - @NonNull YamlService yamlService, - @NonNull DansBagMappingService dansBagMappingService, @NonNull ValidateDansBagService validateDansBagService) { - this.importCommand = importCommand; - this.outputDir = outputDir; - this.onlyConvertDansDeposit = onlyConvertDansDeposit; - this.dataverseService = dataverseService; - this.utilityServices = utilityServices; - this.yamlService = yamlService; - this.dansBagMappingService = dansBagMappingService; - this.validateDansBagService = validateDansBagService; - } - @Override public void run() { try { @@ -83,11 +53,14 @@ public void run() { var deposits = new TreeSet(); if (importCommand.getSingleObject()) { - deposits.add(new DataverseIngestDeposit(Path.of(importCommand.getPath()), yamlService)); + deposits.add(depositFactory.createDataverseIngestDeposit(Path.of(importCommand.getPath()))); } else { try (var depositPaths = Files.list(Path.of(importCommand.getPath()))) { - depositPaths.filter(Files::isDirectory).sorted().forEach(p -> deposits.add(new DataverseIngestDeposit(p, yamlService))); + depositPaths.filter(Files::isDirectory) + .sorted() + .map(depositFactory::createDataverseIngestDeposit) + .forEach(deposits::add); } } @@ -95,7 +68,7 @@ public void run() { for (DataverseIngestDeposit dataverseIngestDeposit : deposits) { log.info("START Processing deposit: {}", dataverseIngestDeposit.getId()); - var task = new DepositTask(dataverseIngestDeposit, outputDir, onlyConvertDansDeposit, validateDansBagService, dataverseService, utilityServices, dansBagMappingService, yamlService); + var task = depositTaskFactory.createDepositTask(dataverseIngestDeposit, outputDir, onlyConvertDansDeposit); task.run(); log.info("END Processing deposit: {}", dataverseIngestDeposit.getId()); // TODO: record number of processed/rejected/failed deposits in ImportJob status diff --git a/src/main/java/nl/knaw/dans/dvingest/core/ImportJobFactory.java b/src/main/java/nl/knaw/dans/dvingest/core/ImportJobFactory.java new file mode 100644 index 0000000..d3383ce --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/core/ImportJobFactory.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest.core; + +import nl.knaw.dans.dvingest.api.ImportCommandDto; + +import java.nio.file.Path; + +public interface ImportJobFactory { + + ImportJob createImportJob(ImportCommandDto importCommand, Path outputDir, boolean onlyConvertDansDeposit); +} diff --git a/src/main/java/nl/knaw/dans/dvingest/core/IngestArea.java b/src/main/java/nl/knaw/dans/dvingest/core/IngestArea.java index b10a4cf..659749d 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/IngestArea.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/IngestArea.java @@ -15,17 +15,11 @@ */ package nl.knaw.dans.dvingest.core; -import lombok.Builder; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import nl.knaw.dans.dvingest.api.ImportCommandDto; import nl.knaw.dans.dvingest.api.ImportJobStatusDto; import nl.knaw.dans.dvingest.api.ImportJobStatusDto.StatusEnum; -import nl.knaw.dans.dvingest.client.ValidateDansBagService; -import nl.knaw.dans.dvingest.core.dansbag.DansBagMappingService; -import nl.knaw.dans.dvingest.core.service.DataverseService; -import nl.knaw.dans.dvingest.core.service.UtilityServices; -import nl.knaw.dans.dvingest.core.service.YamlService; import java.nio.file.Path; import java.util.List; @@ -34,17 +28,11 @@ import java.util.concurrent.ExecutorService; @Slf4j -public class IngestArea { +public class IngestArea { @NonNull private final ExecutorService executorService; @NonNull - private final DataverseService dataverseService; - @NonNull - private final UtilityServices utilityServices; - @NonNull - private final DansBagMappingService dansBagMappingService; - @NonNull - private final ValidateDansBagService validateDansBagService; + private final ImportJobFactory importJobFactory; @NonNull private final Path inbox; @NonNull @@ -52,27 +40,18 @@ public class IngestArea { private final Map importJobs = new ConcurrentHashMap<>(); - @NonNull - private final YamlService yamlService; - - @Builder - protected IngestArea(ExecutorService executorService, ValidateDansBagService validateDansBagService, DataverseService dataverseService, UtilityServices utilityServices, DansBagMappingService dansBagMappingService, YamlService yamlService, Path inbox, Path outbox) { + public IngestArea(ImportJobFactory importJobFactory, Path inbox, Path outbox, ExecutorService executorService) { try { - this.executorService = executorService; - this.validateDansBagService = validateDansBagService; - this.dataverseService = dataverseService; - this.utilityServices = utilityServices; - this.dansBagMappingService = dansBagMappingService; - this.yamlService = yamlService; + this.importJobFactory = importJobFactory; this.inbox = inbox.toAbsolutePath().toRealPath(); this.outbox = outbox.toAbsolutePath().toRealPath(); + this.executorService = executorService; } catch (Exception e) { throw new IllegalStateException("Failed to create ingest area", e); } } - public void submit(ImportCommandDto importCommand) { log.debug("Received import command: {}", importCommand); var existingJob = importJobs.get(importCommand.getPath()); @@ -108,16 +87,7 @@ private ImportJob createImportJob(ImportCommandDto importCommand) { else { relativePath = inbox.relativize(Path.of(importCommand.getPath())); } - return ImportJob.builder() - .importCommand(importCommand) - .outputDir(outbox.resolve(relativePath)) - .onlyConvertDansDeposit(importCommand.getOnlyConvertDansBag()) - .dataverseService(dataverseService) - .utilityServices(utilityServices) - .yamlService(yamlService) - .dansBagMappingService(dansBagMappingService) - .validateDansBagService(validateDansBagService) - .build(); + return importJobFactory.createImportJob(importCommand, outbox.resolve(relativePath), importCommand.getOnlyConvertDansBag()); } private void validatePath(String path) { diff --git a/src/main/java/nl/knaw/dans/dvingest/core/bagprocessor/BagProcessorFactory.java b/src/main/java/nl/knaw/dans/dvingest/core/bagprocessor/BagProcessorFactory.java new file mode 100644 index 0000000..396c29d --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/core/bagprocessor/BagProcessorFactory.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest.core.bagprocessor; + +import io.dropwizard.configuration.ConfigurationException; +import nl.knaw.dans.dvingest.core.DataverseIngestBag; + +import java.io.IOException; +import java.util.UUID; + +/** + * Factory for creating BagProcessors. + */ +public interface BagProcessorFactory { + + /** + * Create a BagProcessor for the given deposit. + * + * @param depositId the deposit id + * @param bag the bag + * @return the BagProcessor + * @throws ConfigurationException if the Yaml files in the bag are not valid + * @throws IOException if there was a problem readin the bag files + */ + BagProcessor createBagProcessor(UUID depositId, DataverseIngestBag bag) throws ConfigurationException, IOException; + +} diff --git a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/DansBagMappingService.java b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/DansBagMappingService.java index b55e326..bf274a4 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/DansBagMappingService.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/DansBagMappingService.java @@ -26,16 +26,63 @@ import java.io.IOException; import java.nio.file.Path; +/** + * Service for mapping a DANS deposit to a standard Dataverse ingest deposit. A DANS deposit has only one bag, which must conform to the DANS BagIt Profile. + */ public interface DansBagMappingService { + /** + * Returns the DOI of the dataset that needs to be updated. If the deposit is to create a new dataset, this method returns null. + * + * @param depositDir the deposit directory + * @return the DOI of the dataset that needs to be updated, or null if the deposit is to create a new dataset + * @throws IOException if there was an error reading the deposit or calling Dataverse + * @throws DataverseException if a call to Dataverse failed + */ String getUpdatesDataset(Path depositDir) throws IOException, DataverseException; + /** + * Reads the DANS deposit from the given directory into a {@link DansBagDeposit} object. + * + * @param depositDir the deposit directory + * @return the DANS deposit object + * @throws InvalidDepositException if the deposit is invalid + */ DansBagDeposit readDansDeposit(Path depositDir) throws InvalidDepositException; + /** + * Maps the metadata from the DANS deposit to the new dataset level metadata for the dataset. For some parts the new metadata depends on the current metadata of the dataset. That is why the + * current metadata is also given as input. If the deposit is to create a new dataset, the current metadata is null. + * + * @param dansDeposit the DANS deposit + * @param currentMetadata the current metadata of the dataset + * @return the new dataset level metadata + */ Dataset getDatasetMetadataFromDansDeposit(DansBagDeposit dansDeposit, DatasetVersion currentMetadata); + /** + * Maps file information in the DANS bag to edit actions for the files in the dataset. The edit actions are used to update the files in the dataset. + * + * @param dansDeposit the DANS deposit + * @param updatesDataset the DOI of the dataset that needs to be updated, or null if the deposit is to create a new dataset + * @return the edit actions for the files in the dataset + */ EditFiles getEditFilesFromDansDeposit(DansBagDeposit dansDeposit, String updatesDataset); + /** + * Maps the permissions in the DANS deposit to edit actions for the permissions of the dataset. The edit actions are used to update the permissions of the dataset. + * + * @param dansDeposit the DANS deposit + * @param updatesDataset the DOI of the dataset that needs to be updated, or null if the deposit is to create a new dataset + * @return the edit actions for the permissions of the dataset + */ EditPermissions getEditPermissionsFromDansDeposit(DansBagDeposit dansDeposit, String updatesDataset); + /** + * Packages the original metadata of the DANS bag into a ZIP file and returns the local path to the ZIP file. + * + * @param dansDeposit the DANS deposit + * @return the local path to the ZIP file + * @throws IOException if there was an error reading the deposit or writing the ZIP file + */ String packageOriginalMetadata(DansBagDeposit dansDeposit) throws IOException; } diff --git a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/DansDepositSupportFactory.java b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/DansDepositSupportFactory.java new file mode 100644 index 0000000..95f06e7 --- /dev/null +++ b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/DansDepositSupportFactory.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2024 DANS - Data Archiving and Networked Services (info@dans.knaw.nl) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package nl.knaw.dans.dvingest.core.dansbag; + +import nl.knaw.dans.dvingest.core.DataverseIngestDeposit; +import nl.knaw.dans.dvingest.core.Deposit; + +/** + * Factory for creating DansDepositSupport objects. + */ +public interface DansDepositSupportFactory { + + /** + * Create a DansDepositSupport object for the given deposit. The object implements the {@link Deposit} interface, implementing the appropriate methods and forwarding the others to call the + * original deposit. If DANS deposit support is disabled, the deposit is returned as is. + * + * @param deposit the deposit + * @return the DansDepositSupport object + */ + Deposit addDansDepositSupportIfEnabled(DataverseIngestDeposit deposit); + +} diff --git a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/EditFilesComposerForUpdate.java b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/EditFilesComposerForUpdate.java index 34d5e3b..d2ad3de 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/EditFilesComposerForUpdate.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/EditFilesComposerForUpdate.java @@ -19,7 +19,6 @@ import nl.knaw.dans.dvingest.core.bagprocessor.FilesInDatasetCache; import nl.knaw.dans.dvingest.core.dansbag.deposit.FileInfo; import nl.knaw.dans.dvingest.core.service.DataverseService; -import nl.knaw.dans.dvingest.core.yaml.AddEmbargo; import nl.knaw.dans.dvingest.core.yaml.EditFiles; import nl.knaw.dans.dvingest.core.yaml.FromTo; import nl.knaw.dans.lib.dataverse.DataverseException; @@ -28,7 +27,6 @@ import java.io.IOException; import java.nio.file.Path; import java.time.Instant; -import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; diff --git a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/deposit/DansBagDepositReaderImpl.java b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/deposit/DansBagDepositReaderImpl.java index 168bc14..ab764f9 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/deposit/DansBagDepositReaderImpl.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/deposit/DansBagDepositReaderImpl.java @@ -17,8 +17,8 @@ import gov.loc.repository.bagit.domain.Bag; import gov.loc.repository.bagit.reader.BagReader; -import nl.knaw.dans.dvingest.core.dansbag.exception.InvalidDepositException; import nl.knaw.dans.dvingest.core.dansbag.ManifestUtil; +import nl.knaw.dans.dvingest.core.dansbag.exception.InvalidDepositException; import nl.knaw.dans.dvingest.core.dansbag.xml.XPathEvaluator; import nl.knaw.dans.dvingest.core.dansbag.xml.XmlReader; import org.apache.commons.configuration2.Configuration; diff --git a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/mapper/mapping/DcxDaiAuthor.java b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/mapper/mapping/DcxDaiAuthor.java index 5bf5678..d4c2d00 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/mapper/mapping/DcxDaiAuthor.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/mapper/mapping/DcxDaiAuthor.java @@ -26,15 +26,15 @@ import java.util.List; import java.util.Optional; -import static nl.knaw.dans.dvingest.core.dansbag.mapper.mapping.Contributor.contributorRoleToContributorType; -import static nl.knaw.dans.dvingest.core.dansbag.mapper.mapping.IdUriHelper.reduceUriToId; -import static nl.knaw.dans.dvingest.core.dansbag.mapper.mapping.IdUriHelper.reduceUriToOrcidId; import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.AUTHOR_AFFILIATION; import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.AUTHOR_IDENTIFIER; import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.AUTHOR_IDENTIFIER_SCHEME; import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.AUTHOR_NAME; import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.CONTRIBUTOR_NAME; import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.CONTRIBUTOR_TYPE; +import static nl.knaw.dans.dvingest.core.dansbag.mapper.mapping.Contributor.contributorRoleToContributorType; +import static nl.knaw.dans.dvingest.core.dansbag.mapper.mapping.IdUriHelper.reduceUriToId; +import static nl.knaw.dans.dvingest.core.dansbag.mapper.mapping.IdUriHelper.reduceUriToOrcidId; @Slf4j public final class DcxDaiAuthor extends Base { diff --git a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/mapper/mapping/DcxDaiOrganization.java b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/mapper/mapping/DcxDaiOrganization.java index a3d2d51..ba8ae64 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/dansbag/mapper/mapping/DcxDaiOrganization.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/dansbag/mapper/mapping/DcxDaiOrganization.java @@ -26,7 +26,6 @@ import java.util.Set; -import static nl.knaw.dans.dvingest.core.dansbag.mapper.mapping.IdUriHelper.reduceUriToId; import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.AUTHOR_IDENTIFIER; import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.AUTHOR_IDENTIFIER_SCHEME; import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.AUTHOR_NAME; @@ -34,6 +33,7 @@ import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.CONTRIBUTOR_TYPE; import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.GRANT_NUMBER_AGENCY; import static nl.knaw.dans.dvingest.core.dansbag.mapper.DepositDatasetFieldNames.GRANT_NUMBER_VALUE; +import static nl.knaw.dans.dvingest.core.dansbag.mapper.mapping.IdUriHelper.reduceUriToId; @Slf4j public final class DcxDaiOrganization {