diff --git a/DLCM-Access/src/main/java/ch/dlcm/assembling/AssemblingService.java b/DLCM-Access/src/main/java/ch/dlcm/assembling/AssemblingService.java index 001b891c404115c62a28b0fb3d320f10600e7f0d..13ca6042579d4e453a4d62028c93c07f57b0c23d 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/assembling/AssemblingService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/assembling/AssemblingService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -51,9 +51,9 @@ public abstract class AssemblingService extends DLCMService { protected final String orderLocation; - protected AssemblingService(DLCMProperties config, MessageService messageService) { - super(messageService, config); - this.orderLocation = config.getOrderLocation(); + protected AssemblingService(DLCMProperties dlcmProperties, MessageService messageService) { + super(messageService, dlcmProperties); + this.orderLocation = dlcmProperties.getOrderLocation(); } // ************************** @@ -111,5 +111,4 @@ public abstract class AssemblingService extends DLCMService { return dipFileName.substring(0, dipFileName.lastIndexOf(SolidifyConstants.ZIP_EXT)); } - } diff --git a/DLCM-Access/src/main/java/ch/dlcm/business/DisseminationInfoPackageService.java b/DLCM-Access/src/main/java/ch/dlcm/business/DisseminationInfoPackageService.java index d248c9598c080869aff0ba2707ef6fa1f9b4bd3e..a83c763672abfb8e2972c817f0584aed68fb0cd7 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/business/DisseminationInfoPackageService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/business/DisseminationInfoPackageService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -33,18 +33,27 @@ import org.springframework.stereotype.Service; import ch.unige.solidify.config.SolidifyEventPublisher; import ch.unige.solidify.rest.Result; +import ch.unige.solidify.service.HttpRequestInfoProvider; +import ch.dlcm.config.DLCMProperties; import ch.dlcm.controller.AccessController; import ch.dlcm.message.DipMessage; import ch.dlcm.model.PackageStatus; import ch.dlcm.model.oais.DisseminationInfoPackage; import ch.dlcm.repository.DisseminationInfoPackageRepository; +import ch.dlcm.service.HistoryService; import ch.dlcm.specification.DisseminationInfoPackageSpecification; @Service @ConditionalOnBean(AccessController.class) public class DisseminationInfoPackageService extends InfoPackageService<DisseminationInfoPackage> { + public DisseminationInfoPackageService(DLCMProperties dlcmProperties, + HttpRequestInfoProvider httpRequestInfoProvider, + SpecificationPermissionsFilter<DisseminationInfoPackage> specificationPermissionFilter, HistoryService historyService) { + super(dlcmProperties, httpRequestInfoProvider, specificationPermissionFilter, historyService); + } + @Override protected Specification<DisseminationInfoPackage> addSpecificationFilter(Specification<DisseminationInfoPackage> spec) { return this.specificationPermissionFilter.addPermissionsFilter(spec, this.httpRequestInfoProvider.getPrincipal()); @@ -56,7 +65,7 @@ public class DisseminationInfoPackageService extends InfoPackageService<Dissemin public boolean putPackageInProcessingQueue(DisseminationInfoPackage dip) { if (Objects.requireNonNull(dip.getInfo().getStatus()) == PackageStatus.IN_PREPARATION) { - boolean isBigPackage = this.getSize(dip.getResId()) > this.dlcmProperties.getParameters().getFileSizeLimit().toBytes(); + boolean isBigPackage = this.getSize(dip.getResId()) > this.fileSizeLimit.toBytes(); SolidifyEventPublisher.getPublisher().publishEvent(new DipMessage(dip.getResId(), isBigPackage)); return true; } @@ -77,7 +86,7 @@ public class DisseminationInfoPackageService extends InfoPackageService<Dissemin } public int countDIPOfCompletedOrders() { - return ((DisseminationInfoPackageRepository) this.itemRepository).countDIPOfCompletedOrders(); + return ((DisseminationInfoPackageRepository) this.itemRepository).countDIPOfCompletedOrders(); } @Override diff --git a/DLCM-Access/src/main/java/ch/dlcm/business/OrderService.java b/DLCM-Access/src/main/java/ch/dlcm/business/OrderService.java index 3b0a633de705d8a9b3e948dc3365af25f0e3c4f0..3580a10f86f457307a4a1b1e9de64599293c34a2 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/business/OrderService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/business/OrderService.java @@ -39,6 +39,7 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; +import org.springframework.util.unit.DataSize; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; @@ -79,7 +80,8 @@ import ch.dlcm.specification.OrderSpecification; public class OrderService extends ResourceService<Order> { private static final Logger log = LoggerFactory.getLogger(OrderService.class); - private final DLCMProperties dlcmProperties; + private final DataSize fileSizeLimit; + private final String orderLocation; private final SearchMgmt searchMgmt; private final ArchivalInfoPackageService aipService; private final OrderSubsetItemRepository orderSubsetItemRepository; @@ -90,11 +92,12 @@ public class OrderService extends ResourceService<Order> { ArchivalInfoPackageService aipService, OrderSubsetItemRepository orderSubsetItemRepository, TrustedDisseminationPolicyRemoteResourceService disseminationPolicyRemoteResourceService) { - this.dlcmProperties = dlcmProperties; this.searchMgmt = searchMgmt; this.aipService = aipService; this.orderSubsetItemRepository = orderSubsetItemRepository; this.disseminationPolicyRemoteResourceService = disseminationPolicyRemoteResourceService; + this.fileSizeLimit = dlcmProperties.getParameters().getFileSizeLimit(); + this.orderLocation = dlcmProperties.getOrderLocation(); } public Order saveOrder(Order order) { @@ -111,8 +114,7 @@ public class OrderService extends ResourceService<Order> { } if (!this.aipService.existsById(archive.getResId())) { - boolean isBigPackage = archive.getArchiveSize() != null - && archive.getArchiveSize() > this.dlcmProperties.getParameters().getFileSizeLimit().toBytes(); + boolean isBigPackage = archive.getArchiveSize() != null && archive.getArchiveSize() > this.fileSizeLimit.toBytes(); archive.reset(); this.aipService.saveForOrders(archive); @@ -150,7 +152,7 @@ public class OrderService extends ResourceService<Order> { @Override public void delete(String orderId) { super.delete(orderId); - final Path orderPath = Paths.get(this.dlcmProperties.getOrderLocation()).resolve(orderId); + final Path orderPath = Paths.get(this.orderLocation).resolve(orderId); if (FileTool.isFolder(orderPath) && !FileTool.deleteFolder(orderPath)) { throw new SolidifyFileDeleteException(orderPath.toString()); } diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/AccessController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/AccessController.java index 956e47fc978e917ec924f3909561bca564b310e4..48b79523b617e038f686a02e6c9fa12c3d0b7399 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/AccessController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/AccessController.java @@ -68,15 +68,13 @@ import ch.dlcm.rest.UrlPath; @RequestMapping(UrlPath.ACCESS) public class AccessController extends ModuleController { - protected DLCMProperties config; - + private final Path accessTempLocation; private final SystemProperties systemProperties; - AccessController(DLCMProperties config, OAIMetadataPrefixService oaiMetadataPrefixService, OAISetService oaiSetService, + AccessController(DLCMProperties dlcmProperties, OAIMetadataPrefixService oaiMetadataPrefixService, OAISetService oaiSetService, CitationProperties citationProperties) { super(ModuleName.ACCESS); - this.config = config; - if (this.config.getData().isInit()) { + if (dlcmProperties.getData().isInit()) { try { // Init OAI Metadata Prefix oaiMetadataPrefixService.initDefaultData(); @@ -113,17 +111,17 @@ public class AccessController extends ModuleController { oaiSetService.createIfNotExists(DLCMConstants.OAI_ORG_UNIT, "Organizational Units", "Set for all organizational units", "*"); } this.systemProperties = new SystemProperties(citationProperties); + this.accessTempLocation = Paths.get(dlcmProperties.getTempLocation(dlcmProperties.getAccessLocation())); } @RootPermissions @PostMapping(DLCMActionName.PURGE_CONTENT_TEMP_FOLDER) public ResponseEntity<Void> purgeContentTempFolder() { try { - Path tmpLocation = Paths.get(this.config.getTempLocation(this.config.getAccessLocation())); - try (Stream<Path> walk = Files.walk(tmpLocation)) { + try (Stream<Path> walk = Files.walk(this.accessTempLocation)) { walk.sorted(Comparator.reverseOrder()) .map(Path::toFile) - .filter(item -> !item.getPath().equals(tmpLocation.toString())) + .filter(item -> !item.getPath().equals(this.accessTempLocation.toString())) .forEach(File::delete); } } catch (IOException e) { diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/AccessIndexResourceReadOnlyController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/AccessIndexResourceReadOnlyController.java index 64289d92eace9f09944fa4ac9125ac2c399ef1b8..ea05eb2c27c3f371d93ce0538396c7d41255a913 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/AccessIndexResourceReadOnlyController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/AccessIndexResourceReadOnlyController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -55,9 +55,9 @@ public abstract class AccessIndexResourceReadOnlyController<T extends IndexMetad protected AccessIndexResourceReadOnlyController( IndexMetadataRemoteResourceService<T> indexResourceRemoteService, - DLCMProperties config) { + DLCMProperties dlcmProperties) { super(indexResourceRemoteService); - this.tempLocation = config.getAccessLocation(); + this.tempLocation = dlcmProperties.getAccessLocation(); } protected HttpEntity<StreamingResponseBody> getFile(Path path, String targetName, String contentType) { diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/AccessNoSqlResourceReadOnlyController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/AccessNoSqlResourceReadOnlyController.java index 7a24a3c06dd32d917d82fa073396fecfc2b5dbb1..770ccf7f74709c568536ab10886db0410d91b15c 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/AccessNoSqlResourceReadOnlyController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/AccessNoSqlResourceReadOnlyController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -49,12 +49,11 @@ import ch.dlcm.config.DLCMProperties; public abstract class AccessNoSqlResourceReadOnlyController<T extends NoSqlResource> extends NoSqlResourceReadOnlyController<T> { - protected DLCMProperties config; + private final String accessTempLocation; - protected AccessNoSqlResourceReadOnlyController(NoSqlResourceService<T> noSqlResourceService, DLCMProperties config) { + protected AccessNoSqlResourceReadOnlyController(NoSqlResourceService<T> noSqlResourceService, DLCMProperties dlcmProperties) { super(noSqlResourceService); - - this.config = config; + this.accessTempLocation = dlcmProperties.getTempLocation(dlcmProperties.getAccessLocation()); } protected HttpEntity<StreamingResponseBody> getThumbnail(Path thumbnailFile) { @@ -68,7 +67,7 @@ public abstract class AccessNoSqlResourceReadOnlyController<T extends NoSqlResou } protected Path getThumbnailPath(String resId) { - return Paths.get(this.config.getTempLocation(this.config.getAccessLocation()), resId); + return Paths.get(this.accessTempLocation, resId); } protected void downloadThumbnailLocally(ByteArrayOutputStream downloadArchiveThumbnail, Path thumbnailPath) diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/AIPDownloadController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/AIPDownloadController.java index 0fe13f31d2bf03ebbb763fa50acb691ac09c85fb..cc99308fd3810a1d6ae3d81e797c12a5d6215270 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/AIPDownloadController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/AIPDownloadController.java @@ -39,6 +39,7 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.unit.DataSize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; @@ -62,8 +63,9 @@ import ch.unige.solidify.security.TrustedUserPermissions; import ch.unige.solidify.util.FileTool; import ch.dlcm.DLCMConstants; -import ch.dlcm.business.AipDataFileService; import ch.dlcm.business.ArchivalInfoPackageService; +import ch.dlcm.business.DataFileService; +import ch.dlcm.config.DLCMProperties; import ch.dlcm.controller.AbstractPackageController; import ch.dlcm.controller.AccessController; import ch.dlcm.message.AipDownloadMessage; @@ -75,6 +77,7 @@ import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; import ch.dlcm.service.DataCategoryService; +import ch.dlcm.service.HistoryService; import ch.dlcm.service.MetadataService; import ch.dlcm.service.SearchMgmt; import ch.dlcm.service.rest.propagate.PropagateMetadataTypeRemoteResourceService; @@ -88,16 +91,17 @@ public class AIPDownloadController extends AbstractPackageController<AipDataFile private final OrderRepository orderRepository; private final SearchMgmt searchMgmt; - public AIPDownloadController( - PropagateMetadataTypeRemoteResourceService metadataTypeService, - MetadataService metadataService, - SearchMgmt searchMgmt, - OrderRepository orderRepository, - AipDataFileService aipDataFileService, - DataCategoryService dataCategoryService) { - super(metadataTypeService, metadataService, aipDataFileService, dataCategoryService); - this.searchMgmt = searchMgmt; + private final DataSize fileSizeLimit; + + public AIPDownloadController(DLCMProperties dlcmProperties, HistoryService historyService, + MetadataService metadataService, PropagateMetadataTypeRemoteResourceService metadataTypeService, + DataFileService<AipDataFile> dataFileService, DataCategoryService dataCategoryService, OrderRepository orderRepository, + SearchMgmt searchMgmt) { + super(historyService, metadataService, metadataTypeService, dataFileService, dataCategoryService); this.orderRepository = orderRepository; + this.searchMgmt = searchMgmt; + + this.fileSizeLimit = dlcmProperties.getParameters().getFileSizeLimit(); } @Override @@ -117,7 +121,7 @@ public class AIPDownloadController extends AbstractPackageController<AipDataFile throw new IllegalStateException("Aip " + aip.getResId() + " is not completed yet"); } if (!this.itemService.existsById(aip.getResId())) { - boolean isBigPackage = aip.getArchiveSize() != null && aip.getArchiveSize() > this.config.getParameters().getFileSizeLimit().toBytes(); + boolean isBigPackage = aip.getArchiveSize() != null && aip.getArchiveSize() > this.fileSizeLimit.toBytes(); aip.reset(); this.itemService.save(aip); SolidifyEventPublisher.getPublisher().publishEvent(new AipDownloadMessage(aip.getResId(), isBigPackage)); diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/AccessDownloadTokenController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/AccessDownloadTokenController.java index 53ed0a70f3847652a978708f9d3627a0797526db..cb24fabdcf51a780ddc93b9ccd7cdadc36da11c2 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/AccessDownloadTokenController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/AccessDownloadTokenController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -57,9 +57,9 @@ public class AccessDownloadTokenController extends DLCMDownloadTokenController { public AccessDownloadTokenController( DownloadTokenRepository downloadTokenRepository, SolidifyProperties solidifyConfig, - DLCMProperties config) throws URISyntaxException { + DLCMProperties dlcmProperties) throws URISyntaxException { super(solidifyConfig, downloadTokenRepository); - this.accessModulePath = new URI(config.getModule().getAccess().getPublicUrl()).getPath(); + this.accessModulePath = new URI(dlcmProperties.getModule().getAccess().getPublicUrl()).getPath(); } @GetMapping(UrlPath.ACCESS_PUBLIC_METADATA + "/{dipName}/" + ActionName.DOWNLOAD_TOKEN) diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/AipDownloadDataFileController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/AipDownloadDataFileController.java index d6ec60b776cfb10fc97deda0dd005e42034219d6..01b5a00b958345237aa097e6ad885d41c89d40d6 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/AipDownloadDataFileController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/AipDownloadDataFileController.java @@ -29,8 +29,6 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.lang.reflect.Method; import java.util.Map; -import jakarta.validation.Valid; - import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.core.io.FileSystemResource; import org.springframework.data.domain.Pageable; @@ -47,6 +45,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import jakarta.validation.Valid; + import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyRuntimeException; import ch.unige.solidify.rest.ActionName; @@ -64,6 +64,7 @@ import ch.dlcm.model.oais.ArchivalInfoPackage; import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; +import ch.dlcm.service.HistoryService; @TrustedUserPermissions @RestController @@ -71,6 +72,10 @@ import ch.dlcm.rest.UrlPath; @RequestMapping(UrlPath.ACCESS_AIP + SolidifyConstants.URL_PARENT_ID + ResourceName.DATAFILE) public class AipDownloadDataFileController extends AbstractDataFileController<ArchivalInfoPackage, AipDataFile> { + public AipDownloadDataFileController(HistoryService historyService) { + super(historyService); + } + @Override public HttpEntity<AipDataFile> create(@PathVariable final String parentid, final @Valid @RequestBody AipDataFile childItem) { return super.create(parentid, childItem); diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/AllMetadataController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/AllMetadataController.java index 7083d7e84ad24b3b58fe21fb38b672de3750ab7b..2c79cdd14e80e5870cb3c942011637469c9d84fa 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/AllMetadataController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/AllMetadataController.java @@ -64,7 +64,7 @@ public class AllMetadataController extends SearchController { public AllMetadataController( TrustedArchiveAllMetadataRemoteResourceService searchService, - DLCMProperties config, + DLCMProperties dlcmProperties, DisseminationInfoPackageRepository dipRepository, OrderService orderService, ArchiveUserFingerprintService archiveUserFingerprintService, @@ -72,7 +72,7 @@ public class AllMetadataController extends SearchController { DownloadTokenService downloadTokenService, TrustedUserRemoteResourceService trustedUserRemoteResourceService, DisseminationPolicyProvider disseminationPolicyProvider) { - super(searchService, config, dipRepository, orderService, archiveUserFingerprintService, + super(searchService, dlcmProperties, dipRepository, orderService, archiveUserFingerprintService, dlcmCitationGeneratorService, downloadTokenService, trustedUserRemoteResourceService, disseminationPolicyProvider); } diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/DIPController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/DIPController.java index 1aa92557781ceb58b896f2d74b928f4edabd5637..285e2488876bb028275c39e2f3b61e4772e91781 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/DIPController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/DIPController.java @@ -63,7 +63,7 @@ import ch.unige.solidify.util.FileTool; import ch.dlcm.DLCMConstants; import ch.dlcm.DLCMMetadataVersion; -import ch.dlcm.business.DipDataFileService; +import ch.dlcm.business.DataFileService; import ch.dlcm.business.DisseminationInfoPackageService; import ch.dlcm.controller.AbstractPackageController; import ch.dlcm.controller.AccessController; @@ -79,6 +79,7 @@ import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; import ch.dlcm.service.DataCategoryService; +import ch.dlcm.service.HistoryService; import ch.dlcm.service.MetadataService; import ch.dlcm.service.rest.propagate.PropagateMetadataTypeRemoteResourceService; @@ -89,13 +90,10 @@ public class DIPController extends AbstractPackageController<DipDataFile, Dissem private final OrderRepository orderRepository; - public DIPController( - PropagateMetadataTypeRemoteResourceService metadataTypeService, - MetadataService metadataService, - OrderRepository orderRepository, - DipDataFileService dipDataFileService, - DataCategoryService dataCategoryService) { - super(metadataTypeService, metadataService, dipDataFileService, dataCategoryService); + public DIPController(HistoryService historyService, MetadataService metadataService, + PropagateMetadataTypeRemoteResourceService metadataTypeService, DataFileService<DipDataFile> dataFileService, + DataCategoryService dataCategoryService, OrderRepository orderRepository) { + super(historyService, metadataService, metadataTypeService, dataFileService, dataCategoryService); this.orderRepository = orderRepository; } diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/DipDataFileController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/DipDataFileController.java index 6e15a6b83fbb9877e12e95c9b412494ba0fe508c..f468552fe9d060fa7fbd2ccde834d065d66afa74 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/DipDataFileController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/DipDataFileController.java @@ -29,8 +29,6 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.lang.reflect.Method; import java.util.Map; -import jakarta.validation.Valid; - import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.core.io.FileSystemResource; import org.springframework.data.domain.Pageable; @@ -47,6 +45,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import jakarta.validation.Valid; + import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyRuntimeException; import ch.unige.solidify.rest.ActionName; @@ -62,6 +62,7 @@ import ch.dlcm.model.oais.DisseminationInfoPackage; import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; +import ch.dlcm.service.HistoryService; @TrustedUserPermissions @RestController @@ -69,6 +70,10 @@ import ch.dlcm.rest.UrlPath; @RequestMapping(UrlPath.ACCESS_DIP + SolidifyConstants.URL_PARENT_ID + ResourceName.DATAFILE) public class DipDataFileController extends AbstractDataFileController<DisseminationInfoPackage, DipDataFile> { + public DipDataFileController(HistoryService historyService) { + super(historyService); + } + @Override public HttpEntity<DipDataFile> create(@PathVariable final String parentid, final @Valid @RequestBody DipDataFile childItem) { return super.create(parentid, childItem); diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/MetadataController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/MetadataController.java index dff0733dbbec85bc194272eb5e75cb972d59e78c..f31cdc40698a3ff2a249fbaba72177d1cdc5c13b 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/MetadataController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/MetadataController.java @@ -106,7 +106,7 @@ public class MetadataController extends SearchController { public MetadataController( TrustedArchivePublicMetadataRemoteResourceService searchService, - DLCMProperties config, + DLCMProperties dlcmProperties, DisseminationInfoPackageRepository dipRepository, FallbackOrganizationalUnitRemoteResourceService organizationalUnitRemoteResourceService, OrderService orderService, @@ -119,7 +119,8 @@ public class MetadataController extends SearchController { DownloadTokenService downloadTokenService, TrustedUserRemoteResourceService trustedUserRemoteResourceService, DisseminationPolicyProvider disseminationPolicyProvider) { - super(searchService, config, dipRepository, orderService, archiveUserFingerprintService, dlcmCitationGeneratorService, downloadTokenService, + super(searchService, dlcmProperties, dipRepository, orderService, archiveUserFingerprintService, dlcmCitationGeneratorService, + downloadTokenService, trustedUserRemoteResourceService, disseminationPolicyProvider); this.organizationalUnitRemoteResourceService = organizationalUnitRemoteResourceService; this.archivePrivateMetadataRemoteResourceService = archivePrivateMetadataRemoteResourceService; @@ -187,7 +188,7 @@ public class MetadataController extends SearchController { thumbnailPath = this.getThumbnailPath(id); thumbnailContentType = archive.getPublicDataContentType(PublicDataFileType.ARCHIVE_THUMBNAIL); // Check if thumbnail already download - this.archivePublicDataRemoteResourceService.downloadArchivePublicData(id, PublicDataFileType.ARCHIVE_THUMBNAIL, thumbnailPath); + this.archivePublicDataRemoteResourceService.downloadArchivePublicData(id, PublicDataFileType.ARCHIVE_THUMBNAIL, thumbnailPath); } else { // use orgUnit thumbnail String orgUnitId = archive.getMetadata().get(DLCMConstants.AIP_ORGA_UNIT).toString(); @@ -218,7 +219,7 @@ public class MetadataController extends SearchController { && !archive.getMetadata().get(DLCMConstants.AIP_DATA_USE_POLICY).equals(DataUsePolicy.EXTERNAL_DUA)) { Path duaPath = this.getDuaPath(id); // Download DUA if not already done - this.archivePublicDataRemoteResourceService.downloadArchivePublicData(id, PublicDataFileType.ARCHIVE_DUA, duaPath); + this.archivePublicDataRemoteResourceService.downloadArchivePublicData(id, PublicDataFileType.ARCHIVE_DUA, duaPath); return this.getFile( duaPath, id + "." + DLCMConstants.ARCHIVE_DUA, @@ -242,9 +243,9 @@ public class MetadataController extends SearchController { if (archive.isPublicDataPresent(PublicDataFileType.ARCHIVE_README).equals(Boolean.TRUE)) { readmePath = this.getReadmePath(id); // Check if README already download - // if (!FileTool.checkFile(readmePath)) { - this.archivePublicDataRemoteResourceService.downloadArchivePublicData(id, PublicDataFileType.ARCHIVE_README, readmePath); - // } + // if (!FileTool.checkFile(readmePath)) { + this.archivePublicDataRemoteResourceService.downloadArchivePublicData(id, PublicDataFileType.ARCHIVE_README, readmePath); + // } return this.getFile( readmePath, id + "." + DLCMConstants.ARCHIVE_README, diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrderAipController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrderAipController.java index c58bf3a40cb2a20576503c52626a84dea9b198ff..4ee2aec7230d61ec2d3281904a59980ecd0ec26d 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrderAipController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrderAipController.java @@ -39,6 +39,7 @@ import org.springframework.http.HttpEntity; import org.springframework.http.ResponseEntity; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.util.unit.DataSize; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -78,16 +79,16 @@ public class OrderAipController extends AssociationController<Order, ArchivalInf private final ArchivalInfoPackageService aipService; private final SearchMgmt searchMgmt; private final PropagatePersonRemoteResourceService personRemoteResourceService; - private final DLCMProperties configService; + private final DataSize fileSizeLimit; public OrderAipController(ArchivalInfoPackageService aipService, SearchMgmt searchMgmt, PropagatePersonRemoteResourceService personRemoteResourceService, - DLCMProperties configService) { + DLCMProperties dlcmProperties) { this.aipService = aipService; this.searchMgmt = searchMgmt; this.personRemoteResourceService = personRemoteResourceService; - this.configService = configService; + this.fileSizeLimit = dlcmProperties.getParameters().getFileSizeLimit(); } /** @@ -162,8 +163,7 @@ public class OrderAipController extends AssociationController<Order, ArchivalInf if (!this.aipService.existsById(aip.getResId())) { - boolean isBigPackage = aip.getArchiveSize() != null - && aip.getArchiveSize() > this.configService.getParameters().getFileSizeLimit().toBytes(); + boolean isBigPackage = aip.getArchiveSize() != null && aip.getArchiveSize() > this.fileSizeLimit.toBytes(); /* * Save AIP on access diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrderController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrderController.java index 187a4821417b96cd762eec5eed680d7749314bce..0df554d606f3de3a4908c6c16e800f703878eca0 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrderController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrderController.java @@ -30,8 +30,6 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.core.io.InputStreamResource; import org.springframework.data.domain.Pageable; @@ -71,6 +69,7 @@ import ch.dlcm.model.access.QueryType; import ch.dlcm.repository.OrderRepository; import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.UrlPath; +import ch.dlcm.service.HistoryService; import ch.dlcm.service.SearchMgmt; @UserPermissions @@ -78,12 +77,12 @@ import ch.dlcm.service.SearchMgmt; @ConditionalOnBean(AccessController.class) @RequestMapping(UrlPath.ACCESS_ORDER) public class OrderController extends ResourceWithHistoryController<Order> { - private static final Logger log = LoggerFactory.getLogger(OrderController.class); final ArchivalInfoPackageService aipService; final SearchMgmt searchMgmt; - public OrderController(ArchivalInfoPackageService aipService, SearchMgmt searchMgmt) { + public OrderController(HistoryService historyService, ArchivalInfoPackageService aipService, SearchMgmt searchMgmt) { + super(historyService); this.aipService = aipService; this.searchMgmt = searchMgmt; } diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrgUnitController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrgUnitController.java index 3a43f922e237ad2f6f2525fe37e981227a0d3ba5..8340553168a4011b1932c97ef609279e6556aeb7 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrgUnitController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/OrgUnitController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -63,9 +63,8 @@ public class OrgUnitController extends AccessNoSqlResourceReadOnlyController<Org private final FallbackOrganizationalUnitRemoteResourceService organizationalUnitRemoteResourceService; public OrgUnitController(@Qualifier("orgUnitRemoteService") NoSqlResourceService<OrgUnit> noSqlResourceService, - DLCMProperties config, - FallbackOrganizationalUnitRemoteResourceService organizationalUnitRemoteResourceService) { - super(noSqlResourceService, config); + DLCMProperties dlcmProperties, FallbackOrganizationalUnitRemoteResourceService organizationalUnitRemoteResourceService) { + super(noSqlResourceService, dlcmProperties); this.organizationalUnitRemoteResourceService = organizationalUnitRemoteResourceService; } diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/PrivateMetadataController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/PrivateMetadataController.java index 306309110c72516b5c20fdec6117d5663b99d574..f7a2631a05fda8b4a9d1082c9791c7d2086cb3c2 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/PrivateMetadataController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/PrivateMetadataController.java @@ -64,7 +64,7 @@ public class PrivateMetadataController extends SearchController { public PrivateMetadataController( TrustedArchivePrivateMetadataRemoteResourceService searchService, - DLCMProperties config, + DLCMProperties dlcmProperties, DisseminationInfoPackageRepository dipRepository, OrderService orderService, ArchiveUserFingerprintService archiveUserFingerprintService, @@ -72,7 +72,8 @@ public class PrivateMetadataController extends SearchController { DownloadTokenService downloadTokenService, TrustedUserRemoteResourceService trustedUserRemoteResourceService, DisseminationPolicyProvider disseminationPolicyProvider) { - super(searchService, config, dipRepository, orderService, archiveUserFingerprintService, dlcmCitationGeneratorService, downloadTokenService, + super(searchService, dlcmProperties, dipRepository, orderService, archiveUserFingerprintService, dlcmCitationGeneratorService, + downloadTokenService, trustedUserRemoteResourceService, disseminationPolicyProvider); } diff --git a/DLCM-Access/src/main/java/ch/dlcm/controller/access/SearchController.java b/DLCM-Access/src/main/java/ch/dlcm/controller/access/SearchController.java index c52f2c7b40506259ae81dcd190161160ac7c8b16..9daaee48a47432a1f335e0c510962246632d2060 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/controller/access/SearchController.java +++ b/DLCM-Access/src/main/java/ch/dlcm/controller/access/SearchController.java @@ -103,7 +103,7 @@ public abstract class SearchController extends AccessIndexResourceReadOnlyContro protected SearchController( IndexMetadataRemoteResourceService<ArchiveMetadata> indexResourceRemoteService, - DLCMProperties config, + DLCMProperties dlcmProperties, DisseminationInfoPackageRepository dipRepository, OrderService orderService, ArchiveUserFingerprintService archiveUserFingerprintService, @@ -111,7 +111,7 @@ public abstract class SearchController extends AccessIndexResourceReadOnlyContro DownloadTokenService downloadTokenService, TrustedUserRemoteResourceService trustedUserRemoteResourceService, DisseminationPolicyProvider disseminationPolicyProvider) { - super(indexResourceRemoteService, config); + super(indexResourceRemoteService, dlcmProperties); this.dipRepository = dipRepository; this.orderService = orderService; this.archiveUserFingerprintService = archiveUserFingerprintService; @@ -219,7 +219,8 @@ public abstract class SearchController extends AccessIndexResourceReadOnlyContro @PostMapping("/{aipId}/" + DLCMActionName.PREPARE_DOWNLOAD) @PreAuthorize("@metadataPermissionService.isAllowed(#aipId, 'PREPARE_DOWNLOAD_ARCHIVE')" + "|| @downloadWithAclPermissionService.isAllowed(#aipId)") - public HttpEntity<String> prepareDownload(@PathVariable String aipId, @RequestBody(required = false) DisseminationPolicyDto disseminationPolicyDto) { + public HttpEntity<String> prepareDownload(@PathVariable String aipId, + @RequestBody(required = false) DisseminationPolicyDto disseminationPolicyDto) { if (disseminationPolicyDto == null) { disseminationPolicyDto = new DisseminationPolicyDto(); } @@ -248,7 +249,8 @@ public abstract class SearchController extends AccessIndexResourceReadOnlyContro } final Order order; if (orderList.isEmpty()) { - order = this.orderService.createOrderForAIP(aipId, disseminationPolicyDto.getSubsetItemList(), disseminationPolicyDto.getDisseminationPolicyId()); + order = this.orderService.createOrderForAIP(aipId, disseminationPolicyDto.getSubsetItemList(), + disseminationPolicyDto.getDisseminationPolicyId()); this.orderService.submitOrder(order); } else if (orderList.size() == 1) { order = orderList.get(0); diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/AccessRefreshMgmt.java b/DLCM-Access/src/main/java/ch/dlcm/service/AccessRefreshMgmt.java index b286f7a5afc6de705175358c59bb2457b94e800f..046afc7b27fabff6cd7dc934a299274286bf610a 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/AccessRefreshMgmt.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/AccessRefreshMgmt.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -42,8 +42,8 @@ public class AccessRefreshMgmt extends MessageProcessorBySize<AccessRefreshMessa protected final AccessRefreshService accessRefreshService; protected final ArchivalInfoPackageService aipService; - public AccessRefreshMgmt(AccessRefreshService accessRefreshService, ArchivalInfoPackageService aipService, DLCMProperties configService) { - super(configService); + public AccessRefreshMgmt(AccessRefreshService accessRefreshService, ArchivalInfoPackageService aipService, DLCMProperties dlcmProperties) { + super(dlcmProperties); this.accessRefreshService = accessRefreshService; this.aipService = aipService; } diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/AipDownloadMgmt.java b/DLCM-Access/src/main/java/ch/dlcm/service/AipDownloadMgmt.java index 6f79ab7b96e8a44d7d395b62bf178fae6c80b468..71d93f75461d235210d3ed560fe23b24ed939f09 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/AipDownloadMgmt.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/AipDownloadMgmt.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -47,8 +47,8 @@ public class AipDownloadMgmt extends MessageProcessorBySize<AipDownloadMessage> protected final ArchivalInfoPackageService aipService; public AipDownloadMgmt(AipDownloadStatusService aipDownloadStatusService, ArchivalInfoPackageService aipService, - DLCMProperties configService) { - super(configService); + DLCMProperties dlcmProperties) { + super(dlcmProperties); this.aipDownloadStatusService = aipDownloadStatusService; this.aipService = aipService; } diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/AipDownloadStatusService.java b/DLCM-Access/src/main/java/ch/dlcm/service/AipDownloadStatusService.java index 01aa242d16756a56ff8d5e28c6c2fe4e1dcdc7d1..f097491f81d4ea2e1a300b2f7ae90a2d7ee327c6 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/AipDownloadStatusService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/AipDownloadStatusService.java @@ -76,8 +76,8 @@ public class AipDownloadStatusService extends DLCMService { TrustedNotificationRemoteResourceService notificationRemoteService, TrustedUserRemoteResourceService userRemoteService, TrustedOrganizationalUnitRemoteResourceService organizationalUnitRemoteService, - DLCMCitationGeneratorService citationsService, DLCMProperties config) { - super(messageService, config); + DLCMCitationGeneratorService citationsService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.aipService = aipService; this.aipRemoteService = aipRemoteService; this.citationsService = citationsService; diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/ArchiveStatisticsLoggingService.java b/DLCM-Access/src/main/java/ch/dlcm/service/ArchiveStatisticsLoggingService.java index b39b1e94a91285eedd73f91ca7c90dc5488d5554..cc1a88a80e913bbdcefd4b7a0f121485988f25ff 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/ArchiveStatisticsLoggingService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/ArchiveStatisticsLoggingService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -47,8 +47,8 @@ public class ArchiveStatisticsLoggingService extends DLCMService { private final FallbackArchiveStatisticsRemoteResourceService archiveStatisticsRemoteResourceService; public ArchiveStatisticsLoggingService(MessageService messageService, - FallbackArchiveStatisticsRemoteResourceService archiveStatisticsRemoteResourceService, DLCMProperties config) { - super(messageService, config); + FallbackArchiveStatisticsRemoteResourceService archiveStatisticsRemoteResourceService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.archiveStatisticsRemoteResourceService = archiveStatisticsRemoteResourceService; } diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/ArchiveUserFingerprintService.java b/DLCM-Access/src/main/java/ch/dlcm/service/ArchiveUserFingerprintService.java index e44f02534fdf6fbadb63946716efadb6301bddf7..dc9909c365c8e5bcc8142484d393560d157b72e2 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/ArchiveUserFingerprintService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/ArchiveUserFingerprintService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -26,13 +26,13 @@ package ch.dlcm.service; import java.time.OffsetDateTime; import java.util.List; -import jakarta.servlet.http.HttpServletRequest; - import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.http.HttpHeaders; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; +import jakarta.servlet.http.HttpServletRequest; + import ch.unige.solidify.util.HashTool; import ch.dlcm.config.DLCMProperties; @@ -43,7 +43,6 @@ import ch.dlcm.repository.ArchiveUserFingerprintRepository; @Service @ConditionalOnBean(AccessController.class) public class ArchiveUserFingerprintService { - private final DLCMProperties config; private final HttpServletRequest httpServletRequest; private final int archiveUserFingerprintLifeTimeMinutes; private final ArchiveUserFingerprintRepository archiveUserFingerprintRepository; @@ -52,11 +51,10 @@ public class ArchiveUserFingerprintService { public ArchiveUserFingerprintService(ArchiveUserFingerprintRepository archiveUserFingerprintRepository, HttpServletRequest httpServletRequest, - DLCMProperties config) { + DLCMProperties dlcmProperties) { this.archiveUserFingerprintRepository = archiveUserFingerprintRepository; this.httpServletRequest = httpServletRequest; - this.config = config; - this.archiveUserFingerprintLifeTimeMinutes = config.getParameters().getArchiveUserFingerprintDurationMinutes(); + this.archiveUserFingerprintLifeTimeMinutes = dlcmProperties.getParameters().getArchiveUserFingerprintDurationMinutes(); } public boolean existsUnexpiredArchiveUserFingerprint(String archiveId) { @@ -80,7 +78,7 @@ public class ArchiveUserFingerprintService { archiveUserFingerprint = new ArchiveUserFingerprint(archiveId, fingerprint, ArchiveUserFingerprint.FingerprintType.BACKEND_FINGERPRINT); - archiveUserFingerprint.setExpiration(this.config.getParameters().getArchiveUserFingerprintDurationMinutes()); + archiveUserFingerprint.setExpiration(this.archiveUserFingerprintLifeTimeMinutes); this.archiveUserFingerprintRepository.save(archiveUserFingerprint); return false; diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/DipMgmt.java b/DLCM-Access/src/main/java/ch/dlcm/service/DipMgmt.java index 510935cbdbd5a5807caf8058fda265dd71314e87..8dbe86741bf7df61b86bd712c9c0e90be9a58a60 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/DipMgmt.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/DipMgmt.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -49,8 +49,8 @@ public class DipMgmt extends MessageProcessorBySize<DipMessage> { protected final DipStatusService dipStatusService; protected final DisseminationInfoPackageRepository dipRepository; - public DipMgmt(DipStatusService dipStatusService, DisseminationInfoPackageRepository dipRepository, DLCMProperties configService) { - super(configService); + public DipMgmt(DipStatusService dipStatusService, DisseminationInfoPackageRepository dipRepository, DLCMProperties dlcmProperties) { + super(dlcmProperties); this.dipStatusService = dipStatusService; this.dipRepository = dipRepository; } diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/DipStatusService.java b/DLCM-Access/src/main/java/ch/dlcm/service/DipStatusService.java index 5edca494c9e3020c8cdd20a45eb8f927365302c0..050f4d92c57c3681a2ef53b3ec6e458cb5878ecc 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/DipStatusService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/DipStatusService.java @@ -65,15 +65,14 @@ public class DipStatusService extends DLCMService { public DipStatusService(MessageService messageService, DisseminationInfoPackageRepository dipRepository, TrustedNotificationRemoteResourceService notificationRemoteService, TrustedUserRemoteResourceService userRemoteService, - TrustedOrganizationalUnitRemoteResourceService organizationalUnitRemoteService, DLCMProperties config) { - super(messageService, config); + TrustedOrganizationalUnitRemoteResourceService organizationalUnitRemoteService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.dipRepository = dipRepository; this.notificationRemoteService = notificationRemoteService; this.userRemoteService = userRemoteService; this.organizationalUnitRemoteService = organizationalUnitRemoteService; } - public DisseminationInfoPackage createDIP(String id, String orgUnitId, String name, Access access, List<ArchivalInfoPackage> aips, URI orderUri) { diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/OrderMgmt.java b/DLCM-Access/src/main/java/ch/dlcm/service/OrderMgmt.java index e2307dbf4b7f902774b075dce9649b2311bb5d5e..f4cfa4689d6cb81bf193b94ec0cc13c9e37ac7ca 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/OrderMgmt.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/OrderMgmt.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -46,8 +46,8 @@ public class OrderMgmt extends MessageProcessorBySize<OrderMessage> { protected OrderService orderService; protected OrderStatusService orderStatusService; - public OrderMgmt(OrderStatusService orderStatusService, OrderService orderService, DLCMProperties configService) { - super(configService); + public OrderMgmt(OrderStatusService orderStatusService, OrderService orderService, DLCMProperties dlcmProperties) { + super(dlcmProperties); this.orderStatusService = orderStatusService; this.orderService = orderService; } diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/OrderStatusService.java b/DLCM-Access/src/main/java/ch/dlcm/service/OrderStatusService.java index a07fd6a6a91933075739d092576635a3bb58c54a..1596cd5dfae2856ab9f868b97ad9d7c9fd69b935 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/OrderStatusService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/OrderStatusService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -56,9 +56,9 @@ public class OrderStatusService extends DLCMService { private final AssemblingService assemblingService; private final OrderRepository orderRepository; - public OrderStatusService(MessageService messageService, - OrderRepository orderRepository, AssemblingService assemblingService, DLCMProperties config) { - super(messageService, config); + public OrderStatusService(MessageService messageService, OrderRepository orderRepository, AssemblingService assemblingService, + DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.orderRepository = orderRepository; this.assemblingService = assemblingService; } diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/BasicDipBuilderService.java b/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/BasicDipBuilderService.java index 0de412f46369a71dd59c4fe7cb53a52f7dae48a8..cca795aafdd57d14f67996a62dbbf734d56e3368 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/BasicDipBuilderService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/BasicDipBuilderService.java @@ -51,10 +51,9 @@ public class BasicDipBuilderService extends DipBuilderService { private final String repositoryPrefix; - public BasicDipBuilderService(DLCMProperties config, - MessageService messageService, - MetadataService metadataService, DLCMRepositoryDescription repository) { - super(config, messageService, metadataService); + public BasicDipBuilderService(DLCMProperties dlcmProperties, MessageService messageService, MetadataService metadataService, + DLCMRepositoryDescription repository) { + super(dlcmProperties, messageService, metadataService); this.repositoryPrefix = repository.getName(); } @@ -67,7 +66,7 @@ public class BasicDipBuilderService extends DipBuilderService { @Override public Path getDestinationFolderToUnzipAip(Path rootFolder, ArchivalInfoPackage aip) { - return rootFolder.resolve(aip.getResId()); + return rootFolder.resolve(aip.getResId()); } @Override @@ -81,7 +80,8 @@ public class BasicDipBuilderService extends DipBuilderService { private void extractDataciteMetadata(Path workingFolder, DLCMMetadataVersion metadataVersion) { try { - this.metadataService.extractDataciteMetadataFromFile(workingFolder.resolve(DLCMConstants.METADATA_FILE), Files.newOutputStream(workingFolder.resolve(repositoryPrefix + "-" + DLCMConstants.DATACITE_XML_FIELD)), metadataVersion); + this.metadataService.extractDataciteMetadataFromFile(workingFolder.resolve(DLCMConstants.METADATA_FILE), + Files.newOutputStream(workingFolder.resolve(this.repositoryPrefix + "-" + DLCMConstants.DATACITE_XML_FIELD)), metadataVersion); Files.delete(workingFolder.resolve(DLCMConstants.METADATA_FILE)); } catch (IOException e) { throw new SolidifyRuntimeException("IOException when reading metadata file", e); diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/DipBuilderService.java b/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/DipBuilderService.java index 99d2b711c68a1d083e23ceaee98b23320451cc62..cf000d491d3ea576faf677605086190796cb3432 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/DipBuilderService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/DipBuilderService.java @@ -61,9 +61,9 @@ public abstract class DipBuilderService extends DLCMService { protected final MetadataService metadataService; - protected DipBuilderService(DLCMProperties config, MessageService messageService, + protected DipBuilderService(DLCMProperties dlcmProperties, MessageService messageService, MetadataService metadataService) { - super(messageService, config); + super(messageService, dlcmProperties); this.metadataService = metadataService; } diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/HederaDipBuilderService.java b/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/HederaDipBuilderService.java index 5d8a12b57d52c5a35045e70e1400f4b170b8ce09..9b6a2e13dccd43fc95a36e49f83b1c2cd692e2d4 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/HederaDipBuilderService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/HederaDipBuilderService.java @@ -37,17 +37,16 @@ import ch.dlcm.service.MetadataService; @Service public class HederaDipBuilderService extends DipBuilderService { - public HederaDipBuilderService(DLCMProperties config, + public HederaDipBuilderService(DLCMProperties dlcmProperties, MessageService messageService, MetadataService metadataService) { - super(config, messageService, metadataService); + super(dlcmProperties, messageService, metadataService); } @Override public void buildDip(Path workingFolder, DLCMMetadataVersion metadataVersion) { } - @Override public Path getDestinationFolderToUnzipAip(Path rootFolder, ArchivalInfoPackage aip) { return rootFolder.resolve(aip.getResId()); @@ -61,5 +60,4 @@ public class HederaDipBuilderService extends DipBuilderService { return accessPath; } } - } diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/IiifDipBuilderService.java b/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/IiifDipBuilderService.java index 3fb3de82a7774aac4e87279454d22f104f03d596..933754c8a16368986a7d7d8bdd3f951c911a814f 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/IiifDipBuilderService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/IiifDipBuilderService.java @@ -37,10 +37,10 @@ import ch.dlcm.service.MetadataService; @Service public class IiifDipBuilderService extends DipBuilderService { - public IiifDipBuilderService(DLCMProperties config, + public IiifDipBuilderService(DLCMProperties dlcmProperties, MessageService messageService, MetadataService metadataService) { - super(config, messageService, metadataService); + super(dlcmProperties, messageService, metadataService); } @Override diff --git a/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/OaisDipBuilderService.java b/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/OaisDipBuilderService.java index c8ef269fe4b9036cdd74031c5cd608eede4cdfd1..497da71578987dc9a36766ec685081a76e0bf73a 100644 --- a/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/OaisDipBuilderService.java +++ b/DLCM-Access/src/main/java/ch/dlcm/service/dissemination/OaisDipBuilderService.java @@ -45,10 +45,10 @@ import ch.dlcm.service.MetadataService; @Service public class OaisDipBuilderService extends DipBuilderService { - public OaisDipBuilderService(DLCMProperties config, + public OaisDipBuilderService(DLCMProperties dlcmProperties, MessageService messageService, MetadataService metadataService) { - super(config, messageService, metadataService); + super(dlcmProperties, messageService, metadataService); } @Override @@ -67,7 +67,8 @@ public class OaisDipBuilderService extends DipBuilderService { } @Override - public boolean createDipArchive(String orderLocation, Order order, String dipId, String orgUnitId, Access accessLevel, Path accessPath, Path dipFolder) + public boolean createDipArchive(String orderLocation, Order order, String dipId, String orgUnitId, Access accessLevel, Path accessPath, + Path dipFolder) throws IOException, JAXBException { // For the OAIS dissemination policy, it is needed to generate the dlcm.xml metadata file this.metadataService.generateMetadata(order, dipId, orgUnitId, accessLevel, dipFolder); diff --git a/DLCM-Access/src/test/java/ch/dlcm/test/access/OaiPmhTest.java b/DLCM-Access/src/test/java/ch/dlcm/test/access/OaiPmhTest.java index 82a1401d4e3feff3fa21281e0cd85ab338204645..f0459e15ed5d1d20b801dab9351276a8f97ad44f 100644 --- a/DLCM-Access/src/test/java/ch/dlcm/test/access/OaiPmhTest.java +++ b/DLCM-Access/src/test/java/ch/dlcm/test/access/OaiPmhTest.java @@ -80,7 +80,7 @@ import ch.dlcm.service.rest.trusted.TrustedDepositRemoteResourceService; @ActiveProfiles({ "sec-noauth" }) public class OaiPmhTest extends OAIServiceTest { - protected DLCMProperties dlcmConfig; + protected DLCMProperties dlcmProperties; protected DLCMRepositoryDescription repositoryDescription; protected MetadataService metadataService; protected SearchMgmt searchMgmt; @@ -119,7 +119,7 @@ public class OaiPmhTest extends OAIServiceTest { @Override protected void localSetup() { - this.dlcmConfig = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); + this.dlcmProperties = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); this.repositoryDescription = new DLCMRepositoryDescription(this.gitInfoProperties); this.repositoryDescription.setArchiveHomePage(HOST_URL + "/"); // Metadata Service @@ -128,7 +128,7 @@ public class OaiPmhTest extends OAIServiceTest { this.orgUnitResourceService, this.fallbackAipRemoteResourceService, this.historyService, - this.dlcmConfig, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.gitInfoProperties, @@ -147,7 +147,7 @@ public class OaiPmhTest extends OAIServiceTest { this.trustedAipRemoteResourceService, this.archivePublicMetadataRemoteService, this.archivePrivateMetadataRemoteService, - this.dlcmConfig); + this.dlcmProperties); // Git Info Service this.gitInfoProperties.getBuild().setVersion("1.x"); this.identifierService = new IdentifierService(this.repositoryDescription); @@ -185,7 +185,7 @@ public class OaiPmhTest extends OAIServiceTest { private ArchiveMetadata getMetadata(DLCMMetadataVersion version) throws IOException, JAXBException { ArchiveMetadata archiveMetadata = new ArchiveMetadata(); - archiveMetadata.setIndex(this.dlcmConfig.getIndexing().getIndexName()); + archiveMetadata.setIndex(this.dlcmProperties.getIndexing().getIndexName()); archiveMetadata.setResId(version.getVersion()); archiveMetadata.getMetadata().put(DLCMConstants.AIP_LAST_UPDATE, OffsetDateTime.now().toString()); Path xml = this.getPath("dlcm_mets-" + version.getVersion() + SolidifyConstants.XML_EXT); diff --git a/DLCM-Admin/src/main/java/ch/dlcm/business/ArchiveUserRatingService.java b/DLCM-Admin/src/main/java/ch/dlcm/business/ArchiveUserRatingService.java index e7ff1ad3d5635d7c4271ef9a50de1407b2836a7f..e236e650b159a578ebad34a16094f5f523cef94b 100644 --- a/DLCM-Admin/src/main/java/ch/dlcm/business/ArchiveUserRatingService.java +++ b/DLCM-Admin/src/main/java/ch/dlcm/business/ArchiveUserRatingService.java @@ -37,7 +37,6 @@ import ch.unige.solidify.service.ResourceService; import ch.unige.solidify.util.StringTool; import ch.unige.solidify.validation.ValidationError; -import ch.dlcm.config.DLCMProperties; import ch.dlcm.controller.AdminController; import ch.dlcm.model.dto.AverageRating; import ch.dlcm.model.settings.ArchiveUserRating; @@ -51,15 +50,12 @@ public class ArchiveUserRatingService extends ResourceService<ArchiveUserRating> private static final String NOT_EXIST = "validation.resource.notexist"; - protected final DLCMProperties dlcmProperties; - private final UserService userService; private final RatingTypeService ratingTypeService; private final FallbackArchivePublicMetadataRemoteResourceService archivePublicMetadataRemoteResourceService; - public ArchiveUserRatingService(DLCMProperties dlcmProperties, UserService userService, RatingTypeService ratingTypeService, + public ArchiveUserRatingService(UserService userService, RatingTypeService ratingTypeService, FallbackArchivePublicMetadataRemoteResourceService archivePublicMetadataRemoteResourceService) { - this.dlcmProperties = dlcmProperties; this.userService = userService; this.ratingTypeService = ratingTypeService; this.archivePublicMetadataRemoteResourceService = archivePublicMetadataRemoteResourceService; diff --git a/DLCM-Admin/src/main/java/ch/dlcm/business/PreservationPolicyService.java b/DLCM-Admin/src/main/java/ch/dlcm/business/PreservationPolicyService.java index 0ab22e67cb1f67b870ad633e22415e3262c02071..059982105857aac2c660f160cc54ebf158407ef1 100644 --- a/DLCM-Admin/src/main/java/ch/dlcm/business/PreservationPolicyService.java +++ b/DLCM-Admin/src/main/java/ch/dlcm/business/PreservationPolicyService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -49,21 +49,21 @@ public class PreservationPolicyService extends ResourceService<PreservationPolic private static final String TOO_LONG_RETENTION = "validation.preservationPolicy.tooLongRetentionPeriod"; private static final String INVALID_MAIN_STORAGE = "validation.preservationPolicy.invalidMainStorage"; - private final DLCMProperties dlcmProperties; + private final int maxPreservationPolicyRetentionPeriodInYears; + private final String[] archivalStorageUrls; public PreservationPolicyService(DLCMProperties dlcmProperties) { - this.dlcmProperties = dlcmProperties; + this.maxPreservationPolicyRetentionPeriodInYears = dlcmProperties.getParameters().getMaxPreservationPolicyRetentionPeriodInYears(); + this.archivalStorageUrls = dlcmProperties.getModule().getArchivalStorage().getUrls(); } @Override protected void validateItemSpecificRules(PreservationPolicy preservationPolicy, BindingResult errors) { // Check preservation duration period - final long maxPreservationPolicyRetentionYears = this.dlcmProperties.getParameters().getMaxPreservationPolicyRetentionPeriodInYears(); - - if (preservationPolicy.getRetention() > maxPreservationPolicyRetentionYears * DLCMConstants.DAYS_BY_YEAR) { + if (preservationPolicy.getRetention() > this.maxPreservationPolicyRetentionPeriodInYears * DLCMConstants.DAYS_BY_YEAR) { errors.addError(new FieldError(preservationPolicy.getClass().getSimpleName(), "retention", - this.messageService.get(TOO_LONG_RETENTION, new Object[] { maxPreservationPolicyRetentionYears }))); + this.messageService.get(TOO_LONG_RETENTION, new Object[] { this.maxPreservationPolicyRetentionPeriodInYears }))); } if (preservationPolicy.getRetention() < 0) { @@ -71,9 +71,9 @@ public class PreservationPolicyService extends ResourceService<PreservationPolic } // Check main storage - if (preservationPolicy.getMainStorage() < 0 || preservationPolicy.getMainStorage() >= this.dlcmProperties.getModule().getArchivalStorage().getUrls().length) { + if (preservationPolicy.getMainStorage() < 0 || preservationPolicy.getMainStorage() >= this.archivalStorageUrls.length) { errors.addError(new FieldError(preservationPolicy.getClass().getSimpleName(), "mainStorage", - this.messageService.get(INVALID_MAIN_STORAGE, new Object[] { 0, this.dlcmProperties.getModule().getArchivalStorage().getUrls().length - 1 }))); + this.messageService.get(INVALID_MAIN_STORAGE, new Object[] { 0, this.archivalStorageUrls.length - 1 }))); } } diff --git a/DLCM-Admin/src/main/java/ch/dlcm/controller/AdminController.java b/DLCM-Admin/src/main/java/ch/dlcm/controller/AdminController.java index c3cb94665f6ab91d070215534fb656d7249a2acb..8dd919e642f1edabe4e769d924fb4f13807aafb2 100644 --- a/DLCM-Admin/src/main/java/ch/dlcm/controller/AdminController.java +++ b/DLCM-Admin/src/main/java/ch/dlcm/controller/AdminController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -53,7 +53,7 @@ import ch.dlcm.rest.UrlPath; @RequestMapping(UrlPath.ADMIN) public class AdminController extends ModuleController { - AdminController(DLCMProperties config, + AdminController(DLCMProperties dlcmProperties, LanguageService languageService, RoleService roleService, LicenseService licenseService, @@ -79,9 +79,8 @@ public class AdminController extends ModuleController { archiveTypeService.initRequiredData(); disseminationPolicyService.initRequiredData(); - // Initialize optional data - if (config.getData().isInit()) { + if (dlcmProperties.getData().isInit()) { languageService.initOptionalData(); licenseService.initOptionalData(); fundingAgencyService.initOptionalData(); @@ -90,7 +89,7 @@ public class AdminController extends ModuleController { submissionPolicyService.initOptionalData(); subjectAreaService.initOptionalData(); metadataTypeService.initOptionalData(); - for (DLCMProperties.ScheduledTaskConfig scheduledTaskConfig : config.getScheduledTasks()) { + for (DLCMProperties.ScheduledTaskConfig scheduledTaskConfig : dlcmProperties.getScheduledTasks()) { scheduledTaskService.createScheduledTaskFromConfig(scheduledTaskConfig); } } diff --git a/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/AdminDownloadTokenController.java b/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/AdminDownloadTokenController.java index c1189c3705129fc5aa425f3347f7c33b4ba7d6a6..87dfd0cc762cf97c531cdef8e0e1039fd9a9b8e6 100644 --- a/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/AdminDownloadTokenController.java +++ b/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/AdminDownloadTokenController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -55,9 +55,9 @@ public class AdminDownloadTokenController extends DLCMDownloadTokenController { public AdminDownloadTokenController( DownloadTokenRepository downloadTokenRepository, SolidifyProperties solidifyConfig, - DLCMProperties config) throws URISyntaxException { + DLCMProperties dlcmProperties) throws URISyntaxException { super(solidifyConfig, downloadTokenRepository); - this.adminModulePath = new URI(config.getModule().getAdmin().getPublicUrl()).getPath(); + this.adminModulePath = new URI(dlcmProperties.getModule().getAdmin().getPublicUrl()).getPath(); } @AdminPermissions diff --git a/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/ArchiveUserRatingController.java b/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/ArchiveUserRatingController.java index ee3362bc5b4df3e3779766e15430bb7a8255c2c1..2a07b8734cec22df72ef5ef6cdf6aefa8308c2c8 100644 --- a/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/ArchiveUserRatingController.java +++ b/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/ArchiveUserRatingController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,7 +25,6 @@ package ch.dlcm.controller.admin; import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpEntity; @@ -54,9 +53,12 @@ import ch.dlcm.rest.UrlPath; @RequestMapping(UrlPath.ADMIN_ARCHIVE_RATING) public class ArchiveUserRatingController extends ResourceController<ArchiveUserRating> { - @Autowired protected ArchiveUserRatingService archiveUserRatingService; + public ArchiveUserRatingController(ArchiveUserRatingService archiveUserRatingService) { + this.archiveUserRatingService = archiveUserRatingService; + } + @Override @UserPermissions public HttpEntity<ArchiveUserRating> create(@RequestBody ArchiveUserRating archiveUserRating) { diff --git a/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/OrganizationalUnitAdditionalFieldsFormController.java b/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/OrganizationalUnitAdditionalFieldsFormController.java index 6c57dbc69085e637c42e790292f498eac332ffb0..c547925762b8fa7b7e726c453dd00f0ee941b670 100644 --- a/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/OrganizationalUnitAdditionalFieldsFormController.java +++ b/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/OrganizationalUnitAdditionalFieldsFormController.java @@ -28,8 +28,6 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.util.Map; -import jakarta.validation.Valid; - import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.core.io.FileSystemResource; import org.springframework.data.domain.Pageable; @@ -47,6 +45,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import jakarta.validation.Valid; + import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyRuntimeException; import ch.unige.solidify.rest.ActionName; @@ -59,6 +59,7 @@ import ch.dlcm.model.settings.AdditionalFieldsForm; import ch.dlcm.model.settings.OrganizationalUnit; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; +import ch.dlcm.service.HistoryService; @RestController @ConditionalOnBean(AdminController.class) @@ -66,6 +67,10 @@ import ch.dlcm.rest.UrlPath; @RequestMapping(UrlPath.ADMIN_ORG_UNIT + SolidifyConstants.URL_PARENT_ID + ResourceName.ADDITIONAL_FIELDS_FORMS) public class OrganizationalUnitAdditionalFieldsFormController extends DLCMCompositionController<OrganizationalUnit, AdditionalFieldsForm> { + public OrganizationalUnitAdditionalFieldsFormController(HistoryService historyService) { + super(historyService); + } + @Override @PreAuthorize("@organizationalUnitPermissionService.isAllowed(#parentid, 'GET_FORM')") public HttpEntity<AdditionalFieldsForm> get(@PathVariable String parentid, @PathVariable String id) { diff --git a/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/SystemPropertyController.java b/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/SystemPropertyController.java index 331de42afd45f6650614df99fb98704e40a04e98..6139c316c3ed71b536edfb3ba7404554717e26ad 100644 --- a/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/SystemPropertyController.java +++ b/DLCM-Admin/src/main/java/ch/dlcm/controller/admin/SystemPropertyController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -53,17 +53,17 @@ import ch.dlcm.rest.UrlPath; @RequestMapping(UrlPath.ADMIN_SYSTEM_PROPERTY) public class SystemPropertyController implements ControllerWithHateoasHome { - private final DLCMProperties config; - private final SystemProperties systemProperties; private final TrustedIndexFieldAliasRemoteResourceService indexFieldAliasRemoteService; + private final String indexName; + public SystemPropertyController(DLCMProperties dlcmProperties, SolidifyProperties solidifyProperties, TrustedIndexFieldAliasRemoteResourceService indexFieldAliasRemoteService) { - this.config = dlcmProperties; this.systemProperties = new SystemProperties(dlcmProperties, solidifyProperties); this.indexFieldAliasRemoteService = indexFieldAliasRemoteService; + this.indexName = dlcmProperties.getIndexing().getIndexName(); } @Schema(description = "A system property is defined by the back-end administrators, for the whole system.") @@ -113,7 +113,6 @@ public class SystemPropertyController implements ControllerWithHateoasHome { this.administrativeDataSupported = dlcmProperties.getParameters().isAdministrativeDataEnabled(); this.defaultIdentifierType = dlcmProperties.getParameters().getDefaultIdentifierType().getDescription(); this.orcid = new OrcidConfigDTO(solidifyProperties.getOrcid()); - } public String getDefaultChecksum() { @@ -167,7 +166,7 @@ public class SystemPropertyController implements ControllerWithHateoasHome { @GetMapping public HttpEntity<SystemProperties> systemProperties() { - List<FacetProperties> facetProperties = this.indexFieldAliasRemoteService.getFacetProperties(this.config.getIndexing().getIndexName()); + List<FacetProperties> facetProperties = this.indexFieldAliasRemoteService.getFacetProperties(this.indexName); this.systemProperties.setSearchFacets(facetProperties); this.systemProperties.removeLinks(); this.systemProperties.add(linkTo(this.getClass()).withSelfRel()); diff --git a/DLCM-Admin/src/main/java/ch/dlcm/service/NotificationProcessingService.java b/DLCM-Admin/src/main/java/ch/dlcm/service/NotificationProcessingService.java index e9e9034066dcf30a134330dc0574c40db75a47f3..a564157bfccb3eb06bb2716437903ea3316f7724 100644 --- a/DLCM-Admin/src/main/java/ch/dlcm/service/NotificationProcessingService.java +++ b/DLCM-Admin/src/main/java/ch/dlcm/service/NotificationProcessingService.java @@ -40,23 +40,25 @@ import ch.dlcm.model.notification.NotificationMark; import ch.dlcm.service.rest.fallback.FallbackNotificationRemoteResourceService; @Service -public class NotificationProcessingService extends DLCMService{ +public class NotificationProcessingService extends DLCMService { private static final Logger log = LoggerFactory.getLogger(NotificationProcessingService.class); private final FallbackNotificationRemoteResourceService notificationRemoteResourceService; - protected NotificationProcessingService(MessageService messageService, DLCMProperties config, FallbackNotificationRemoteResourceService notificationService) { - super(messageService, config); + protected NotificationProcessingService(MessageService messageService, DLCMProperties dlcmProperties, + FallbackNotificationRemoteResourceService notificationService) { + super(messageService, dlcmProperties); this.notificationRemoteResourceService = notificationService; } @JmsListener(destination = "${dlcm.queue.notification}") public void processNotificationService(NotificationMessage notificationMessage) { log.trace("Reading message {}", notificationMessage); - RestCollection<Notification> notificationList = this.notificationRemoteResourceService.findByObjectIdAndNotificationType(notificationMessage.getResId(), notificationMessage.getNotificationTypeId()); + RestCollection<Notification> notificationList = this.notificationRemoteResourceService.findByObjectIdAndNotificationType( + notificationMessage.getResId(), notificationMessage.getNotificationTypeId()); if (!notificationList.getData().isEmpty()) { //Get latest notification - Notification notification = notificationList.getData().stream().max(Comparator.comparing(n ->n.getLastUpdate().getWhen())).get(); + Notification notification = notificationList.getData().stream().max(Comparator.comparing(n -> n.getLastUpdate().getWhen())).get(); notification.setNotificationStatus(notificationMessage.getNotificationStatus()); notification.setNotificationMark(NotificationMark.READ); this.notificationRemoteResourceService.updateNotification(notification); diff --git a/DLCM-Admin/src/main/java/ch/dlcm/service/NotificationsEmailService.java b/DLCM-Admin/src/main/java/ch/dlcm/service/NotificationsEmailService.java index 97bdabd852820072b3ec17d6a62a76311d1b3d1d..411cca8fec6db952fc20a334f247375f355731bf 100644 --- a/DLCM-Admin/src/main/java/ch/dlcm/service/NotificationsEmailService.java +++ b/DLCM-Admin/src/main/java/ch/dlcm/service/NotificationsEmailService.java @@ -61,8 +61,8 @@ public class NotificationsEmailService extends DLCMService { private final NotificationService notificationService; protected NotificationsEmailService(MessageService messageService, PersonService personService, UserService userService, - NotificationService notificationService, DLCMProperties config) { - super(messageService, config); + NotificationService notificationService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.personService = personService; this.userService = userService; this.notificationService = notificationService; @@ -213,7 +213,8 @@ public class NotificationsEmailService extends DLCMService { for (String orgUnit : uniqueOrgUnits) { HashMap<String, String> personRoleParams = new HashMap<>(); //send for each org unit, the personId and the objectId implicated - notifications.stream().filter(n-> n.getNotifiedOrgUnit().getResId().equals(orgUnit)).forEach(no -> personRoleParams.put( no.getEmitter().getPerson().getResId(), no.getObjectId())); + notifications.stream().filter(n -> n.getNotifiedOrgUnit().getResId().equals(orgUnit)) + .forEach(no -> personRoleParams.put(no.getEmitter().getPerson().getResId(), no.getObjectId())); parameters.put(orgUnit, personRoleParams); } @@ -276,7 +277,8 @@ public class NotificationsEmailService extends DLCMService { } } - protected void sendEmailAndMarkNotificationAsSent( List<Notification> notifications, EmailMessage.EmailTemplate emailTemplate, User recipientUser, Map<String, Object> parameters ) { + protected void sendEmailAndMarkNotificationAsSent(List<Notification> notifications, EmailMessage.EmailTemplate emailTemplate, + User recipientUser, Map<String, Object> parameters) { // send email SolidifyEventPublisher.getPublisher().publishEvent(new EmailMessage(recipientUser.getEmail(), emailTemplate, parameters)); // mark all notifications as sent diff --git a/DLCM-Admin/src/main/java/ch/dlcm/service/RorService.java b/DLCM-Admin/src/main/java/ch/dlcm/service/RorService.java index c3a8ba7ccf3f632d4bb0166cb63add0d8e486d91..8188e449b5f43adc55e3358cb967beb2b6cfdf35 100644 --- a/DLCM-Admin/src/main/java/ch/dlcm/service/RorService.java +++ b/DLCM-Admin/src/main/java/ch/dlcm/service/RorService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -49,10 +49,10 @@ public class RorService extends DLCMService { private NoTokenRestClientTool restClientTool; private WebUrls webUrls; - public RorService(MessageService messageService, DLCMProperties config, NoTokenRestClientTool restClientTool) { - super(messageService, config); + public RorService(MessageService messageService, DLCMProperties dlcmProperties, NoTokenRestClientTool restClientTool) { + super(messageService, dlcmProperties); this.restClientTool = restClientTool; - this.webUrls = config.getWebUrls(); + this.webUrls = dlcmProperties.getWebUrls(); } @Cacheable(cacheNames = DLCMCacheNames.ROR_INFO) @@ -79,12 +79,12 @@ public class RorService extends DLCMService { } // GRID if (researchOrgDetails.getExternalIds().getGrid() != null) { - researchOrg.getIdentifiers().put(DLCMConstants.GRID, webUrls.getGrid() + researchOrgDetails.getExternalIds().getGrid().getPreferred()); + researchOrg.getIdentifiers().put(DLCMConstants.GRID, this.webUrls.getGrid() + researchOrgDetails.getExternalIds().getGrid().getPreferred()); } // ISNI if (researchOrgDetails.getExternalIds().getIsni() != null) { researchOrg.getIdentifiers().put(DLCMConstants.ISNI, - webUrls.getIsni() + this.getIdentifier(researchOrgDetails.getExternalIds().getIsni())); + this.webUrls.getIsni() + this.getIdentifier(researchOrgDetails.getExternalIds().getIsni())); } // Crossref Funder if (researchOrgDetails.getExternalIds().getCrossrefFunder() != null) { diff --git a/DLCM-Admin/src/main/java/ch/dlcm/service/init/DocumentationDataInitializer.java b/DLCM-Admin/src/main/java/ch/dlcm/service/init/DocumentationDataInitializer.java index 23a3dd96781b4d257e915314ca153214281f93c5..899752a1d22c27ed0fb7c639aa871edcf1d5a7ab 100644 --- a/DLCM-Admin/src/main/java/ch/dlcm/service/init/DocumentationDataInitializer.java +++ b/DLCM-Admin/src/main/java/ch/dlcm/service/init/DocumentationDataInitializer.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -23,6 +23,8 @@ package ch.dlcm.service.init; +import java.util.List; + import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; @@ -39,29 +41,32 @@ import ch.dlcm.model.settings.Person; @ConditionalOnProperty(prefix = "dlcm.module.admin", name = "enable") public class DocumentationDataInitializer { - private final DLCMProperties dlcmProperties; private final ArchiveStatisticsService archiveStatisticsService; private final PersonService personService; private final UserService userService; protected final OrganizationalUnitService organizationalUnitService; + private final boolean shouldGenerateData; + private final List<DLCMProperties.Documentation.User> testUsers; + public DocumentationDataInitializer(DLCMProperties dlcmProperties, ArchiveStatisticsService archiveStatisticsService, PersonService personService, UserService userService, OrganizationalUnitService organizationalUnitService) { - this.dlcmProperties = dlcmProperties; this.archiveStatisticsService = archiveStatisticsService; this.personService = personService; this.userService = userService; this.organizationalUnitService = organizationalUnitService; + this.shouldGenerateData = dlcmProperties.getDocumentation().shouldGenerateData(); + this.testUsers = dlcmProperties.getDocumentation().getUsers(); } @EventListener(ApplicationReadyEvent.class) public void initializeDocumentationData() { - if (this.dlcmProperties.getDocumentation().shouldGenerateData()) { + if (this.shouldGenerateData) { int index = 0; - for (final DLCMProperties.Documentation.User testUser : this.dlcmProperties.getDocumentation().getUsers()) { + for (final DLCMProperties.Documentation.User testUser : this.testUsers) { final Person testPerson = this.personService.createTestPerson(testUser.getName(), index); this.userService.createDocumentationUser(testUser, testPerson); index++; diff --git a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/AIPController.java b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/AIPController.java index ece69a1f52d8da2d547e0b7a3ea828aa4ab09f8b..89280e2b81601484b619daabc914b67c46a0e243 100644 --- a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/AIPController.java +++ b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/AIPController.java @@ -77,8 +77,9 @@ import ch.unige.solidify.util.StringTool; import ch.dlcm.DLCMConstants; import ch.dlcm.DLCMMetadataVersion; -import ch.dlcm.business.AipDataFileService; import ch.dlcm.business.ArchivalInfoPackageService; +import ch.dlcm.business.DataFileService; +import ch.dlcm.config.DLCMProperties; import ch.dlcm.controller.AbstractPackageController; import ch.dlcm.controller.ArchivalStorageController; import ch.dlcm.message.NotificationMessage; @@ -97,6 +98,7 @@ import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; import ch.dlcm.service.DataCategoryService; +import ch.dlcm.service.HistoryService; import ch.dlcm.service.MetadataService; import ch.dlcm.service.rest.propagate.PropagateMetadataTypeRemoteResourceService; import ch.dlcm.storage.StorageService; @@ -111,15 +113,14 @@ public class AIPController extends AbstractPackageController<AipDataFile, Archiv private static final String AIP_IN_PROGRESS = "message.package.inprogress"; protected final StorageService storageService; + protected final String archivalTempLocation; - public AIPController( - PropagateMetadataTypeRemoteResourceService metadataTypeService, - MetadataService metadataService, - StorageService storageService, - AipDataFileService aipDataFileService, - DataCategoryService dataCategoryService) { - super(metadataTypeService, metadataService, aipDataFileService, dataCategoryService); + public AIPController(DLCMProperties dlcmProperties, HistoryService historyService, MetadataService metadataService, + PropagateMetadataTypeRemoteResourceService metadataTypeService, DataFileService<AipDataFile> dataFileService, + DataCategoryService dataCategoryService, StorageService storageService) { + super(historyService, metadataService, metadataTypeService, dataFileService, dataCategoryService); this.storageService = storageService; + this.archivalTempLocation = dlcmProperties.getTempLocation(dlcmProperties.getArchivalLocation()); } @Override @@ -440,7 +441,7 @@ public class AIPController extends AbstractPackageController<AipDataFile, Archiv fileUploadDto.setDataCategory(DataCategory.Package); fileUploadDto.setDataType(DataCategory.InformationPackage); - return this.upload(aipId, fileUploadDto, this.config.getTempLocation(this.config.getArchivalLocation()), UploadMode.STANDARD); + return this.upload(aipId, fileUploadDto, this.archivalTempLocation, UploadMode.STANDARD); } @TrustedUserPermissions @@ -549,7 +550,7 @@ public class AIPController extends AbstractPackageController<AipDataFile, Archiv final Result result = new Result(aipId); if (currentStatus == PackageStatus.COMPLETED && (newStatus == PackageStatus.METADATA_EDITION_PENDING - || newStatus == PackageStatus.METADATA_UPGRADE_PENDING)) { + || newStatus == PackageStatus.METADATA_UPGRADE_PENDING)) { aip.getInfo().setStatus(newStatus); aip = this.itemService.save(aip); result.setStatus(Result.ActionStatus.EXECUTED); diff --git a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/AipDataFileController.java b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/AipDataFileController.java index 0da6d4d1f138278f8bd6916799e0933779c2b3da..99cea99d6106685236d49a47221b7cc88486d1b6 100644 --- a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/AipDataFileController.java +++ b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/AipDataFileController.java @@ -29,8 +29,6 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.lang.reflect.Method; import java.util.Map; -import jakarta.validation.Valid; - import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.core.io.FileSystemResource; import org.springframework.data.domain.Pageable; @@ -47,6 +45,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import jakarta.validation.Valid; + import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyRuntimeException; import ch.unige.solidify.rest.ActionName; @@ -64,6 +64,7 @@ import ch.dlcm.model.oais.ArchivalInfoPackage; import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; +import ch.dlcm.service.HistoryService; @TrustedUserPermissions @RestController @@ -71,6 +72,10 @@ import ch.dlcm.rest.UrlPath; @RequestMapping(UrlPath.ARCHIVAL_STORAGE_AIP + SolidifyConstants.URL_PARENT_ID + ResourceName.DATAFILE) public class AipDataFileController extends AbstractDataFileController<ArchivalInfoPackage, AipDataFile> { + public AipDataFileController(HistoryService historyService) { + super(historyService); + } + @Override public HttpEntity<AipDataFile> create(@PathVariable final String parentid, final @Valid @RequestBody AipDataFile childItem) { return super.create(parentid, childItem); diff --git a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/ArchivalStorageDownloadTokenController.java b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/ArchivalStorageDownloadTokenController.java index 235bf23d88380eb98dae9ae0c2e6297408289568..dba8267f13476ecf93a91f330e279c700d1a8629 100644 --- a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/ArchivalStorageDownloadTokenController.java +++ b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/controller/archivalstorage/ArchivalStorageDownloadTokenController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -55,9 +55,9 @@ public class ArchivalStorageDownloadTokenController extends DLCMDownloadTokenCon public ArchivalStorageDownloadTokenController( DownloadTokenRepository downloadTokenRepository, SolidifyProperties solidifyConfig, - DLCMProperties config) throws URISyntaxException { + DLCMProperties dlcmProperties) throws URISyntaxException { super(solidifyConfig, downloadTokenRepository); - this.archivalStorageModulePath = new URI(config.getModule().getArchivalStorage().getPublicUrls()[0]).getPath(); + this.archivalStorageModulePath = new URI(dlcmProperties.getModule().getArchivalStorage().getPublicUrls()[0]).getPath(); } @GetMapping(UrlPath.ARCHIVAL_STORAGE_AIP + SolidifyConstants.URL_ID_PLUS_SEP + ActionName.DOWNLOAD_TOKEN) diff --git a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AbstractAipService.java b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AbstractAipService.java index b60ebb51d3dce9accb99ddddef30923f50ccd924..51d01bcccb8cff477d278c3bb9cfa075a33974b8 100644 --- a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AbstractAipService.java +++ b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AbstractAipService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -49,8 +49,8 @@ public abstract class AbstractAipService extends DLCMService { HistoryService historyService, TrustedUserRemoteResourceService userRemoteService, TrustedOrganizationalUnitRemoteResourceService organizationalUnitRemoteService, - TrustedNotificationRemoteResourceService notificationRemoteService, DLCMProperties config) { - super(messageService, config); + TrustedNotificationRemoteResourceService notificationRemoteService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.historyService = historyService; this.userRemoteService = userRemoteService; this.organizationalUnitRemoteService = organizationalUnitRemoteService; diff --git a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipCheckMgmt.java b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipCheckMgmt.java index 1cbca4ec743d57697a31141a190356e0b9de5bd8..aaf8ec208f8c624c30439ff42df00185b127a709 100644 --- a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipCheckMgmt.java +++ b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipCheckMgmt.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -48,8 +48,8 @@ public class AipCheckMgmt extends MessageProcessorBySize<AipCheckMessage> { private final ArchivalInfoPackageService aipService; private final AipCheckService checkService; - public AipCheckMgmt(DLCMProperties configService, ArchivalInfoPackageService aipService, AipCheckService checkService) { - super(configService); + public AipCheckMgmt(DLCMProperties dlcmProperties, ArchivalInfoPackageService aipService, AipCheckService checkService) { + super(dlcmProperties); this.aipService = aipService; this.checkService = checkService; } diff --git a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipCheckService.java b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipCheckService.java index ba381c7d80f8d7e56eb4c03e578fbc1e4214439f..90e9f3926d0116f05d082312035ba1a9c018e906 100644 --- a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipCheckService.java +++ b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipCheckService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -83,8 +83,8 @@ public class AipCheckService extends AbstractAipService { TrustedNotificationRemoteResourceService notificationRemoteService, StorageService storageService, ArchivalInfoPackageService aipService, - DLCMProperties config) { - super(messageService, historyService, userRemoteService, organizationalUnitRemoteService, notificationRemoteService, config); + DLCMProperties dlcmProperties) { + super(messageService, historyService, userRemoteService, organizationalUnitRemoteService, notificationRemoteService, dlcmProperties); this.storageService = storageService; this.aipService = aipService; } diff --git a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipMgmt.java b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipMgmt.java index 9eefcda256e39d776eff0fdd9270d7342c6ca3c9..6aa3cab021ede932f07cbb813fa3d7cf63ec322e 100644 --- a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipMgmt.java +++ b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipMgmt.java @@ -47,8 +47,8 @@ public class AipMgmt extends MessageProcessorBySize<AipMessage> { protected final AipStatusService aipStatusService; protected final ArchivalInfoPackageService aipService; - public AipMgmt(AipStatusService aipStatusService, ArchivalInfoPackageService aipService, DLCMProperties configService) { - super(configService); + public AipMgmt(AipStatusService aipStatusService, ArchivalInfoPackageService aipService, DLCMProperties dlcmProperties) { + super(dlcmProperties); this.aipStatusService = aipStatusService; this.aipService = aipService; } diff --git a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipStatusService.java b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipStatusService.java index 89f8960c2383d34034dc067cdee686c85b54e72d..4cb48c9e77dd86b732fe3fa9aebf6afddc51a72d 100644 --- a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipStatusService.java +++ b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/service/AipStatusService.java @@ -117,7 +117,7 @@ public class AipStatusService extends AbstractAipService { private final String orcidSynchroUrl; public AipStatusService( - DLCMProperties config, + DLCMProperties dlcmProperties, MessageService messageService, ArchivalInfoPackageService aipService, StorageService storageService, @@ -129,19 +129,19 @@ public class AipStatusService extends AbstractAipService { TrustedOrganizationalUnitRemoteResourceService organizationalUnitRemoteService, TrustedLicenseRemoteResourceService licenseRemoteResourceService, TrustedRestClientService trustedDLCMRestClientService) { - super(messageService, historyService, userRemoteService, organizationalUnitRemoteService, notificationRemoteService, config); - this.waitMilliseconds = config.getWait().getMilliseconds(); - this.waitMaxTries = config.getWait().getMaxTries(); - this.checksumAlgoList = config.getParameters().getChecksumList(); - this.fileSizeLimit = config.getParameters().getFileSizeLimit().toBytes(); + super(messageService, historyService, userRemoteService, organizationalUnitRemoteService, notificationRemoteService, dlcmProperties); + this.waitMilliseconds = dlcmProperties.getWait().getMilliseconds(); + this.waitMaxTries = dlcmProperties.getWait().getMaxTries(); + this.checksumAlgoList = dlcmProperties.getParameters().getChecksumList(); + this.fileSizeLimit = dlcmProperties.getParameters().getFileSizeLimit().toBytes(); this.aipService = aipService; this.storageService = storageService; this.fileFormatService = fileFormatService; this.virusCheckService = virusCheckService; this.licenseRemoteResourceService = licenseRemoteResourceService; this.trustedDLCMRestClientService = trustedDLCMRestClientService; - this.accessRefreshUrl = config.getModule().getAccess().getUrl() + "/" + DLCMActionName.REFRESH; - this.orcidSynchroUrl = config.getModule().getAdmin().getUrl() + "/" + ResourceName.ORCID_SYNCHRONIZATION + "/" + + this.accessRefreshUrl = dlcmProperties.getModule().getAccess().getUrl() + "/" + DLCMActionName.REFRESH; + this.orcidSynchroUrl = dlcmProperties.getModule().getAdmin().getUrl() + "/" + ResourceName.ORCID_SYNCHRONIZATION + "/" + DLCMActionName.SYNCHRONIZE_ALL_EXISTING; } diff --git a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/storage/StorageService.java b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/storage/StorageService.java index 95f0ccd649095ecc14d692c90e6d74eacb177ac0..f30cad1cf5a4e70702d48ce844459a3f710b137a 100644 --- a/DLCM-ArchivalStorage/src/main/java/ch/dlcm/storage/StorageService.java +++ b/DLCM-ArchivalStorage/src/main/java/ch/dlcm/storage/StorageService.java @@ -121,7 +121,7 @@ public abstract class StorageService extends DLCMService { private final HistoryService historyService; protected StorageService( - DLCMProperties config, + DLCMProperties dlcmProperties, DLCMRepositoryDescription repositoryDescription, MessageService messageService, MetadataService metadataService, @@ -130,16 +130,16 @@ public abstract class StorageService extends DLCMService { FallbackArchivePublicMetadataRemoteResourceService archivePublicMetadataRemoteResourceService, FallbackArchivePrivateMetadataRemoteResourceService archivePrivateMetadataRemoteResourceService, HistoryService historyService) { - super(messageService, config); - this.archivalLocation = config.getArchivalLocation(); + super(messageService, dlcmProperties); + this.archivalLocation = dlcmProperties.getArchivalLocation(); this.repositoryName = repositoryDescription.getName(); this.repositoryInstitution = repositoryDescription.getInstitution(); this.repositoryLocation = repositoryDescription.getLocation(); - this.indexName = config.getIndexing().getIndexName(); - this.indexingExceptions = config.getIndexing().getExceptions(); - this.privateIndexName = config.getIndexing().getPrivateIndexName(); - this.waitMilliseconds = config.getWait().getMilliseconds(); - this.waitMaxTries = config.getWait().getMaxTries(); + this.indexName = dlcmProperties.getIndexing().getIndexName(); + this.indexingExceptions = dlcmProperties.getIndexing().getExceptions(); + this.privateIndexName = dlcmProperties.getIndexing().getPrivateIndexName(); + this.waitMilliseconds = dlcmProperties.getWait().getMilliseconds(); + this.waitMaxTries = dlcmProperties.getWait().getMaxTries(); this.metadataService = metadataService; this.orgUnitResourceService = orgUnitResourceService; this.archivePublicDataRemoteResourceService = archivePublicDataRemoteResourceService; @@ -1084,7 +1084,7 @@ public abstract class StorageService extends DLCMService { // First check premis data category anda datatype to take the file object according to it. List<Object> itemList = (List<Object>) ((Map<String, Object>) ((Map<String, Object>) archiveMetadata.getMetadata() .get(DLCMConstants.PREMIS_FIELD)) - .get(DLCMConstants.ITEMS_FIELD)).get(DLCMConstants.ITEM_FIELD); + .get(DLCMConstants.ITEMS_FIELD)).get(DLCMConstants.ITEM_FIELD); for (Object obj : itemList) { Map<String, Object> item = ((Map<String, Object>) obj); if (item.get(DLCMConstants.TYPE_FIELD).equals("dataFile")) { @@ -1152,8 +1152,8 @@ public abstract class StorageService extends DLCMService { // Check all files from thumbnail, readme and dua extension and check if their timestamp from the filename is later from the last time // the aip was completed, meaning the file has being updated since. List<Path> filesToUpdated = allUpdatedFiles.stream().filter(file -> file.getFileName().toString().endsWith(DLCMConstants.THUMBNAIL_EXTENSION) - || file.getFileName().toString().endsWith(DLCMConstants.README_EXTENSION) - || file.getFileName().toString().endsWith(DLCMConstants.DUA_EXTENSION)) + || file.getFileName().toString().endsWith(DLCMConstants.README_EXTENSION) + || file.getFileName().toString().endsWith(DLCMConstants.DUA_EXTENSION)) .filter(file -> { String timestamp = file.getFileName().toString() .substring(file.getFileName().toString().indexOf("-") + 1, file.getFileName().toString().lastIndexOf(".")); diff --git a/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/DNAStorageServiceTest.java b/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/DNAStorageServiceTest.java index 44ebd95554b529be5cd59586420a60bd7e416e5a..a50207b24462fee40783e8beb7b0c1e90051e2f8 100644 --- a/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/DNAStorageServiceTest.java +++ b/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/DNAStorageServiceTest.java @@ -54,12 +54,12 @@ class DNAStorageServiceTest extends StorageServiceTest { public void setup() { super.setUp(); // DLCM Properties - this.config = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); - this.config.setHome(this.workingDir.toAbsolutePath().toString()); - this.config.getStorage().getDnaProperties().setCodecType("test-codec"); - this.config.getStorage().setUrl(this.storageDir.toAbsolutePath().toUri().toString()); - this.config.getSecuredStorage().getDnaProperties().setCodecType("test-codec"); - this.config.getSecuredStorage().setUrl(this.securedStorageDir.toAbsolutePath().toUri().toString()); + this.dlcmProperties = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); + this.dlcmProperties.setHome(this.workingDir.toAbsolutePath().toString()); + this.dlcmProperties.getStorage().getDnaProperties().setCodecType("test-codec"); + this.dlcmProperties.getStorage().setUrl(this.storageDir.toAbsolutePath().toUri().toString()); + this.dlcmProperties.getSecuredStorage().getDnaProperties().setCodecType("test-codec"); + this.dlcmProperties.getSecuredStorage().setUrl(this.securedStorageDir.toAbsolutePath().toUri().toString()); // DLCM Repository description this.repositoryDescription = new DLCMRepositoryDescription(this.gitInfoProperties); // Services @@ -68,7 +68,7 @@ class DNAStorageServiceTest extends StorageServiceTest { this.fallbackOrgUnitRemoteService, this.fallbackAipRemoteService, this.historyService, - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.gitInfoProperties, @@ -82,7 +82,7 @@ class DNAStorageServiceTest extends StorageServiceTest { this.fallbackArchiveTypeResourceService, this.trustedDepositRemoteService); this.storageService = new DNAStorageService( - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.metadataService, diff --git a/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/FileStorageServiceTest.java b/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/FileStorageServiceTest.java index f8f9ebcd5684679de01c05d220faab7486e4cb1b..2ba01df99e12ce6bc370564ebd0a4303505ab8c1 100644 --- a/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/FileStorageServiceTest.java +++ b/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/FileStorageServiceTest.java @@ -58,10 +58,10 @@ class FileStorageServiceTest extends StorageServiceTest { public void setup() { super.setUp(); // DLCM Properties - this.config = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); - this.config.setHome(this.workingDir.toAbsolutePath().toString()); - this.config.getStorage().setUrl(this.storageDir.toAbsolutePath().toUri().toString()); - this.config.getSecuredStorage().setUrl(this.securedStorageDir.toAbsolutePath().toUri().toString()); + this.dlcmProperties = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); + this.dlcmProperties.setHome(this.workingDir.toAbsolutePath().toString()); + this.dlcmProperties.getStorage().setUrl(this.storageDir.toAbsolutePath().toUri().toString()); + this.dlcmProperties.getSecuredStorage().setUrl(this.securedStorageDir.toAbsolutePath().toUri().toString()); // DLCM Repository description this.repositoryDescription = new DLCMRepositoryDescription(this.gitInfoProperties); // Services @@ -70,7 +70,7 @@ class FileStorageServiceTest extends StorageServiceTest { this.fallbackOrgUnitRemoteService, this.fallbackAipRemoteService, this.historyService, - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.gitInfoProperties, @@ -84,7 +84,7 @@ class FileStorageServiceTest extends StorageServiceTest { this.fallbackArchiveTypeResourceService, this.trustedDepositRemoteService); this.storageService = new FileStorageService( - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.metadataService, diff --git a/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/S3StorageServiceTest.java b/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/S3StorageServiceTest.java index e8fa0b3b2180bc0ac574f6b192ceab4f91096d5a..dd0f802686f74dd50983b2933285ce5761e69d62 100644 --- a/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/S3StorageServiceTest.java +++ b/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/S3StorageServiceTest.java @@ -61,12 +61,12 @@ class S3StorageServiceTest extends StorageServiceTest { public void setup() { super.setUp(); // DLCM Properties - this.config = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); - this.config.setHome(this.workingDir.toAbsolutePath().toString()); - this.config.getStorage().setUrl(S3_URL); - this.config.getStorage().getS3Properties().setSpace(S3_BUCKET); - this.config.getStorage().getS3Properties().setAccessKey(S3_ACCESS_KEY); - this.config.getStorage().getS3Properties().setSecretKey(S3_SECRET_KEY); + this.dlcmProperties = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); + this.dlcmProperties.setHome(this.workingDir.toAbsolutePath().toString()); + this.dlcmProperties.getStorage().setUrl(S3_URL); + this.dlcmProperties.getStorage().getS3Properties().setSpace(S3_BUCKET); + this.dlcmProperties.getStorage().getS3Properties().setAccessKey(S3_ACCESS_KEY); + this.dlcmProperties.getStorage().getS3Properties().setSecretKey(S3_SECRET_KEY); // DLCM Repository description this.repositoryDescription = new DLCMRepositoryDescription(this.gitInfoProperties); // Services @@ -75,7 +75,7 @@ class S3StorageServiceTest extends StorageServiceTest { this.fallbackOrgUnitRemoteService, this.fallbackAipRemoteService, this.historyService, - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.gitInfoProperties, @@ -89,7 +89,7 @@ class S3StorageServiceTest extends StorageServiceTest { this.fallbackArchiveTypeResourceService, this.trustedDepositRemoteService); this.storageService = new S3StorageService( - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.metadataService, diff --git a/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/StorageServiceTest.java b/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/StorageServiceTest.java index 79d7408721af07d5e055b2c281554a23dac1a1cb..4738c260e19bc44337bee1c9d8d6f796cc961669 100644 --- a/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/StorageServiceTest.java +++ b/DLCM-ArchivalStorage/src/test/java/ch/dlcm/test/storage/StorageServiceTest.java @@ -103,7 +103,7 @@ public abstract class StorageServiceTest { private static final String ORG_UNIT_ID = DLCMConstants.DB_ORG_UNIT_ID; - protected DLCMProperties config; + protected DLCMProperties dlcmProperties; protected DLCMRepositoryDescription repositoryDescription; protected Path storageDir = Paths.get("src", "test", "resources", "storage"); protected Path securedStorageDir = Paths.get("src", "test", "resources", "securedStorage"); @@ -326,7 +326,7 @@ public abstract class StorageServiceTest { protected void runStorageTest(int expectedFileNumber, ArchivalInfoPackage aip) throws Exception { final String prefix = "[Archive " + aip.getInfo().getMetadataVersion().getVersion() + "] "; - this.processDataFiles(Paths.get(this.config.getArchivalLocation()), aip); + this.processDataFiles(Paths.get(this.dlcmProperties.getArchivalLocation()), aip); this.storageService.checkAIP(aip); this.storageService.storeAIP(aip); String archiveId; @@ -345,7 +345,7 @@ public abstract class StorageServiceTest { } private void setChecksum(AipDataFile df) throws NoSuchAlgorithmException, IOException { - final String[] algoList = this.config.getParameters().getChecksumList(); + final String[] algoList = this.dlcmProperties.getParameters().getChecksumList(); final String[] checksumList = ChecksumTool.computeChecksum( new BufferedInputStream(new FileInputStream(Paths.get(df.getFinalData()).toFile()), SolidifyConstants.BUFFER_SIZE), algoList); diff --git a/DLCM-Common/src/main/java/ch/dlcm/config/DLCMProperties.java b/DLCM-Common/src/main/java/ch/dlcm/config/DLCMProperties.java index 4ebe76ae5de8aa657503cf28a3d898142130ca6c..ac1a410009fd6b291524d0e57cdfe318534b0a00 100644 --- a/DLCM-Common/src/main/java/ch/dlcm/config/DLCMProperties.java +++ b/DLCM-Common/src/main/java/ch/dlcm/config/DLCMProperties.java @@ -28,7 +28,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import org.slf4j.Logger; @@ -43,7 +42,6 @@ import jakarta.annotation.PostConstruct; import ch.unige.solidify.IndexApplicationProperties; import ch.unige.solidify.IndexConstants; import ch.unige.solidify.config.SolidifyProperties; -import ch.unige.solidify.exception.SolidifyRuntimeException; import ch.unige.solidify.model.index.IndexDefinition; import ch.unige.solidify.model.index.IndexDefinitionList; @@ -1454,25 +1452,7 @@ public class DLCMProperties implements IndexApplicationProperties { public String[] getArchivalStoragePublicUrls() { return this.getModule().getArchivalStorage().getPublicUrls(); } - - public String getPublicArchivalStorageUrlFromInternalUrl(String url) { - String[] internalArchivalStorageUrls = this.getArchivalStorageUrls(); - String[] publicArchivalStorageUrls = this.getArchivalStoragePublicUrls(); - - if (Arrays.asList(publicArchivalStorageUrls).contains(url)) { - // url is already public - return url; - } - - for (int i = 0; i < internalArchivalStorageUrls.length; i++) { - if (internalArchivalStorageUrls[i].equals(url)) { - return publicArchivalStorageUrls[i]; - } - } - - throw new SolidifyRuntimeException("No public storage URL found for internal storage URL '" + url + "'"); - } - + // Get default/master archival storage module public String getDefaultArchivalStorageUrl() { return this.getModule().getArchivalStorage().getUrls()[0]; diff --git a/DLCM-DataMgmt/src/main/java/ch/dlcm/controller/DataMgmtController.java b/DLCM-DataMgmt/src/main/java/ch/dlcm/controller/DataMgmtController.java index 5de70d8da541f1c129c0a3c9fd7b318f2f31d22f..d4980624d43a007e6bb458011447d1a7684aabd6 100644 --- a/DLCM-DataMgmt/src/main/java/ch/dlcm/controller/DataMgmtController.java +++ b/DLCM-DataMgmt/src/main/java/ch/dlcm/controller/DataMgmtController.java @@ -44,19 +44,19 @@ public class DataMgmtController extends ModuleController { private final IndexFieldAliasService indexFieldAliasService; - DataMgmtController(DLCMProperties config, IndexingSettingsService<IndexProperties> indexSettingsService, + DataMgmtController(DLCMProperties dlcmProperties, IndexingSettingsService<IndexProperties> indexSettingsService, IndexFieldAliasService indexFieldAliasService) { super(ModuleName.DATAMGMT); this.indexFieldAliasService = indexFieldAliasService; // Module initialization - if (config.getData().isInitIndexes()) { + if (dlcmProperties.getData().isInitIndexes()) { // Index creation - indexSettingsService.init(config.getIndexing().getIndexDefinitionList()); + indexSettingsService.init(dlcmProperties.getIndexing().getIndexDefinitionList()); } - if (config.getData().isInit()) { + if (dlcmProperties.getData().isInit()) { // Index Field Alias creation - this.initDataForPublicIndex(config.getIndexing().getIndexName()); - this.initDataForPrivateIndex(config.getIndexing().getPrivateIndexName()); + this.initDataForPublicIndex(dlcmProperties.getIndexing().getIndexName()); + this.initDataForPrivateIndex(dlcmProperties.getIndexing().getPrivateIndexName()); } } diff --git a/DLCM-Ingest/src/main/java/ch/dlcm/business/SubmissionInfoPackageService.java b/DLCM-Ingest/src/main/java/ch/dlcm/business/SubmissionInfoPackageService.java index 5c4bcbeeacd01aeaea45738e6006441a803d1bea..1defc199fad419b4b07b18dddb048be782aae102 100644 --- a/DLCM-Ingest/src/main/java/ch/dlcm/business/SubmissionInfoPackageService.java +++ b/DLCM-Ingest/src/main/java/ch/dlcm/business/SubmissionInfoPackageService.java @@ -38,11 +38,13 @@ import ch.unige.solidify.config.SolidifyEventPublisher; import ch.unige.solidify.exception.SolidifyRuntimeException; import ch.unige.solidify.rest.Resource; import ch.unige.solidify.rest.Result; +import ch.unige.solidify.service.HttpRequestInfoProvider; import ch.unige.solidify.service.RemoteResourceService; import ch.unige.solidify.util.FileTool; import ch.unige.solidify.util.StringTool; import ch.dlcm.DLCMConstants; +import ch.dlcm.config.DLCMProperties; import ch.dlcm.controller.IngestController; import ch.dlcm.message.SipMessage; import ch.dlcm.model.PackageStatus; @@ -51,6 +53,7 @@ import ch.dlcm.model.oais.SubmissionInfoPackage; import ch.dlcm.model.policies.SubmissionPolicy; import ch.dlcm.model.settings.OrganizationalUnit; import ch.dlcm.repository.SubmissionInfoPackageRepository; +import ch.dlcm.service.HistoryService; import ch.dlcm.service.rest.fallback.FallbackArchivalInfoPackageRemoteResourceService; import ch.dlcm.service.rest.fallback.FallbackOrganizationalUnitRemoteResourceService; import ch.dlcm.service.rest.fallback.FallbackSubmissionPolicyRemoteResourceService; @@ -72,11 +75,12 @@ public class SubmissionInfoPackageService extends InfoPackageService<SubmissionI private final SipDataFileService sipDataFileService; private final TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService; - public SubmissionInfoPackageService( + public SubmissionInfoPackageService(DLCMProperties dlcmProperties, HttpRequestInfoProvider httpRequestInfoProvider, + SpecificationPermissionsFilter<SubmissionInfoPackage> specificationPermissionFilter, HistoryService historyService, FallbackArchivalInfoPackageRemoteResourceService aipService, FallbackOrganizationalUnitRemoteResourceService organizationalUnitService, - FallbackSubmissionPolicyRemoteResourceService submissionPolicyService, - SipDataFileService sipDataFileService, + FallbackSubmissionPolicyRemoteResourceService submissionPolicyService, SipDataFileService sipDataFileService, TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService) { + super(dlcmProperties, httpRequestInfoProvider, specificationPermissionFilter, historyService); this.aipService = aipService; this.organizationalUnitService = organizationalUnitService; this.submissionPolicyService = submissionPolicyService; @@ -128,7 +132,7 @@ public class SubmissionInfoPackageService extends InfoPackageService<SubmissionI public boolean putPackageInProcessingQueue(SubmissionInfoPackage sip) { switch (sip.getInfo().getStatus()) { case IN_PREPARATION, CLEANING, RESUBMITTING, EDITING_METADATA, UPGRADING_METADATA -> { - boolean isBigPackage = this.getSize(sip.getResId()) > this.dlcmProperties.getParameters().getFileSizeLimit().toBytes(); + boolean isBigPackage = this.getSize(sip.getResId()) > this.fileSizeLimit.toBytes(); SolidifyEventPublisher.getPublisher().publishEvent(new SipMessage(sip.getResId(), isBigPackage)); return true; } diff --git a/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/IngestDownloadTokenController.java b/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/IngestDownloadTokenController.java index 19a504df29740d3e0ce823c3f9a899e6f2e2eb5a..ff0590b0d153649f03eecd86a93485321466969a 100644 --- a/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/IngestDownloadTokenController.java +++ b/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/IngestDownloadTokenController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -55,9 +55,9 @@ public class IngestDownloadTokenController extends DLCMDownloadTokenController { public IngestDownloadTokenController( DownloadTokenRepository downloadTokenRepository, SolidifyProperties solidifyConfig, - DLCMProperties config) throws URISyntaxException { + DLCMProperties dlcmProperties) throws URISyntaxException { super(solidifyConfig, downloadTokenRepository); - this.ingestModulePath = new URI(config.getModule().getIngest().getPublicUrl()).getPath(); + this.ingestModulePath = new URI(dlcmProperties.getModule().getIngest().getPublicUrl()).getPath(); } @GetMapping(UrlPath.INGEST_SIP + SolidifyConstants.URL_ID_PLUS_SEP + ActionName.DOWNLOAD_TOKEN) diff --git a/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/SIPController.java b/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/SIPController.java index ba1fa84577bb7a756af10003a1084487085d0606..59e0fe95ad50faf8a61294ae4f0e53b5c5ec5c45 100644 --- a/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/SIPController.java +++ b/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/SIPController.java @@ -66,8 +66,9 @@ import ch.unige.solidify.util.FileTool; import ch.dlcm.DLCMConstants; import ch.dlcm.DLCMMetadataVersion; -import ch.dlcm.business.SipDataFileService; +import ch.dlcm.business.DataFileService; import ch.dlcm.business.SubmissionInfoPackageService; +import ch.dlcm.config.DLCMProperties; import ch.dlcm.controller.AbstractPackageController; import ch.dlcm.controller.IngestController; import ch.dlcm.model.DataCategory; @@ -80,6 +81,7 @@ import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; import ch.dlcm.service.DataCategoryService; +import ch.dlcm.service.HistoryService; import ch.dlcm.service.MetadataService; import ch.dlcm.service.rest.propagate.PropagateMetadataTypeRemoteResourceService; @@ -88,12 +90,13 @@ import ch.dlcm.service.rest.propagate.PropagateMetadataTypeRemoteResourceService @RequestMapping(UrlPath.INGEST_SIP) public class SIPController extends AbstractPackageController<SipDataFile, SubmissionInfoPackage> { - public SIPController( - PropagateMetadataTypeRemoteResourceService metadataTypeService, - MetadataService metadataService, - SipDataFileService sipDataFileService, + protected final String ingestTempLocation; + + public SIPController(DLCMProperties dlcmProperties, HistoryService historyService, MetadataService metadataService, + PropagateMetadataTypeRemoteResourceService metadataTypeService, DataFileService<SipDataFile> dataFileService, DataCategoryService dataCategoryService) { - super(metadataTypeService, metadataService, sipDataFileService, dataCategoryService); + super(historyService, metadataService, metadataTypeService, dataFileService, dataCategoryService); + this.ingestTempLocation = dlcmProperties.getTempLocation(dlcmProperties.getIngestLocation()); } @Override @@ -279,7 +282,7 @@ public class SIPController extends AbstractPackageController<SipDataFile, Submis fileUploadDto.setDataCategory(DataCategory.Package); fileUploadDto.setDataType(DataCategory.InformationPackage); - return this.upload(id, fileUploadDto, this.config.getTempLocation(this.config.getIngestLocation()), UploadMode.STANDARD); + return this.upload(id, fileUploadDto, this.ingestTempLocation, UploadMode.STANDARD); } @TrustedUserPermissions diff --git a/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/SipDataFileController.java b/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/SipDataFileController.java index 0cdcb46b916b2f3ec7985eb72b6df05ace405bfc..e65472ba832ef38dcb2904cbf5b6fd0c3efbc8ea 100644 --- a/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/SipDataFileController.java +++ b/DLCM-Ingest/src/main/java/ch/dlcm/controller/ingest/SipDataFileController.java @@ -29,8 +29,6 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.lang.reflect.Method; import java.util.Map; -import jakarta.validation.Valid; - import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.core.io.FileSystemResource; import org.springframework.data.domain.Pageable; @@ -47,6 +45,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import jakarta.validation.Valid; + import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyRuntimeException; import ch.unige.solidify.rest.ActionName; @@ -63,12 +63,17 @@ import ch.dlcm.model.oais.SubmissionInfoPackage; import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; +import ch.dlcm.service.HistoryService; @RestController @ConditionalOnBean(IngestController.class) @RequestMapping(UrlPath.INGEST_SIP + SolidifyConstants.URL_PARENT_ID + ResourceName.DATAFILE) public class SipDataFileController extends AbstractDataFileController<SubmissionInfoPackage, SipDataFile> { + public SipDataFileController(HistoryService historyService) { + super(historyService); + } + @Override @PreAuthorize("@submissionInfoPackagePermissionService.isAllowed(#parentid, 'UPLOAD_FILE')") public HttpEntity<SipDataFile> create(@PathVariable final String parentid, final @Valid @RequestBody SipDataFile childItem) { diff --git a/DLCM-Ingest/src/main/java/ch/dlcm/ingestion/IngestionService.java b/DLCM-Ingest/src/main/java/ch/dlcm/ingestion/IngestionService.java index 2dd840d75d5daa2a2d1a3effb3fe3d77ebb52474..2c4e7825c897ab1ede711070fe623d96a787f69a 100644 --- a/DLCM-Ingest/src/main/java/ch/dlcm/ingestion/IngestionService.java +++ b/DLCM-Ingest/src/main/java/ch/dlcm/ingestion/IngestionService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -63,13 +63,13 @@ public abstract class IngestionService extends DLCMService { private final FallbackArchivalInfoPackageRemoteResourceService aipRemoteResourceService; protected IngestionService( - DLCMProperties config, + DLCMProperties dlcmProperties, MessageService messageService, MetadataService metadataService, FallbackOrganizationalUnitRemoteResourceService orgUnitResourceService, FallbackArchivalInfoPackageRemoteResourceService aipRemoteResourceService) { - super(messageService, config); - this.ingestLocation = config.getIngestLocation(); + super(messageService, dlcmProperties); + this.ingestLocation = dlcmProperties.getIngestLocation(); this.metadataService = metadataService; this.orgUnitResourceService = orgUnitResourceService; this.aipRemoteResourceService = aipRemoteResourceService; diff --git a/DLCM-Ingest/src/main/java/ch/dlcm/ingestion/bagit/BagItIngestionService.java b/DLCM-Ingest/src/main/java/ch/dlcm/ingestion/bagit/BagItIngestionService.java index 9dca74dd553f7d2cd2402bdee940fc7e96e567ee..411cd9cf8121c9a51bc7eafa45c7412ee29f7164 100644 --- a/DLCM-Ingest/src/main/java/ch/dlcm/ingestion/bagit/BagItIngestionService.java +++ b/DLCM-Ingest/src/main/java/ch/dlcm/ingestion/bagit/BagItIngestionService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -63,13 +63,13 @@ public class BagItIngestionService extends IngestionService { private final String repositoryLocation; public BagItIngestionService( - DLCMProperties config, + DLCMProperties dlcmProperties, DLCMRepositoryDescription repositoryDescription, MessageService messageService, MetadataService metadataService, FallbackOrganizationalUnitRemoteResourceService orgUnitResourceService, FallbackArchivalInfoPackageRemoteResourceService aipRemoteResourceService) { - super(config, messageService, metadataService, orgUnitResourceService, aipRemoteResourceService); + super(dlcmProperties, messageService, metadataService, orgUnitResourceService, aipRemoteResourceService); this.repositoryName = repositoryDescription.getName(); this.repositoryInstitution = repositoryDescription.getInstitution(); this.repositoryLocation = repositoryDescription.getLocation(); diff --git a/DLCM-Ingest/src/main/java/ch/dlcm/service/SipMgmt.java b/DLCM-Ingest/src/main/java/ch/dlcm/service/SipMgmt.java index 41cd16c39a1ec446bd1914d1fc78d1f87424d54d..c399be480ee497c319909ac5867ff89fc6674c35 100644 --- a/DLCM-Ingest/src/main/java/ch/dlcm/service/SipMgmt.java +++ b/DLCM-Ingest/src/main/java/ch/dlcm/service/SipMgmt.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -50,8 +50,8 @@ public class SipMgmt extends MessageProcessorBySize<SipMessage> { public SipMgmt(SubmissionInfoPackageService sipService, SipStatusService sipStatusService, - DLCMProperties configService) { - super(configService); + DLCMProperties dlcmProperties) { + super(dlcmProperties); this.sipService = sipService; this.sipStatusService = sipStatusService; } diff --git a/DLCM-Ingest/src/main/java/ch/dlcm/service/SipStatusService.java b/DLCM-Ingest/src/main/java/ch/dlcm/service/SipStatusService.java index bcd9baec2dfed6666586bff325db5d2f5cbac8bd..14fb2646f3c994cc2eb835ff4f2d51ee48f94912 100644 --- a/DLCM-Ingest/src/main/java/ch/dlcm/service/SipStatusService.java +++ b/DLCM-Ingest/src/main/java/ch/dlcm/service/SipStatusService.java @@ -74,8 +74,8 @@ public class SipStatusService extends DLCMService { public SipStatusService(MessageService messageService, SubmissionInfoPackageService sipService, IngestionService ingestionService, SipDataFileService sipDataFileService, TrustedNotificationRemoteResourceService notificationRemoteService, TrustedUserRemoteResourceService userRemoteService, - TrustedOrganizationalUnitRemoteResourceService organizationalUnitRemoteService, DLCMProperties config) { - super(messageService, config); + TrustedOrganizationalUnitRemoteResourceService organizationalUnitRemoteService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.sipService = sipService; this.ingestionService = ingestionService; this.sipDataFileService = sipDataFileService; diff --git a/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/BagItIngestionServiceTest.java b/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/BagItIngestionServiceTest.java index 7c62293326c15653b2c5617eeeea25fd4a98b965..4a5133615ad995c8bc8f4342ac8562fa1d32fa3b 100644 --- a/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/BagItIngestionServiceTest.java +++ b/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/BagItIngestionServiceTest.java @@ -48,7 +48,7 @@ class BagItIngestionServiceTest extends IngestionServiceTest { @Test void ingestionTest() { // get the number of checksum algo and multiply by 2 , for every algo we have tw2 files : tagmanifest-XXX.txt, manifest-XXX.txt - int totalFiles = (this.config.getParameters().getChecksumList().length * 2) + DLCMConstants.BAGIT_FIXED_FILES.size(); + int totalFiles = (this.dlcmProperties.getParameters().getChecksumList().length * 2) + DLCMConstants.BAGIT_FIXED_FILES.size(); this.runTests(totalFiles); } @@ -57,10 +57,10 @@ class BagItIngestionServiceTest extends IngestionServiceTest { super.setUp(); // DLCM Properties this.containerArchiveFileNumber = 8; - this.config = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); - this.config.setHome(this.workingDir.toAbsolutePath().toString()); - this.config.getParameters().setDefaultChecksum("MD5"); - this.config.getParameters().setChecksumList(new String[] { "MD5", "SHA1" }); + this.dlcmProperties = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); + this.dlcmProperties.setHome(this.workingDir.toAbsolutePath().toString()); + this.dlcmProperties.getParameters().setDefaultChecksum("MD5"); + this.dlcmProperties.getParameters().setChecksumList(new String[] { "MD5", "SHA1" }); // DLCM Repository description this.repositoryDescription = new DLCMRepositoryDescription(this.gitInfoProperties); // Services @@ -69,7 +69,7 @@ class BagItIngestionServiceTest extends IngestionServiceTest { this.fallbackOrgUnitRemoteService, this.fallbackAipRemoteService, this.historyService, - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.gitInfoProperties, @@ -83,7 +83,7 @@ class BagItIngestionServiceTest extends IngestionServiceTest { this.fallbackArchiveTypeResourceService, this.trustedDepositRemoteService); this.ingestionService = new BagItIngestionService( - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.metadataService, diff --git a/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/IngestionServiceTest.java b/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/IngestionServiceTest.java index e1a38a6852a9b76df868e25e7d79c0a88a8c6400..de135ae9acc333dfa26e5654100ed664feb21b01 100644 --- a/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/IngestionServiceTest.java +++ b/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/IngestionServiceTest.java @@ -34,11 +34,11 @@ import java.nio.file.Paths; import java.security.NoSuchAlgorithmException; import java.time.OffsetDateTime; -import jakarta.xml.bind.JAXBException; - import org.junit.jupiter.api.AfterEach; import org.mockito.Mock; +import jakarta.xml.bind.JAXBException; + import ch.unige.solidify.ChecksumAlgorithm; import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyCheckingException; @@ -89,7 +89,7 @@ public abstract class IngestionServiceTest { private static final String ORG_UNIT_ID = DLCMConstants.DB_ORG_UNIT_ID; - protected DLCMProperties config; + protected DLCMProperties dlcmProperties; protected DLCMRepositoryDescription repositoryDescription; protected int containerArchiveFileNumber = 0; protected int archiveFileNumber = 0; @@ -148,7 +148,7 @@ public abstract class IngestionServiceTest { protected void runTest(Path source, DLCMMetadataVersion version) throws Exception { final SubmissionInfoPackage sip = this.getSip(source, version); - this.runSipTest(this.config.getIngestLocation(), sip); + this.runSipTest(this.dlcmProperties.getIngestLocation(), sip); } protected void runTests(int containerFileNumber) { @@ -244,7 +244,7 @@ public abstract class IngestionServiceTest { } private void setChecksum(SipDataFile df) throws NoSuchAlgorithmException, IOException { - final String[] algoList = this.config.getParameters().getChecksumList(); + final String[] algoList = this.dlcmProperties.getParameters().getChecksumList(); final String[] checksumList = ChecksumTool.computeChecksum( new BufferedInputStream(new FileInputStream(Paths.get(df.getFinalData()).toFile()), SolidifyConstants.BUFFER_SIZE), algoList); diff --git a/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/ZipIngestionServiceTest.java b/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/ZipIngestionServiceTest.java index 51963be3ddfaf3892e6b0aacea15445640fd95f5..7176e75ed83c5f4eaab2401a523615278b56a9f6 100644 --- a/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/ZipIngestionServiceTest.java +++ b/DLCM-Ingest/src/test/java/ch/dlcm/test/ingestion/ZipIngestionServiceTest.java @@ -53,10 +53,10 @@ class ZipIngestionServiceTest extends IngestionServiceTest { public void setup() { super.setUp(); // DLCM Properties - this.config = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); - this.config.setHome(this.workingDir.toAbsolutePath().toString()); - this.config.getParameters().setDefaultChecksum("MD5"); - this.config.getParameters().setChecksumList(new String[] { "MD5" }); + this.dlcmProperties = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); + this.dlcmProperties.setHome(this.workingDir.toAbsolutePath().toString()); + this.dlcmProperties.getParameters().setDefaultChecksum("MD5"); + this.dlcmProperties.getParameters().setChecksumList(new String[] { "MD5" }); // DLCM Repository description this.repositoryDescription = new DLCMRepositoryDescription(this.gitInfoProperties); // Services @@ -65,7 +65,7 @@ class ZipIngestionServiceTest extends IngestionServiceTest { this.fallbackOrgUnitRemoteService, this.fallbackAipRemoteService, this.historyService, - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.gitInfoProperties, @@ -79,7 +79,7 @@ class ZipIngestionServiceTest extends IngestionServiceTest { this.fallbackArchiveTypeResourceService, this.trustedDepositRemoteService); this.ingestionService = new ZipIngestionService( - this.config, + this.dlcmProperties, this.messageService, this.metadataService, this.fallbackOrgUnitRemoteService, diff --git a/DLCM-PreIngest/src/main/java/ch/dlcm/business/DepositService.java b/DLCM-PreIngest/src/main/java/ch/dlcm/business/DepositService.java index 90ba08d9cf897cf2659484b63d8ff3174d7c0aac..018060b184a77c14c67d3ddff13f24ce33574bf1 100644 --- a/DLCM-PreIngest/src/main/java/ch/dlcm/business/DepositService.java +++ b/DLCM-PreIngest/src/main/java/ch/dlcm/business/DepositService.java @@ -55,6 +55,7 @@ import org.springframework.data.jpa.domain.Specification; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.unit.DataSize; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; @@ -182,7 +183,6 @@ public class DepositService extends CompositeResourceService<Deposit> { private static final String EMBARGO_ACCESS_LEVEL_FIELD = "embargoAccess"; private static final String EMBARGO_LEVEL_FIELD = "embargo"; private static final String EMBARGO_END_DATE_FIELD = "embargoMonths"; - private final DLCMProperties dlcmProperties; private final DepositDataFileRepository depositDataFileRepository; private final SpecificationPermissionsFilter<Deposit> specificationPermissionFilter; private final HttpRequestInfoProvider httpRequestInfoProvider; @@ -207,6 +207,12 @@ public class DepositService extends CompositeResourceService<Deposit> { private final ChecksumAlgorithm defaultChecksumAlgorithm; private final AnonymizedDepositRepository anonymizedDepositRepository; + private final String preingestLocation; + private final String preingestTempLocation; + private final DataSize fileSizeLimit; + private final String defaultLicense; + private final String defaultMasterArchiveType; + public DepositService(DLCMProperties dlcmProperties, DepositDataFileRepository depositDataFileRepository, SpecificationPermissionsFilter<Deposit> specificationPermissionFilter, @@ -230,7 +236,6 @@ public class DepositService extends CompositeResourceService<Deposit> { HistoryService historyService, @Lazy PreparationService preparationService, AnonymizedDepositRepository anonymizedDepositRepository) { - this.dlcmProperties = dlcmProperties; this.depositDataFileRepository = depositDataFileRepository; this.specificationPermissionFilter = specificationPermissionFilter; this.httpRequestInfoProvider = httpRequestInfoProvider; @@ -252,8 +257,14 @@ public class DepositService extends CompositeResourceService<Deposit> { this.historyService = historyService; this.subjectAreaService = subjectAreaService; this.preparationService = preparationService; - this.defaultChecksumAlgorithm = ChecksumAlgorithm.valueOf(dlcmProperties.getParameters().getDefaultChecksum()); this.anonymizedDepositRepository = anonymizedDepositRepository; + + this.defaultChecksumAlgorithm = ChecksumAlgorithm.valueOf(dlcmProperties.getParameters().getDefaultChecksum()); + this.preingestLocation = dlcmProperties.getPreingestLocation(); + this.preingestTempLocation = dlcmProperties.getTempLocation(this.preingestLocation); + this.fileSizeLimit = dlcmProperties.getParameters().getFileSizeLimit(); + this.defaultLicense = dlcmProperties.getParameters().getDefaultLicense(); + this.defaultMasterArchiveType = dlcmProperties.getParameters().getDefaultMasterArchiveType(); } /** @@ -361,7 +372,7 @@ public class DepositService extends CompositeResourceService<Deposit> { * @param depositId */ public void deleteDepositFolderFromDisk(String depositId) { - final Path depositPath = Paths.get(this.dlcmProperties.getPreingestLocation()).resolve(depositId); + final Path depositPath = Paths.get(this.preingestLocation).resolve(depositId); if (FileTool.isFolder(depositPath)) { if (FileTool.deleteFolder(depositPath)) { log.info("Deposit's folder deleted: {}", depositPath); @@ -435,7 +446,7 @@ public class DepositService extends CompositeResourceService<Deposit> { if (statusHasChangedAndNeedsProcessing) { log.info("DepositService will send a DepositMessage for deposit '{}' with status '{}'", deposit.getResId(), deposit.getStatus()); - boolean bigPackage = this.getSize(deposit.getResId()) > this.dlcmProperties.getParameters().getFileSizeLimit().toBytes(); + boolean bigPackage = this.getSize(deposit.getResId()) > this.fileSizeLimit.toBytes(); SolidifyEventPublisher.getPublisher().publishEvent(new DepositMessage(deposit.getResId(), bigPackage)); } return result; @@ -695,8 +706,10 @@ public class DepositService extends CompositeResourceService<Deposit> { case ArchiveDataUseAgreement -> { return DLCMConstants.ARCHIVE_DUA; } + default -> { + return null; + } } - return null; } public int countContentDataFiles(String depositId) { @@ -760,7 +773,7 @@ public class DepositService extends CompositeResourceService<Deposit> { if (orgUnitDefaultLicense != null) { deposit.setLicenseId(orgUnitDefaultLicense.getResId()); } else { - deposit.setLicenseId(this.dlcmProperties.getParameters().getDefaultLicense()); + deposit.setLicenseId(this.defaultLicense); } } if (deposit.getAdditionalFieldsValues() != null && deposit.getAdditionalFieldsValues().isEmpty()) { @@ -999,7 +1012,7 @@ public class DepositService extends CompositeResourceService<Deposit> { } private void initializeArchiveType(Deposit deposit, BindingResult errors) { - String archiveTypeId = this.dlcmProperties.getParameters().getDefaultMasterArchiveType(); + String archiveTypeId = this.defaultMasterArchiveType; if (deposit.isCollection()) { archiveTypeId = ArchiveType.COLLECTION_ID; } @@ -1264,7 +1277,7 @@ public class DepositService extends CompositeResourceService<Deposit> { } final Optional<AnonymizedDeposit> lastOptionalAnonymizedDeposit = this.anonymizedDepositRepository.findLastAnonymizedDeposit(deposit); final String depositDatafilesChecksum = this.getDepositDatafilesChecksum(deposit.getResId(), this.defaultChecksumAlgorithm); - final Path anonymizedDepositFolder = Path.of(this.dlcmProperties.getPreingestLocation(), ANONYMIZED_DEPOSITS_FOLDER); + final Path anonymizedDepositFolder = Path.of(this.preingestLocation, ANONYMIZED_DEPOSITS_FOLDER); // Return the existing anonymized deposit page id if no updates has been made and anonymized deposit is still present if (lastOptionalAnonymizedDeposit.isPresent() && @@ -1292,7 +1305,7 @@ public class DepositService extends CompositeResourceService<Deposit> { new Thread(() -> { final Path newAnonymizedDepositPath = anonymizedDepositFolder.resolve(anonymizedDeposit.getResId() + SolidifyConstants.ZIP_EXT); final ZipTool zipTool = new ZipTool(newAnonymizedDepositPath.toString()); - zipTool.zipFiles(Paths.get(this.dlcmProperties.getPreingestLocation() + "/" + deposit.getResId())); + zipTool.zipFiles(Paths.get(this.preingestLocation + "/" + deposit.getResId())); }).start(); // Delete old anonymized deposit @@ -1321,11 +1334,10 @@ public class DepositService extends CompositeResourceService<Deposit> { public String buildDownloadableDeposit(String depositId, String folder) { final Deposit deposit = this.findOne(depositId); - final String zipFileLocation = this.dlcmProperties.getTempLocation(this.dlcmProperties.getPreingestLocation()) + "/" + deposit.getResId() - + SolidifyConstants.ZIP_EXT; + final String zipFileLocation = this.preingestTempLocation + "/" + deposit.getResId() + SolidifyConstants.ZIP_EXT; final ZipTool zipTool = new ZipTool(zipFileLocation); if (folder == null) { - zipTool.zipFiles(Paths.get(this.dlcmProperties.getPreingestLocation() + "/" + deposit.getResId())); + zipTool.zipFiles(Paths.get(this.preingestLocation + "/" + deposit.getResId())); } else { final String folderMatch = folder.equals("/") ? "(\\/.*)*" : folder + "(\\/.+)*"; final List<Path> dataFilesToZip = deposit.getDataFiles().stream().filter(df -> df.getRelativeLocation().matches(folderMatch)) @@ -1333,7 +1345,7 @@ public class DepositService extends CompositeResourceService<Deposit> { if (dataFilesToZip.isEmpty()) { return null; } - final Path sourcePath = Paths.get(this.dlcmProperties.getPreingestLocation() + "/" + deposit.getResId()); + final Path sourcePath = Paths.get(this.preingestLocation + "/" + deposit.getResId()); // list of destination path without the category folder (if exists) final List<Path> destinationPaths = deposit.getDataFiles().stream().filter(df -> df.getRelativeLocation().matches(folderMatch)) .map(df -> { diff --git a/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/DepositController.java b/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/DepositController.java index c4d25e3c213d461f937f218bc18f703ec36e35df..be9b380809679186b1d4ee6223d47d1c971bf187 100644 --- a/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/DepositController.java +++ b/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/DepositController.java @@ -102,8 +102,10 @@ import ch.unige.solidify.validation.ValidationError; import ch.dlcm.DLCMConstants; import ch.dlcm.DLCMMetadataVersion; +import ch.dlcm.business.DataFileService; import ch.dlcm.business.DepositDataFileService; import ch.dlcm.business.DepositService; +import ch.dlcm.config.DLCMProperties; import ch.dlcm.config.DLCMProperties.FileList; import ch.dlcm.controller.AbstractPackageController; import ch.dlcm.controller.PreIngestController; @@ -128,6 +130,7 @@ import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; import ch.dlcm.service.DataCategoryService; +import ch.dlcm.service.HistoryService; import ch.dlcm.service.IdentifierService; import ch.dlcm.service.MetadataService; import ch.dlcm.service.rest.propagate.PropagateMetadataTypeRemoteResourceService; @@ -143,16 +146,25 @@ public class DepositController extends AbstractPackageController<DepositDataFile private final IdentifierService identifierService; private final PropagateOrganizationalUnitRemoteResourceService orgUnitRemoteService; - public DepositController( - PropagateMetadataTypeRemoteResourceService metadataTypeRemoteService, - MetadataService metadataService, - IdentifierService identifierService, - DepositDataFileService depositDataFileService, - DataCategoryService dataCategoryService, - PropagateOrganizationalUnitRemoteResourceService orgUnitService) { - super(metadataTypeRemoteService, metadataService, depositDataFileService, dataCategoryService); + private final DLCMProperties.FileList excludeList; + private final DLCMProperties.FileList ignoreList; + private final String preingestLocation; + private final String preingestTempLocation; + private final String preingestModulePublicUrl; + + public DepositController(DLCMProperties dlcmProperties, HistoryService historyService, MetadataService metadataService, + PropagateMetadataTypeRemoteResourceService metadataTypeService, DataFileService<DepositDataFile> dataFileService, + DataCategoryService dataCategoryService, IdentifierService identifierService, + PropagateOrganizationalUnitRemoteResourceService orgUnitRemoteService) { + super(historyService, metadataService, metadataTypeService, dataFileService, dataCategoryService); this.identifierService = identifierService; - this.orgUnitRemoteService = orgUnitService; + this.orgUnitRemoteService = orgUnitRemoteService; + + this.excludeList = dlcmProperties.getParameters().getExcludeList(); + this.ignoreList = dlcmProperties.getParameters().getIgnoreList(); + this.preingestLocation = dlcmProperties.getPreingestLocation(); + this.preingestTempLocation = dlcmProperties.getTempLocation(dlcmProperties.getPreingestLocation()); + this.preingestModulePublicUrl = dlcmProperties.getModule().getPreingest().getPublicUrl(); } @Override @@ -386,8 +398,7 @@ public class DepositController extends AbstractPackageController<DepositDataFile @GetMapping("/" + DLCMActionName.LIST_EXCLUDE_FILES) public HttpEntity<FileList> excludeList() { - final FileList list = this.config.getParameters().getExcludeList(); - return new ResponseEntity<>(list, HttpStatus.OK); + return new ResponseEntity<>(this.excludeList, HttpStatus.OK); } @GetMapping(SolidifyConstants.URL_ID_PLUS_SEP + DLCMActionName.GET_ANONYMIZED_DEPOSIT_PAGE) @@ -400,14 +411,14 @@ public class DepositController extends AbstractPackageController<DepositDataFile throw new SolidifyResourceNotFoundException("No anonymized deposit page found"); } modelAndView.addObject("anonymizedDepositEntryList", anonymizedDepositEntryList); - modelAndView.addObject("preingestPublicUrl", this.config.getModule().getPreingest().getPublicUrl()); + modelAndView.addObject("preingestPublicUrl", this.preingestModulePublicUrl); return modelAndView; } @GetMapping(SolidifyConstants.URL_ID_PLUS_SEP + DLCMActionName.DOWNLOAD_ANONYMIZED_DEPOSIT) @EveryonePermissions public HttpEntity<FileSystemResource> downloadAnonymizedDeposit(@PathVariable("id") String anonymizedDepositId) { - final String zipFileLocation = this.config.getPreingestLocation() + "/" + ANONYMIZED_DEPOSITS_FOLDER + "/" + anonymizedDepositId + + final String zipFileLocation = this.preingestLocation + "/" + ANONYMIZED_DEPOSITS_FOLDER + "/" + anonymizedDepositId + SolidifyConstants.ZIP_EXT; if (Files.notExists(Paths.get(zipFileLocation))) { throw new SolidifyResourceNotFoundException("No anonymized deposit found"); @@ -421,8 +432,8 @@ public class DepositController extends AbstractPackageController<DepositDataFile public HttpEntity<String> generateAnonymizedDepositPage(@PathVariable("id") String depositId) { final Deposit deposit = this.itemService.findOne(depositId); final String anonymizedDepositPageId = ((DepositService) this.itemService).buildAnonymizedDeposit(deposit); - return new HttpEntity<>(this.config.getModule().getPreingest().getPublicUrl() + "/" + ResourceName.DEPOSIT + "/" + - anonymizedDepositPageId + "/" + DLCMActionName.GET_ANONYMIZED_DEPOSIT_PAGE); + return new HttpEntity<>(this.preingestModulePublicUrl + "/" + ResourceName.DEPOSIT + "/" + anonymizedDepositPageId + "/" + + DLCMActionName.GET_ANONYMIZED_DEPOSIT_PAGE); } @PreAuthorize("@depositPermissionService.isAllowed(#depositId, 'DOWNLOAD_FILE') " @@ -470,8 +481,7 @@ public class DepositController extends AbstractPackageController<DepositDataFile @GetMapping("/" + DLCMActionName.LIST_IGNORE_FILES) public HttpEntity<FileList> ignoreList() { - final FileList list = this.config.getParameters().getIgnoreList(); - return new ResponseEntity<>(list, HttpStatus.OK); + return new ResponseEntity<>(this.ignoreList, HttpStatus.OK); } @GetMapping("/" + DLCMActionName.LIST_ACCESS_TYPE) @@ -587,14 +597,14 @@ public class DepositController extends AbstractPackageController<DepositDataFile } fileUploadDto.setChecksums(checksums); fileUploadDto.setChecksumsOrigin(checksumsOrigin); - return this.upload(depositId, fileUploadDto, this.config.getTempLocation(this.config.getPreingestLocation()), UploadMode.STANDARD); + return this.upload(depositId, fileUploadDto, this.preingestTempLocation, UploadMode.STANDARD); } /** * Endpoint allowing to upload a ZIP archive containing many datafiles. If dataCategory and dataType are given, all datafiles in ZIP archive * get these values. * - * @param depositId deposit id + * @param depositId deposit id * @param archiveFile * @param dataCategory * @param dataType @@ -623,7 +633,7 @@ public class DepositController extends AbstractPackageController<DepositDataFile } // Create Deposit tmp folder - final String tmpFolder = this.config.getTempLocation(this.config.getPreingestLocation()) + File.separatorChar + depositId; + final String tmpFolder = this.preingestTempLocation + File.separatorChar + depositId; final Path tmpFolderPath = Paths.get(tmpFolder); if (!FileTool.ensureFolderExists(tmpFolderPath)) { throw new IOException(this.messageService.get("message.upload.folder.notcreated", new Object[] { tmpFolder })); @@ -742,7 +752,7 @@ public class DepositController extends AbstractPackageController<DepositDataFile fileUploadDto.setRelLocation("/"); fileUploadDto.setChecksums(new EnumMap<>(ChecksumAlgorithm.class)); fileUploadDto.setChecksumsOrigin(new EnumMap<>(ChecksumAlgorithm.class)); - return this.upload(depositId, fileUploadDto, this.config.getTempLocation(this.config.getPreingestLocation()), UploadMode.UPLOAD_METADATA); + return this.upload(depositId, fileUploadDto, this.preingestTempLocation, UploadMode.UPLOAD_METADATA); } @Override diff --git a/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/DepositDataFileController.java b/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/DepositDataFileController.java index 02d174551f7512c8eff95dc3b8758ea90348e9ad..5a760e1651094e4d19c27922fe01868bea044ec8 100644 --- a/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/DepositDataFileController.java +++ b/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/DepositDataFileController.java @@ -32,8 +32,6 @@ import java.util.List; import java.util.Map; import java.util.NoSuchElementException; -import jakarta.validation.Valid; - import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.core.io.FileSystemResource; import org.springframework.data.domain.Page; @@ -52,6 +50,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import jakarta.validation.Valid; + import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyHttpErrorException; import ch.unige.solidify.exception.SolidifyRuntimeException; @@ -70,12 +70,17 @@ import ch.dlcm.model.preingest.DepositDataFile; import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; +import ch.dlcm.service.HistoryService; @RestController @ConditionalOnBean(PreIngestController.class) @RequestMapping(UrlPath.PREINGEST_DEPOSIT + SolidifyConstants.URL_PARENT_ID + ResourceName.DATAFILE) public class DepositDataFileController extends AbstractDataFileController<Deposit, DepositDataFile> { + public DepositDataFileController(HistoryService historyService) { + super(historyService); + } + @Override @PreAuthorize("@depositPermissionService.isAllowed(#parentid, 'UPLOAD_FILE')") public HttpEntity<DepositDataFile> create(@PathVariable final String parentid, final @Valid @RequestBody DepositDataFile childItem) { diff --git a/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/PreIngestDownloadTokenController.java b/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/PreIngestDownloadTokenController.java index 197abbdf2991bbd2932eae76a5bf1f3270be7b18..b5b36e8cb31cd92878005c730231544c3f5e0dc7 100644 --- a/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/PreIngestDownloadTokenController.java +++ b/DLCM-PreIngest/src/main/java/ch/dlcm/controller/preingest/PreIngestDownloadTokenController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -55,9 +55,9 @@ public class PreIngestDownloadTokenController extends DLCMDownloadTokenControlle public PreIngestDownloadTokenController( DownloadTokenRepository downloadTokenRepository, SolidifyProperties solidifyConfig, - DLCMProperties config) throws URISyntaxException { + DLCMProperties dlcmProperties) throws URISyntaxException { super(solidifyConfig, downloadTokenRepository); - this.preIngestModulePath = new URI(config.getModule().getPreingest().getPublicUrl()).getPath(); + this.preIngestModulePath = new URI(dlcmProperties.getModule().getPreingest().getPublicUrl()).getPath(); } diff --git a/DLCM-PreIngest/src/main/java/ch/dlcm/preparation/PreparationService.java b/DLCM-PreIngest/src/main/java/ch/dlcm/preparation/PreparationService.java index ebdd168576481f77d6c500decd46916234bbee62..31cd514130c9f725f913277609ac2c807bb67f05 100644 --- a/DLCM-PreIngest/src/main/java/ch/dlcm/preparation/PreparationService.java +++ b/DLCM-PreIngest/src/main/java/ch/dlcm/preparation/PreparationService.java @@ -68,18 +68,18 @@ public abstract class PreparationService extends DLCMService { private final TrustedArchivePrivateMetadataRemoteResourceService archiveMetadataRemoteService; protected PreparationService( - DLCMProperties config, + DLCMProperties dlcmProperties, MessageService messageService, HistoryService historyService, DepositService depositService, FallbackSubmissionInfoPackageRemoteResourceService sipRemoteService, FallbackArchivalInfoPackageRemoteResourceService aipRemoteService, TrustedArchivePrivateMetadataRemoteResourceService archiveMetadataRemoteService) { - super(messageService, config); - this.preingestLocation = config.getPreingestLocation(); - this.maxFileNumber = config.getParameters().getMaxFileNumber(); - this.researchDataEnabled = config.getParameters().isResearchDataEnabled(); - this.administrativeDataEnabled = config.getParameters().isAdministrativeDataEnabled(); + super(messageService, dlcmProperties); + this.preingestLocation = dlcmProperties.getPreingestLocation(); + this.maxFileNumber = dlcmProperties.getParameters().getMaxFileNumber(); + this.researchDataEnabled = dlcmProperties.getParameters().isResearchDataEnabled(); + this.administrativeDataEnabled = dlcmProperties.getParameters().isAdministrativeDataEnabled(); this.historyService = historyService; this.depositService = depositService; this.sipRemoteService = sipRemoteService; diff --git a/DLCM-PreIngest/src/main/java/ch/dlcm/service/DepositMgmt.java b/DLCM-PreIngest/src/main/java/ch/dlcm/service/DepositMgmt.java index b39cdfa18170f1eb033290f771d1a74f765428be..6590eae237370481f8c482b28eaec0a743a6c479 100644 --- a/DLCM-PreIngest/src/main/java/ch/dlcm/service/DepositMgmt.java +++ b/DLCM-PreIngest/src/main/java/ch/dlcm/service/DepositMgmt.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -42,8 +42,8 @@ public class DepositMgmt extends MessageProcessorBySize<DepositMessage> { final DepositStatusService depositStatusService; - public DepositMgmt(DepositStatusService depositStatusService, DLCMProperties configService) { - super(configService); + public DepositMgmt(DepositStatusService depositStatusService, DLCMProperties dlcmProperties) { + super(dlcmProperties); this.depositStatusService = depositStatusService; } diff --git a/DLCM-PreIngest/src/main/java/ch/dlcm/service/DepositStatusService.java b/DLCM-PreIngest/src/main/java/ch/dlcm/service/DepositStatusService.java index 657144b8d9a03b4f1c5acc1b2f1ff11717e551ab..0bb4c0daa52b3285ca81ef33a57db5f0a1828fe2 100644 --- a/DLCM-PreIngest/src/main/java/ch/dlcm/service/DepositStatusService.java +++ b/DLCM-PreIngest/src/main/java/ch/dlcm/service/DepositStatusService.java @@ -91,15 +91,15 @@ public class DepositStatusService extends DLCMService { IdentifierService identifierService, PreparationService depositPackageBuilder, DepositService depositService, - DLCMProperties config, + DLCMProperties dlcmProperties, MessageService messageService, DepositDataFileService depositDataFileService, MetadataService metadataService, HistoryService historyService, TrustedArchivePrivateMetadataRemoteResourceService archiveMetadataRemoteService) { - super(messageService, config); - this.preingestLocation = config.getPreingestLocation(); - this.depositTmpLocation = config.getTempLocation(this.preingestLocation); + super(messageService, dlcmProperties); + this.preingestLocation = dlcmProperties.getPreingestLocation(); + this.depositTmpLocation = dlcmProperties.getTempLocation(this.preingestLocation); this.identifierService = identifierService; this.depositPackageBuilder = depositPackageBuilder; this.depositService = depositService; diff --git a/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/BagItPreparationServiceTest.java b/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/BagItPreparationServiceTest.java index 4657f15df87eff4fc9965177f2f920133e6bca26..06b239a62f531aba4c94563eb76475d83d6c2233 100644 --- a/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/BagItPreparationServiceTest.java +++ b/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/BagItPreparationServiceTest.java @@ -68,13 +68,13 @@ class BagItPreparationServiceTest extends PreparationServiceTest { void setup() { super.setUp(); // DLCM Properties - this.config = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); - this.config.setHome(this.workingDir.toAbsolutePath().toString()); + this.dlcmProperties = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); + this.dlcmProperties.setHome(this.workingDir.toAbsolutePath().toString()); // DLCM Repository description this.repositoryDescription = new DLCMRepositoryDescription(this.gitInfoProperties); // Services this.preparationService = new ZipPreparationService( - this.config, + this.dlcmProperties, this.messageService, this.historyService, this.depositService, @@ -86,7 +86,7 @@ class BagItPreparationServiceTest extends PreparationServiceTest { this.fallbackOrgUnitRemoteService, this.fallbackAipRemoteService, this.historyService, - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.gitInfoProperties, diff --git a/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/PreparationServiceTest.java b/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/PreparationServiceTest.java index db6456015ad2c2f6c187417cccf9427839555623..70cd4854aa0d1e5ada66802ffc208294f75dd683 100644 --- a/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/PreparationServiceTest.java +++ b/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/PreparationServiceTest.java @@ -38,11 +38,11 @@ import java.security.NoSuchAlgorithmException; import java.time.LocalDate; import java.time.OffsetDateTime; -import jakarta.xml.bind.JAXBException; - import org.junit.jupiter.api.AfterEach; import org.mockito.Mock; +import jakarta.xml.bind.JAXBException; + import ch.unige.solidify.ChecksumAlgorithm; import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyRuntimeException; @@ -112,7 +112,7 @@ public abstract class PreparationServiceTest { protected Path workingDir = Paths.get("src", "test", "resources", "testing"); protected GitInfoProperties gitInfoProperties = new GitInfoProperties(); - protected DLCMProperties config; + protected DLCMProperties dlcmProperties; protected DLCMRepositoryDescription repositoryDescription; protected IdentifierService identifierService; protected MetadataService metadataService; @@ -163,12 +163,12 @@ public abstract class PreparationServiceTest { public void runTestWithMetadata(Path source, DLCMMetadataVersion version) throws Exception { final Deposit depositWithMetadata = this.getDepositWithMetadata(source, version); - this.runDepositTest(this.config.getPreingestLocation(), depositWithMetadata, depositWithMetadata.getDataFiles().size()); + this.runDepositTest(this.dlcmProperties.getPreingestLocation(), depositWithMetadata, depositWithMetadata.getDataFiles().size()); } public void runTestWithoutMetadata(Path source, DLCMMetadataVersion version) throws Exception { final Deposit depositWithoutMetadata = this.getDepositWithoutMetadata(source, version); - this.runDepositTest(this.config.getPreingestLocation(), depositWithoutMetadata, depositWithoutMetadata.getDataFiles().size() + 1); + this.runDepositTest(this.dlcmProperties.getPreingestLocation(), depositWithoutMetadata, depositWithoutMetadata.getDataFiles().size() + 1); } public void setUp() { @@ -426,7 +426,7 @@ public abstract class PreparationServiceTest { } private void setChecksum(DepositDataFile df) throws NoSuchAlgorithmException, IOException { - final String[] algoList = this.config.getParameters().getChecksumList(); + final String[] algoList = this.dlcmProperties.getParameters().getChecksumList(); final String[] checksumList = ChecksumTool.computeChecksum( new BufferedInputStream(new FileInputStream(Paths.get(df.getFinalData()).toFile()), SolidifyConstants.BUFFER_SIZE), algoList); diff --git a/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/ZipPreparationServiceTest.java b/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/ZipPreparationServiceTest.java index 26610a4935b2587dc55840f0be6bebf7f4055fc0..5b368052f092c450f3790177aa480421c9e2884f 100644 --- a/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/ZipPreparationServiceTest.java +++ b/DLCM-PreIngest/src/test/java/ch/dlcm/test/preparation/ZipPreparationServiceTest.java @@ -67,15 +67,15 @@ class ZipPreparationServiceTest extends PreparationServiceTest { super.setUp(); // GitInfo // DLCM Properties - this.config = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); - this.config.setHome(this.workingDir.toAbsolutePath().toString()); - this.config.getParameters().setDefaultChecksum("MD5"); - this.config.getParameters().setChecksumList(new String[] { "MD5" }); + this.dlcmProperties = new DLCMProperties(new SolidifyProperties(new GitInfoProperties()), new MultipartProperties()); + this.dlcmProperties.setHome(this.workingDir.toAbsolutePath().toString()); + this.dlcmProperties.getParameters().setDefaultChecksum("MD5"); + this.dlcmProperties.getParameters().setChecksumList(new String[] { "MD5" }); // DLCM Repository description this.repositoryDescription = new DLCMRepositoryDescription(this.gitInfoProperties); // Services this.preparationService = new ZipPreparationService( - this.config, + this.dlcmProperties, this.messageService, this.historyService, this.depositService, @@ -87,7 +87,7 @@ class ZipPreparationServiceTest extends PreparationServiceTest { this.fallbackOrgUnitRemoteService, this.fallbackAipRemoteService, this.historyService, - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.gitInfoProperties, diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/business/PreservationJobService.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/business/PreservationJobService.java index 6c60b441131109cf7debf34de407960c57c18285..3dda0cd86926d945bde9375ae43474af8adc1469 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/business/PreservationJobService.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/business/PreservationJobService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -43,16 +43,24 @@ import ch.dlcm.specification.PreservationJobSpecification; @ConditionalOnBean(PreservationPlanningController.class) public class PreservationJobService extends ResourceService<PreservationJob> { + private static final String SCHEDULING_FIELD = "scheduling"; private static final String INVALID_SCHEDULING_FOR_RECURRENCE = "validation.preservationjob.invalidSchedulingForRecurrence"; private static final String INVALID_SCHEDULING_VALUE = "validation.preservationjob.invalidSchedulingValue"; private static final String RECURRENCE_NOT_APPLICABLE = "validation.preservationjob.recurrenceNotApplicable"; private final PreservationJobRepository preservationJobRepository; - private final DLCMProperties dlcmProperties; + private final int preservationPlanningMonth; + private final int preservationPlanningMonthDay; + private final int preservationPlanningHour; + private final int preservationPlanningWeekDay; public PreservationJobService(PreservationJobRepository preservationJobRepository, DLCMProperties dlcmProperties) { this.preservationJobRepository = preservationJobRepository; - this.dlcmProperties = dlcmProperties; + + this.preservationPlanningMonth = dlcmProperties.getPreservationPlanning().getMonth(); + this.preservationPlanningMonthDay = dlcmProperties.getPreservationPlanning().getMonthDay(); + this.preservationPlanningHour = dlcmProperties.getPreservationPlanning().getHour(); + this.preservationPlanningWeekDay = dlcmProperties.getPreservationPlanning().getWeekDay(); } public PreservationJob findByName(String resName) { @@ -97,7 +105,7 @@ public class PreservationJobService extends ResourceService<PreservationJob> { || job.getScheduling().getMonthDay() == null || job.getScheduling().getMonth() == null)) ) { // @formatter:on - errors.addError(new FieldError(job.getClass().getSimpleName(), "scheduling", + errors.addError(new FieldError(job.getClass().getSimpleName(), SCHEDULING_FIELD, this.messageService.get(INVALID_SCHEDULING_FOR_RECURRENCE, new Object[] { job.getJobRecurrence().getLabel() }))); } @@ -111,7 +119,7 @@ public class PreservationJobService extends ResourceService<PreservationJob> { * hour value */ if (scheduling.getHour() != null && (scheduling.getHour() < 0 || scheduling.getHour() > 23)) { - errors.addError(new FieldError(job.getClass().getSimpleName(), "scheduling", + errors.addError(new FieldError(job.getClass().getSimpleName(), SCHEDULING_FIELD, this.messageService.get(INVALID_SCHEDULING_VALUE, new Object[] { "hour: " + scheduling.getHour() }))); } @@ -119,7 +127,7 @@ public class PreservationJobService extends ResourceService<PreservationJob> { * day of week value */ if (scheduling.getWeekDay() != null && (scheduling.getWeekDay() < 1 || scheduling.getWeekDay() > 7)) { - errors.addError(new FieldError(job.getClass().getSimpleName(), "scheduling", + errors.addError(new FieldError(job.getClass().getSimpleName(), SCHEDULING_FIELD, this.messageService.get(INVALID_SCHEDULING_VALUE, new Object[] { "day of week: " + scheduling.getWeekDay() }))); } @@ -127,7 +135,7 @@ public class PreservationJobService extends ResourceService<PreservationJob> { * day of month */ if (scheduling.getMonthDay() != null && (scheduling.getMonthDay() < 1 || scheduling.getMonthDay() > 31)) { - errors.addError(new FieldError(job.getClass().getSimpleName(), "scheduling", + errors.addError(new FieldError(job.getClass().getSimpleName(), SCHEDULING_FIELD, this.messageService.get(INVALID_SCHEDULING_VALUE, new Object[] { "day of month: " + scheduling.getMonthDay() }))); } @@ -135,7 +143,7 @@ public class PreservationJobService extends ResourceService<PreservationJob> { * month */ if (scheduling.getMonth() != null && (scheduling.getMonth() < 1 || scheduling.getMonth() > 12)) { - errors.addError(new FieldError(job.getClass().getSimpleName(), "scheduling", + errors.addError(new FieldError(job.getClass().getSimpleName(), SCHEDULING_FIELD, this.messageService.get(INVALID_SCHEDULING_VALUE, new Object[] { "month: " + scheduling.getMonth() }))); } @@ -149,7 +157,7 @@ public class PreservationJobService extends ResourceService<PreservationJob> { if ((month == 2 && day > 28) || ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31)) { - errors.addError(new FieldError(job.getClass().getSimpleName(), "scheduling", + errors.addError(new FieldError(job.getClass().getSimpleName(), SCHEDULING_FIELD, this.messageService.get(INVALID_SCHEDULING_VALUE, new Object[] { "day: " + day + " not valid for month: " + month }))); } } @@ -174,19 +182,19 @@ public class PreservationJobService extends ResourceService<PreservationJob> { final JobScheduling scheduling = new JobScheduling(); switch (job.getJobRecurrence()) { case YEARLY -> { - scheduling.setMonth(this.dlcmProperties.getPreservationPlanning().getMonth()); - scheduling.setMonthDay(this.dlcmProperties.getPreservationPlanning().getMonthDay()); - scheduling.setHour(this.dlcmProperties.getPreservationPlanning().getHour()); + scheduling.setMonth(this.preservationPlanningMonth); + scheduling.setMonthDay(this.preservationPlanningMonthDay); + scheduling.setHour(this.preservationPlanningHour); } case MONTHLY -> { - scheduling.setMonthDay(this.dlcmProperties.getPreservationPlanning().getMonthDay()); - scheduling.setHour(this.dlcmProperties.getPreservationPlanning().getHour()); + scheduling.setMonthDay(this.preservationPlanningMonthDay); + scheduling.setHour(this.preservationPlanningHour); } case WEEKLY -> { - scheduling.setWeekDay(this.dlcmProperties.getPreservationPlanning().getWeekDay()); - scheduling.setHour(this.dlcmProperties.getPreservationPlanning().getHour()); + scheduling.setWeekDay(this.preservationPlanningWeekDay); + scheduling.setHour(this.preservationPlanningHour); } - case DAILY -> scheduling.setHour(this.dlcmProperties.getPreservationPlanning().getHour()); + case DAILY -> scheduling.setHour(this.preservationPlanningHour); default -> throw new SolidifyRuntimeException("Unknown job recurrence: " + job.getJobRecurrence()); } job.setScheduling(scheduling); diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/ExecutionReportController.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/ExecutionReportController.java index 7da5d2a482f7366682198b7fc1671a92008cee8b..dcf4f1c31de9a3b1af9783442b6f2aaf26f5214a 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/ExecutionReportController.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/ExecutionReportController.java @@ -49,6 +49,7 @@ import ch.dlcm.model.preservation.JobExecutionReport; import ch.dlcm.model.preservation.JobExecutionReportLine; import ch.dlcm.repository.JobExecutionLineReportRepository; import ch.dlcm.rest.DLCMActionName; +import ch.dlcm.service.HistoryService; @AdminPermissions public abstract class ExecutionReportController<T extends Resource & RemoteResourceContainer, V extends Resource> @@ -58,9 +59,11 @@ public abstract class ExecutionReportController<T extends Resource & RemoteResou protected JobExecutionReportService reportService; - protected ExecutionReportController(JobExecutionReportService reportService, JobExecutionLineReportRepository reportLineRepository) { - this.reportService = reportService; + public ExecutionReportController(HistoryService historyService, JobExecutionLineReportRepository reportLineRepository, + JobExecutionReportService reportService) { + super(historyService); this.reportLineRepository = reportLineRepository; + this.reportService = reportService; } @GetMapping(SolidifyConstants.URL_ID_PLUS_SEP + DLCMActionName.REPORT + "/" + DLCMConstants.REPORT_ID) diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/MonitorController.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/MonitorController.java index 25a410333af73730e6148e5c2a136f591bed1a65..b07fcf8a2ecd54acf54fcb81b85b9147fee25456 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/MonitorController.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/MonitorController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -24,7 +24,6 @@ package ch.dlcm.controller.preservationplanning; import org.json.JSONException; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.http.HttpEntity; import org.springframework.http.HttpStatus; @@ -49,9 +48,12 @@ import ch.dlcm.service.MonitorService; @RequestMapping(UrlPath.PRES_PLANNING_MONITOR) public class MonitorController implements ControllerWithHateoasHome { - @Autowired private MonitorService monitorService; + public MonitorController(MonitorService monitorService) { + this.monitorService = monitorService; + } + @GetMapping(produces = { MediaType.APPLICATION_JSON_VALUE }) public HttpEntity<String> status() { try { diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/PreservationJobExecutionController.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/PreservationJobExecutionController.java index 7a597687610b4d365f234979b289d7334bbbf227..180ce387470b11fbf91e75cb83db353d4bd62f92 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/PreservationJobExecutionController.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/controller/preservationplanning/PreservationJobExecutionController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -29,8 +29,6 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import java.lang.reflect.Method; import java.util.Map; -import jakarta.validation.Valid; - import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.data.domain.Pageable; import org.springframework.hateoas.RepresentationModel; @@ -45,6 +43,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import jakarta.validation.Valid; + import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.config.SolidifyEventPublisher; import ch.unige.solidify.exception.SolidifyResourceNotFoundException; @@ -66,6 +66,7 @@ import ch.dlcm.repository.JobExecutionLineReportRepository; import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.rest.UrlPath; +import ch.dlcm.service.HistoryService; @AdminPermissions @RestController @@ -73,8 +74,9 @@ import ch.dlcm.rest.UrlPath; @RequestMapping(UrlPath.PRES_PLANNING_PRES_JOB + SolidifyConstants.URL_PARENT_ID + ResourceName.PRES_JOB_EXECUTION) public class PreservationJobExecutionController extends ExecutionReportController<PreservationJob, JobExecution> { - public PreservationJobExecutionController(JobExecutionReportService reportService, JobExecutionLineReportRepository reportLineRepository) { - super(reportService, reportLineRepository); + public PreservationJobExecutionController(HistoryService historyService, JobExecutionLineReportRepository reportLineRepository, + JobExecutionReportService reportService) { + super(historyService, reportLineRepository, reportService); } @Override diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/AbstractJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/AbstractJob.java index 77028957c501aa3d7b9e96cc97ad11d1965f1de9..225c66394fea358c3470d5d8554c7eb80b042d8c 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/AbstractJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/AbstractJob.java @@ -23,8 +23,12 @@ package ch.dlcm.job; +import java.util.Arrays; + import org.springframework.data.domain.PageRequest; +import org.springframework.util.unit.DataSize; +import ch.unige.solidify.exception.SolidifyRuntimeException; import ch.unige.solidify.rest.Result; import ch.unige.solidify.service.MessageService; @@ -35,15 +39,36 @@ import ch.dlcm.service.JobProcessingService; public abstract class AbstractJob { - protected DLCMProperties configService; protected JobProcessingService jobProcessingService; protected MessageService messageService; - protected AbstractJob(DLCMProperties configService, MessageService messageService, JobProcessingService jobProcessingService) { + protected final String accessModulePublicUrl; + protected final String preingestModulePublicUrl; + protected final String ingestModulePublicUrl; + protected final String[] internalArchivalStorageUrls; + protected final String[] publicArchivalStorageUrls; + + protected final String defaultArchivalStorageUrl; + protected final String defaultArchivalStoragePublicUrl; + + protected final DataSize fileSizeLimit; + + private final int jobPageSize; + + protected AbstractJob(DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService) { super(); - this.configService = configService; this.jobProcessingService = jobProcessingService; this.messageService = messageService; + + this.accessModulePublicUrl = dlcmProperties.getModule().getAccess().getPublicUrl(); + this.ingestModulePublicUrl = dlcmProperties.getModule().getIngest().getPublicUrl(); + this.preingestModulePublicUrl = dlcmProperties.getModule().getPreingest().getPublicUrl(); + this.internalArchivalStorageUrls = dlcmProperties.getArchivalStorageUrls(); + this.publicArchivalStorageUrls = dlcmProperties.getArchivalStoragePublicUrls(); + this.defaultArchivalStorageUrl = dlcmProperties.getDefaultArchivalStorageUrl(); + this.defaultArchivalStoragePublicUrl = dlcmProperties.getDefaultArchivalStoragePublicUrl(); + this.fileSizeLimit = dlcmProperties.getParameters().getFileSizeLimit(); + this.jobPageSize = dlcmProperties.getPreservationPlanning().getJobPageSize(); } public void run(String jobId, String executionId) { @@ -80,7 +105,7 @@ public abstract class AbstractJob { protected abstract void execute(PreservationJob job, String executionId); protected PageRequest getPageRequest() { - return PageRequest.of(0, this.configService.getPreservationPlanning().getJobPageSize()); + return PageRequest.of(0, this.jobPageSize); } protected PageRequest getPageRequestForTotal() { @@ -88,32 +113,48 @@ public abstract class AbstractJob { } protected String getSipPublicUrl(String sipId) { - return this.configService.getModule().getIngest().getPublicUrl() + "/" + ResourceName.SIP + "/" + sipId; + return this.ingestModulePublicUrl + "/" + ResourceName.SIP + "/" + sipId; } protected String getDepositPublicUrl(String depositId) { - return this.configService.getModule().getPreingest().getPublicUrl() + "/" + ResourceName.DEPOSIT + "/" + depositId; + return this.preingestModulePublicUrl + "/" + ResourceName.DEPOSIT + "/" + depositId; } protected String getAipPublicUrl(String storageUrl, String aipId) { - String publicStorageUrl = this.configService.getPublicArchivalStorageUrlFromInternalUrl(storageUrl); + String publicStorageUrl = this.getPublicArchivalStorageUrlFromInternalUrl(storageUrl); return publicStorageUrl + "/" + ResourceName.AIP + "/" + aipId; } protected String getArchivePublicUrl(String archiveId) { - return this.configService.getModule().getAccess().getPublicUrl() + "/" + ResourceName.PUBLIC_METADATA + "/" + archiveId; + return this.accessModulePublicUrl + "/" + ResourceName.PUBLIC_METADATA + "/" + archiveId; } protected String getOrderPublicUrl(String orderId) { - return this.configService.getModule().getAccess().getPublicUrl() + "/" + ResourceName.ORDER + "/" + orderId; + return this.accessModulePublicUrl + "/" + ResourceName.ORDER + "/" + orderId; } protected String getDIPPublicUrl(String orderId) { - return this.configService.getModule().getAccess().getPublicUrl() + "/" + ResourceName.DIP + "/" + orderId; + return this.accessModulePublicUrl + "/" + ResourceName.DIP + "/" + orderId; } protected String getAIPDownloadPublicUrl(String orderId) { - return this.configService.getModule().getAccess().getPublicUrl() + "/" + ResourceName.AIP + "/" + orderId; + return this.accessModulePublicUrl + "/" + ResourceName.AIP + "/" + orderId; + } + + private String getPublicArchivalStorageUrlFromInternalUrl(String url) { + + if (Arrays.asList(this.publicArchivalStorageUrls).contains(url)) { + // url is already public + return url; + } + + for (int i = 0; i < this.internalArchivalStorageUrls.length; i++) { + if (this.internalArchivalStorageUrls[i].equals(url)) { + return this.publicArchivalStorageUrls[i]; + } + } + + throw new SolidifyRuntimeException("No public storage URL found for internal storage URL '" + url + "'"); } protected PreservationJob logResult(Result result, PreservationJob job, String executionId, String resId, String resUrl) { diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ApplyAipActionJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ApplyAipActionJob.java index 2abfae2681a0476736d2a652a4435b0eaa7780f2..49dac92a28147ec5a29aa23332f9b3682ba01fd5 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ApplyAipActionJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ApplyAipActionJob.java @@ -41,11 +41,11 @@ public class ApplyAipActionJob extends AbstractJob { private final TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService; public ApplyAipActionJob( - DLCMProperties configService, + DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService, TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService) { - super(configService, messageService, jobProcessingService); + super(dlcmProperties, messageService, jobProcessingService); this.aipRemoteResourceService = aipRemoteResourceService; } @@ -92,8 +92,8 @@ public class ApplyAipActionJob extends AbstractJob { private String[] defineStorageList(PreservationJob job) { return switch (job.getJobType()) { - case ARCHIVE_CHECK, FIXITY, REINDEX_ALL -> this.configService.getArchivalStorageUrls(); - case REINDEX -> new String[] { this.configService.getDefaultArchivalStorageUrl() }; + case ARCHIVE_CHECK, FIXITY, REINDEX_ALL -> this.internalArchivalStorageUrls; + case REINDEX -> new String[] { this.defaultArchivalStorageUrl }; default -> throw new SolidifyProcessingException("Job type " + job.getJobType().getLabel() + " not applicable"); }; } diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckComplianceLevelJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckComplianceLevelJob.java index 247aabcfb37b479079fb9c7b5decad8d2fd8eef2..0d40305f8ee724354500dbc284bf14fb96248dd1 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckComplianceLevelJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckComplianceLevelJob.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -40,11 +40,11 @@ public class CheckComplianceLevelJob extends AbstractJob { private final TrustedDepositRemoteResourceService depositRemoteResourceService; public CheckComplianceLevelJob( - DLCMProperties configService, + DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService, TrustedDepositRemoteResourceService depositRemoteResourceService) { - super(configService, messageService, jobProcessingService); + super(dlcmProperties, messageService, jobProcessingService); this.depositRemoteResourceService = depositRemoteResourceService; } diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckReplicationJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckReplicationJob.java index 29abd52408f6af27130ade201ea040fb54ebc246..e3c1073dd287ad0b63d7a54bfcbf47334d379df9 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckReplicationJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckReplicationJob.java @@ -46,12 +46,12 @@ public class CheckReplicationJob extends AbstractJob { private final TrustedArchivePublicMetadataRemoteResourceService archiveMetadataRemoteResourceService; public CheckReplicationJob( - DLCMProperties configService, + DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService, ReplicationService replicationService, TrustedArchivePublicMetadataRemoteResourceService archiveMetadataRemoteResourceService) { - super(configService, messageService, jobProcessingService); + super(dlcmProperties, messageService, jobProcessingService); this.replicationService = replicationService; this.archiveMetadataRemoteResourceService = archiveMetadataRemoteResourceService; } @@ -61,7 +61,7 @@ public class CheckReplicationJob extends AbstractJob { // Compute item total final long total = this.getTotal(); // Archive Unit Replication - job = this.runReplicationCheck(job, executionId, total); + this.runReplicationCheck(job, executionId, total); } private long getTotal() { @@ -83,13 +83,13 @@ public class CheckReplicationJob extends AbstractJob { try { this.replicationService.checkAIP(md.getResId()); job = this.addProcessedItem(job, executionId, md.getResId(), - this.getAipPublicUrl(this.configService.getDefaultArchivalStoragePublicUrl(), md.getResId())); + this.getAipPublicUrl(this.defaultArchivalStoragePublicUrl, md.getResId())); } catch (final SolidifyCheckingException e) { job = this.addIgnoredItem(job, executionId, md.getResId(), - this.getAipPublicUrl(this.configService.getDefaultArchivalStoragePublicUrl(), md.getResId()), e.getMessage()); + this.getAipPublicUrl(this.defaultArchivalStoragePublicUrl, md.getResId()), e.getMessage()); } catch (SolidifyProcessingException | SolidifyRestException | DLCMReplicationException | DLCMCompareException e) { job = this.addInErrorItem(job, executionId, md.getResId(), - this.getAipPublicUrl(this.configService.getDefaultArchivalStoragePublicUrl(), md.getResId()), e.getMessage()); + this.getAipPublicUrl(this.defaultArchivalStoragePublicUrl, md.getResId()), e.getMessage()); } job = this.jobProcessingService.saveStep(job, executionId, num, total); } diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CleanSubmissionJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CleanSubmissionJob.java index f66065d0a92e052c85ee2496f0a14c6a156a255e..c071af907963618e111b8e3cf9e003a1ac250bf3 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CleanSubmissionJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CleanSubmissionJob.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -57,7 +57,7 @@ public class CleanSubmissionJob extends AbstractJob { private final TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService; public CleanSubmissionJob( - DLCMProperties configService, + DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService, TrustedSubmissionPolicyRemoteResourceService submissionPolicyRemoteResourceService, @@ -65,7 +65,7 @@ public class CleanSubmissionJob extends AbstractJob { TrustedSubmissionInfoPackageRemoteResourceService sipRemoteResourceService, TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService, boolean complianceMode) { - super(configService, messageService, jobProcessingService); + super(dlcmProperties, messageService, jobProcessingService); this.submissionPolicyRemoteResourceService = submissionPolicyRemoteResourceService; this.depositRemoteResourceService = depositRemoteResourceService; this.sipRemoteResourceService = sipRemoteResourceService; @@ -96,7 +96,8 @@ public class CleanSubmissionJob extends AbstractJob { } // Clean SIP if (sipPackage.getInfo().getStatus().equals(PackageStatus.CLEANED)) { - job = this.addIgnoredItem(job, executionId, sipPackage.getResId(), this.getSipPublicUrl(sipPackage.getResId()), "SIP already cleaned"); + job = this.addIgnoredItem(job, executionId, sipPackage.getResId(), this.getSipPublicUrl(sipPackage.getResId()), + "SIP already cleaned"); } else { try { // update deposit with the CLEANED status @@ -152,7 +153,7 @@ public class CleanSubmissionJob extends AbstractJob { .getWhen() .plusDays( this.submissionPolicyRemoteResourceService.getSubmissionPolicy( - sipPackage.getSubmissionPolicyId()) + sipPackage.getSubmissionPolicyId()) .getTimeToKeep()); if (endTimeToKeep.isAfter(OffsetDateTime.now(ZoneOffset.UTC))) { @@ -161,9 +162,8 @@ public class CleanSubmissionJob extends AbstractJob { } private void hasAllReplicas(SubmissionInfoPackage sipPackage) throws DLCMJobItemIgnoredException { - final String[] archivalStorageUrls = this.configService.getArchivalStorageUrls(); int replicaNumber = 0; - for (final String archivalStorageUrl : archivalStorageUrls) { + for (final String archivalStorageUrl : this.internalArchivalStorageUrls) { try { final ArchivalInfoPackage aip = this.aipRemoteResourceService.getAIP(archivalStorageUrl, sipPackage.getAipId()); if (aip.isCompleted()) { @@ -175,7 +175,7 @@ public class CleanSubmissionJob extends AbstractJob { throw new SolidifyRuntimeException("Error in submission cleaning: " + e.getMessage(), e); } } - if (replicaNumber != archivalStorageUrls.length) { + if (replicaNumber != this.internalArchivalStorageUrls.length) { throw new DLCMJobItemIgnoredException(sipPackage.getResId(), this.getSipPublicUrl(sipPackage.getResId()), "Missing a copy in replication"); } } diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/DisposalJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/DisposalJob.java index e43059aba83f6620875a08b58cb5b177b3053266..4d5012a2745bea288b301c8a1b113fd38394f943 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/DisposalJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/DisposalJob.java @@ -43,12 +43,12 @@ public class DisposalJob extends AbstractJob { private final TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService; public DisposalJob( - DLCMProperties configService, + DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService, TrustedArchivePublicMetadataRemoteResourceService archiveMetadataRemoteResourceService, TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService) { - super(configService, messageService, jobProcessingService); + super(dlcmProperties, messageService, jobProcessingService); this.archiveMetadataRemoteResourceService = archiveMetadataRemoteResourceService; this.aipRemoteResourceService = aipRemoteResourceService; } diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/MetadataMigrationJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/MetadataMigrationJob.java index a8214ea652d2e2981ee8f7eae48cf3ff5da86244..6e4cb3bb17a54c1da0b03d955a569eabed4db830 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/MetadataMigrationJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/MetadataMigrationJob.java @@ -52,28 +52,30 @@ public class MetadataMigrationJob extends AbstractJob { private final TrustedSubmissionInfoPackageRemoteResourceService sipRemoteResourceService; private final TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService; + private final String defaultStorageUrl; + public MetadataMigrationJob( - DLCMProperties configService, + DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService, TrustedDepositRemoteResourceService depositRemoteResourceService, TrustedSubmissionInfoPackageRemoteResourceService sipRemoteResourceService, TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService) { - super(configService, messageService, jobProcessingService); + super(dlcmProperties, messageService, jobProcessingService); this.depositRemoteResourceService = depositRemoteResourceService; this.sipRemoteResourceService = sipRemoteResourceService; this.aipRemoteResourceService = aipRemoteResourceService; + this.defaultStorageUrl = dlcmProperties.getDefaultArchivalStorageUrl(); } @Override protected void execute(PreservationJob job, String executionId) { - final String storageUrl = this.configService.getDefaultArchivalStorageUrl(); - final long total = this.getTotal(storageUrl); + final long total = this.getTotal(this.defaultStorageUrl); Pageable pageable = this.getPageRequest(); RestCollection<ArchivalInfoPackage> collection; do { // List AIPs - collection = this.aipRemoteResourceService.getAipList(storageUrl, pageable); + collection = this.aipRemoteResourceService.getAipList(this.defaultStorageUrl, pageable); pageable = pageable.next(); for (final ArchivalInfoPackage aip : collection.getData()) { final List<SubmissionInfoPackage> sipList = new ArrayList<>(); @@ -87,12 +89,12 @@ public class MetadataMigrationJob extends AbstractJob { } // Check if archve is candidate to upgrade if (this.checkIfArchiveIsUpgrable(aip, sipList, depositList)) { - job = this.upgradeArchive(job, executionId, storageUrl, aip, sipList, depositList); + job = this.upgradeArchive(job, executionId, this.defaultStorageUrl, aip, sipList, depositList); } else { - job = this.ignoreArchive(job, executionId, storageUrl, aip, sipList, depositList); + job = this.ignoreArchive(job, executionId, this.defaultStorageUrl, aip, sipList, depositList); } } catch (final Exception e) { - job = this.addInErrorItem(job, executionId, aip.getResId(), this.getAipPublicUrl(storageUrl, aip.getResId()), e.getMessage()); + job = this.addInErrorItem(job, executionId, aip.getResId(), this.getAipPublicUrl(this.defaultStorageUrl, aip.getResId()), e.getMessage()); } // Save intermediate step by 10% final long num = job.getLastExecution().getLastExecutionReport().getProcessedItems() diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PreloadAipJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PreloadAipJob.java index 9401827f27b530b103803cb25946e17bf3327092..1cc12d02e60de27ac2635a6afea72f045a3ece8a 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PreloadAipJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PreloadAipJob.java @@ -45,12 +45,12 @@ public class PreloadAipJob extends AbstractJob { private final TrustedArchiveDownloadRemoteResourceService archiveDownloadRemoteResourceService; public PreloadAipJob( - DLCMProperties configService, + DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService, TrustedArchivePublicMetadataRemoteResourceService archiveMetadataRemoteResourceService, TrustedArchiveDownloadRemoteResourceService archiveDownloadRemoteResourceService) { - super(configService, messageService, jobProcessingService); + super(dlcmProperties, messageService, jobProcessingService); this.archiveMetadataRemoteResourceService = archiveMetadataRemoteResourceService; this.archiveDownloadRemoteResourceService = archiveDownloadRemoteResourceService; } @@ -68,10 +68,8 @@ public class PreloadAipJob extends AbstractJob { num++; try { Result res = switch (job.getJobType()) { - case ARCHIVE_PRELOAD_SMALL -> this.preloadArchive(0L, this.configService.getParameters().getFileSizeLimit().toBytes(), - archiveMetadata); - case ARCHIVE_PRELOAD_BIG -> this.preloadArchive(this.configService.getParameters().getFileSizeLimit().toBytes(), Long.MAX_VALUE, - archiveMetadata); + case ARCHIVE_PRELOAD_SMALL -> this.preloadArchive(0L, this.fileSizeLimit.toBytes(), archiveMetadata); + case ARCHIVE_PRELOAD_BIG -> this.preloadArchive(this.fileSizeLimit.toBytes(), Long.MAX_VALUE, archiveMetadata); default -> throw new SolidifyProcessingException("Job type " + job.getJobType().getLabel() + " not applicable"); }; job = this.logResult(res, job, executionId, archiveMetadata.getResId(), this.getArchivePublicUrl(archiveMetadata.getResId())); diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeOrderJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeOrderJob.java index d711a7c88505b48ccbe270feeecba59f8bdc1585..244d8fe91dd6c0e86875a405bb445c748f145a73 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeOrderJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeOrderJob.java @@ -54,17 +54,17 @@ public class PurgeOrderJob extends AbstractJob { private final int timeToKeep; public PurgeOrderJob( - DLCMProperties configService, + DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService, TrustedOrderRemoteResourceService orderRemoteResourceService, TrustedDisseminationInfoPackageRemoteResourceService disseminationInfoPackageRemoteResourceService, TrustedAIPDownloadRemoteResourceService aipDownloadRemoteResourceService) { - super(configService, messageService, jobProcessingService); + super(dlcmProperties, messageService, jobProcessingService); this.orderRemoteResourceService = orderRemoteResourceService; this.disseminationInfoPackageRemoteResourceService = disseminationInfoPackageRemoteResourceService; this.aipDownloadRemoteResourceService = aipDownloadRemoteResourceService; - this.timeToKeep = configService.getPreservationPlanning().getTimeToKeepOrders(); + this.timeToKeep = dlcmProperties.getPreservationPlanning().getTimeToKeepOrders(); } @Override diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeSubmissionTempFilesJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeSubmissionTempFilesJob.java index 1881e7ba3df586c4053b97c4c75fc6c517d02948..da34d2644ed4dfd967d8770b5d1ccce47902b63e 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeSubmissionTempFilesJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeSubmissionTempFilesJob.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -53,14 +53,14 @@ public class PurgeSubmissionTempFilesJob extends AbstractJob { private long count = 0; public PurgeSubmissionTempFilesJob( - DLCMProperties configService, + DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService, TrustedDepositRemoteResourceService depositRemoteResourceService, TrustedSubmissionInfoPackageRemoteResourceService sipRemoteResourceService, TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService, TrustedArchivePublicMetadataRemoteResourceService archiveMetadataRemoteResourceService) { - super(configService, messageService, jobProcessingService); + super(dlcmProperties, messageService, jobProcessingService); this.depositRemoteResourceService = depositRemoteResourceService; this.sipRemoteResourceService = sipRemoteResourceService; this.aipRemoteResourceService = aipRemoteResourceService; diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReloadAipJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReloadAipJob.java index 07d8b04002f8d77bd7c9d1b086519a6246a55b2e..24756abbcf7542f7034f2571cc616413b27f6536 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReloadAipJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReloadAipJob.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -41,11 +41,11 @@ public class ReloadAipJob extends AbstractJob { private final TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService; public ReloadAipJob( - DLCMProperties configService, + DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService, TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService) { - super(configService, messageService, jobProcessingService); + super(dlcmProperties, messageService, jobProcessingService); this.aipRemoteResourceService = aipRemoteResourceService; } @@ -64,16 +64,16 @@ public class ReloadAipJob extends AbstractJob { // Check if AIP already exists this.aipRemoteResourceService.getAIPOnDefaultStorage(storedAip.getAipId()); job = this.addIgnoredItem(job, executionId, storedAip.getAipId(), - this.getAipPublicUrl(this.configService.getDefaultArchivalStoragePublicUrl(), storedAip.getAipId()), "Existing AIP"); + this.getAipPublicUrl(this.defaultArchivalStoragePublicUrl, storedAip.getAipId()), "Existing AIP"); } catch (final SolidifyResourceNotFoundException e) { // Reload it if not try { this.aipRemoteResourceService.createAIP(storedAip); job = this.addProcessedItem(job, executionId, storedAip.getAipId(), - this.getAipPublicUrl(this.configService.getDefaultArchivalStoragePublicUrl(), storedAip.getAipId())); + this.getAipPublicUrl(this.defaultArchivalStoragePublicUrl, storedAip.getAipId())); } catch (final SolidifyProcessingException ex) { job = this.addInErrorItem(job, executionId, storedAip.getAipId(), - this.getAipPublicUrl(this.configService.getDefaultArchivalStoragePublicUrl(), storedAip.getAipId()), ex.getMessage()); + this.getAipPublicUrl(this.defaultArchivalStoragePublicUrl, storedAip.getAipId()), ex.getMessage()); } } // Save intermediate step by 10% diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReplicationJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReplicationJob.java index 8fcbdb6fbf97291ee4d1e2b5d9de5ab14e137f36..506e438d03505e02582fe61182da459dae2e184f 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReplicationJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReplicationJob.java @@ -47,12 +47,12 @@ public class ReplicationJob extends AbstractJob { private final TrustedArchivePublicMetadataRemoteResourceService archiveMetadataRemoteResourceService; public ReplicationJob( - DLCMProperties configService, + DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService, ReplicationService replicationService, TrustedArchivePublicMetadataRemoteResourceService archiveMetadataRemoteResourceService) { - super(configService, messageService, jobProcessingService); + super(dlcmProperties, messageService, jobProcessingService); this.replicationService = replicationService; this.archiveMetadataRemoteResourceService = archiveMetadataRemoteResourceService; } @@ -85,14 +85,14 @@ public class ReplicationJob extends AbstractJob { try { this.replicationService.replicateAIP(md.getResId()); job = this.addProcessedItem(job, executionId, md.getResId(), - this.getAipPublicUrl(this.configService.getDefaultArchivalStoragePublicUrl(), md.getResId())); + this.getAipPublicUrl(this.defaultArchivalStoragePublicUrl, md.getResId())); } catch (final SolidifyCheckingException e) { job = this.addIgnoredItem(job, executionId, md.getResId(), - this.getAipPublicUrl(this.configService.getDefaultArchivalStoragePublicUrl(), md.getResId()), e.getMessage()); + this.getAipPublicUrl(this.defaultArchivalStoragePublicUrl, md.getResId()), e.getMessage()); } catch (SolidifyProcessingException | SolidifyRestException | DLCMReplicationException | DLCMCompareException e) { // extract message from parent exception job = this.addInErrorItem(job, executionId, md.getResId(), - this.getAipPublicUrl(this.configService.getDefaultArchivalStoragePublicUrl(), md.getResId()), e.getMessage()); + this.getAipPublicUrl(this.defaultArchivalStoragePublicUrl, md.getResId()), e.getMessage()); } final long num = job.getLastExecution().getLastExecutionReport().getProcessedItems() + job.getLastExecution().getLastExecutionReport().getIgnoredItems() diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/replication/basic/BasicReplicationStorageService.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/replication/basic/BasicReplicationStorageService.java index 909e14ba7880472c1cc59187b62f93439352f06a..6d1493d236325e0c0408002a5bc5c008054250f2 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/replication/basic/BasicReplicationStorageService.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/replication/basic/BasicReplicationStorageService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -60,12 +60,12 @@ public abstract class BasicReplicationStorageService extends DLCMService impleme protected final FallbackArchivalInfoPackageRemoteResourceService aipRemoteResourceService; protected BasicReplicationStorageService( - DLCMProperties config, + DLCMProperties dlcmProperties, MessageService messageService, AipService aipService, FallbackArchivalInfoPackageRemoteResourceService aipRemoteResourceService) { - super(messageService, config); - this.archivalStorageNodes = config.getArchivalStorageUrls(); + super(messageService, dlcmProperties); + this.archivalStorageNodes = dlcmProperties.getArchivalStorageUrls(); this.aipRemoteResourceService = aipRemoteResourceService; this.aipService = aipService; } diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/replication/none/NoReplicationService.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/replication/none/NoReplicationService.java index f86cfb788750a8067ca1f7e18e4a5d4b73b331e7..068ee83b7c20993c10eab0f51b51c6d987289153 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/replication/none/NoReplicationService.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/replication/none/NoReplicationService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -40,8 +40,8 @@ import ch.dlcm.service.DLCMService; @ConditionalOnBean(PreservationPlanningController.class) public class NoReplicationService extends DLCMService implements ReplicationService { - protected NoReplicationService(MessageService messageService, DLCMProperties config) { - super(messageService, config); + protected NoReplicationService(MessageService messageService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); } @Override diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/AipCachedService.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/AipCachedService.java index a7f49f904cba1ca687782ce8c14fbde0b7824d52..0804f008310f919c20853e3dcc53a1c29b0db50f 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/AipCachedService.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/AipCachedService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -66,11 +66,11 @@ public class AipCachedService extends DLCMService { private final String[] archivalStorageNodes; private final String[] archivalStoragePublicUrls; - public AipCachedService(DLCMProperties config, MessageService messageService, + public AipCachedService(DLCMProperties dlcmProperties, MessageService messageService, FallbackArchivalInfoPackageRemoteResourceService trustedAipRemoteResourceService) { - super(messageService, config); - this.archivalStorageNodes = config.getArchivalStorageUrls(); - this.archivalStoragePublicUrls = config.getArchivalStoragePublicUrls(); + super(messageService, dlcmProperties); + this.archivalStorageNodes = dlcmProperties.getArchivalStorageUrls(); + this.archivalStoragePublicUrls = dlcmProperties.getArchivalStoragePublicUrls(); this.aipRemoteResourceService = trustedAipRemoteResourceService; } @@ -115,8 +115,7 @@ public class AipCachedService extends DLCMService { * Return a map of each storage node url, associated with the corresponding stored AIP * * @param aipId - * @param returnPublicUrls - * Indicate if public storage node urls must be used to build the AIP urls + * @param returnPublicUrls Indicate if public storage node urls must be used to build the AIP urls * @return */ @Cacheable(DLCMCacheNames.AIP_BY_STORAGE_NODE) diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/AipService.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/AipService.java index 212c8abe5c5eb445564a4389a799d84adb973e80..e394e90368faccc8203294ea3aaf3bc6dcf3b303 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/AipService.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/AipService.java @@ -65,8 +65,8 @@ public class AipService extends DLCMService { private final AipCachedService aipCachedService; - public AipService(MessageService messageService, AipCachedService aipCachedService, DLCMProperties config) { - super(messageService, config); + public AipService(MessageService messageService, AipCachedService aipCachedService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.aipCachedService = aipCachedService; } diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/JobProcessingService.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/JobProcessingService.java index 7a314d0f46beae78b4ab8fa3d92cf10267828034..488e4493154e9569a9913a8124bb91fcbb7f11ab 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/JobProcessingService.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/JobProcessingService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -51,9 +51,9 @@ public class JobProcessingService extends DLCMService { protected PreservationJobRepository jobRepository; - public JobProcessingService(MessageService messageService, - PreservationJobRepository preservationJobRepository, DLCMProperties config) { - super(messageService, config); + public JobProcessingService(MessageService messageService, PreservationJobRepository preservationJobRepository, + DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.jobRepository = preservationJobRepository; } diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/JobService.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/JobService.java index a2967e74f669403f4843f8da5954e49577042869..7b5e5b546ca12dc26c1808ed293103b1b8862f5e 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/JobService.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/JobService.java @@ -79,12 +79,12 @@ public class JobService extends DLCMService { private final TrustedOrderRemoteResourceService orderRemoteResourceService; private final TrustedDisseminationInfoPackageRemoteResourceService disseminationInfoPackageRemoteResourceService; private final TrustedAIPDownloadRemoteResourceService aipDownloadRemoteResourceService; - private final DLCMProperties config; + private final DLCMProperties dlcmProperties; private final int nbProcessors = Runtime.getRuntime().availableProcessors(); private final ExecutorService executorService = Executors.newFixedThreadPool(this.nbProcessors); - public JobService(DLCMProperties config, + public JobService(DLCMProperties dlcmProperties, MessageService messageService, PreservationJobService preservationJobService, JobProcessingService jobProcessingService, @@ -98,7 +98,7 @@ public class JobService extends DLCMService { TrustedOrderRemoteResourceService orderRemoteResourceService, TrustedDisseminationInfoPackageRemoteResourceService disseminationInfoPackageRemoteResourceService, TrustedAIPDownloadRemoteResourceService aipDownloadRemoteResourceService) { - super(messageService, config); + super(messageService, dlcmProperties); this.preservationJobService = preservationJobService; this.replicationService = replicationService; this.jobProcessingService = jobProcessingService; @@ -111,7 +111,7 @@ public class JobService extends DLCMService { this.orderRemoteResourceService = orderRemoteResourceService; this.disseminationInfoPackageRemoteResourceService = disseminationInfoPackageRemoteResourceService; this.aipDownloadRemoteResourceService = aipDownloadRemoteResourceService; - this.config = config; + this.dlcmProperties = dlcmProperties; } @JmsListener(destination = "${dlcm.queue.job}") @@ -131,31 +131,31 @@ public class JobService extends DLCMService { final PreservationJob job = this.preservationJobService.findOne(jobMessage.getResId()); AbstractJob jobProcess = switch (job.getJobType()) { - case METADATA_MIGRATION -> new MetadataMigrationJob(this.config, this.messageService, this.jobProcessingService, + case METADATA_MIGRATION -> new MetadataMigrationJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.depositRemoteResourceService, this.sipRemoteResourceService, this.aipRemoteResourceService); - case RELOAD -> new ReloadAipJob(this.config, this.messageService, this.jobProcessingService, this.aipRemoteResourceService); - case REPLICATION -> new ReplicationJob(this.config, this.messageService, this.jobProcessingService, this.replicationService, + case RELOAD -> new ReloadAipJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.aipRemoteResourceService); + case REPLICATION -> new ReplicationJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.replicationService, this.archiveMetadataRemoteResourceService); - case REPLICATION_CHECK -> new CheckReplicationJob(this.config, this.messageService, this.jobProcessingService, + case REPLICATION_CHECK -> new CheckReplicationJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.replicationService, this.archiveMetadataRemoteResourceService); - case ARCHIVE_CHECK, FIXITY, REINDEX, REINDEX_ALL -> new ApplyAipActionJob(this.config, this.messageService, + case ARCHIVE_CHECK, FIXITY, REINDEX, REINDEX_ALL -> new ApplyAipActionJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.aipRemoteResourceService); - case ARCHIVE_PRELOAD_SMALL, ARCHIVE_PRELOAD_BIG -> new PreloadAipJob(this.config, this.messageService, this.jobProcessingService, + case ARCHIVE_PRELOAD_SMALL, ARCHIVE_PRELOAD_BIG -> new PreloadAipJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.archiveMetadataRemoteResourceService, this.archiveDownloadRemoteResourceService); - case CLEAN_SUBMISSION -> new CleanSubmissionJob(this.config, this.messageService, this.jobProcessingService, + case CLEAN_SUBMISSION -> new CleanSubmissionJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.submissionPolicyRemoteResourceService, this.depositRemoteResourceService, this.sipRemoteResourceService, this.aipRemoteResourceService, true); - case SIMPLE_CLEAN_SUBMISSION -> new CleanSubmissionJob(this.config, this.messageService, this.jobProcessingService, + case SIMPLE_CLEAN_SUBMISSION -> new CleanSubmissionJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.submissionPolicyRemoteResourceService, this.depositRemoteResourceService, this.sipRemoteResourceService, this.aipRemoteResourceService, false); - case PURGE_SUBMISSION_TEMP_FILES -> new PurgeSubmissionTempFilesJob(this.config, this.messageService, this.jobProcessingService, + case PURGE_SUBMISSION_TEMP_FILES -> new PurgeSubmissionTempFilesJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.depositRemoteResourceService, this.sipRemoteResourceService, this.aipRemoteResourceService, this.archiveMetadataRemoteResourceService); - case PURGE_ORDER -> new PurgeOrderJob(this.config, this.messageService, this.jobProcessingService, this.orderRemoteResourceService, + case PURGE_ORDER -> new PurgeOrderJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.orderRemoteResourceService, this.disseminationInfoPackageRemoteResourceService, this.aipDownloadRemoteResourceService); - case DISPOSAL -> new DisposalJob(this.config, this.messageService, this.jobProcessingService, + case DISPOSAL -> new DisposalJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.archiveMetadataRemoteResourceService, this.aipRemoteResourceService); - case CHECK_COMPLIANCE_LEVEL -> new CheckComplianceLevelJob(this.config, this.messageService, this.jobProcessingService, + case CHECK_COMPLIANCE_LEVEL -> new CheckComplianceLevelJob(this.dlcmProperties, this.messageService, this.jobProcessingService, this.depositRemoteResourceService); default -> throw new UnsupportedOperationException("Unsupported job type " + job.getJobType()); }; diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/MonitorService.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/MonitorService.java index b8fe1c565e7ad50604a120e0c1784d024ca48fa7..66b0d61571112a1e26b69dbfaa69d10524a232cf 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/MonitorService.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/MonitorService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -49,18 +49,18 @@ public class MonitorService extends DLCMService { private final String accessUrl; private final String[] archivalStorageUrls; - public MonitorService(DLCMProperties config, AuthorizationClientProperties authClientProperties, + public MonitorService(DLCMProperties dlcmProperties, AuthorizationClientProperties authClientProperties, MessageService messageService, FallbackRestClientService restClientService) { - super(messageService, config); + super(messageService, dlcmProperties); this.restClientService = restClientService; this.authServerUrl = authClientProperties.getAuthorizationServerUrl(); - this.adminUrl = config.getModule().getAdmin().getUrl(); - this.dataMgmtUrl = config.getModule().getDataMgmt().getUrl(); - this.preingestUrl = config.getModule().getPreingest().getUrl(); - this.ingestUrl = config.getModule().getIngest().getUrl(); - this.accessUrl = config.getModule().getAccess().getUrl(); - this.archivalStorageUrls = config.getArchivalStorageUrls(); + this.adminUrl = dlcmProperties.getModule().getAdmin().getUrl(); + this.dataMgmtUrl = dlcmProperties.getModule().getDataMgmt().getUrl(); + this.preingestUrl = dlcmProperties.getModule().getPreingest().getUrl(); + this.ingestUrl = dlcmProperties.getModule().getIngest().getUrl(); + this.accessUrl = dlcmProperties.getModule().getAccess().getUrl(); + this.archivalStorageUrls = dlcmProperties.getArchivalStorageUrls(); } public JSONObject getModuleStatuses() { diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/SchedulerPlanningService.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/SchedulerPlanningService.java index 366151aae4df781e2de9f9d2d14b9fc0771138bf..c11f386b76da8ead14f3dda1037ed2bee2668aaf 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/SchedulerPlanningService.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/SchedulerPlanningService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -55,11 +55,11 @@ public class SchedulerPlanningService extends DLCMService { private final PreservationJobService preservationJobService; private final FallbackPreservationJobRemoteResourceService preservationJobRemoteResourceService; - public SchedulerPlanningService(DLCMProperties config, MessageService messageService, + public SchedulerPlanningService(DLCMProperties dlcmProperties, MessageService messageService, FallbackPreservationJobRemoteResourceService preservationJobRemoteResourceService, PreservationJobService preservationJobService) { - super(messageService, config); - this.jobPageSize = config.getPreservationPlanning().getJobPageSize(); + super(messageService, dlcmProperties); + this.jobPageSize = dlcmProperties.getPreservationPlanning().getJobPageSize(); this.preservationJobService = preservationJobService; this.preservationJobRemoteResourceService = preservationJobRemoteResourceService; } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/business/ArchivalInfoPackageService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/business/ArchivalInfoPackageService.java index 7c0b7ea4c649f874126400acec2bc6788cf76d78..fb4bec4399cf0e4f17656afc64b703aa6210ce75 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/business/ArchivalInfoPackageService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/business/ArchivalInfoPackageService.java @@ -34,10 +34,12 @@ import ch.unige.solidify.config.SolidifyEventPublisher; import ch.unige.solidify.exception.SolidifyResourceNotFoundException; import ch.unige.solidify.rest.Resource; import ch.unige.solidify.rest.Result; +import ch.unige.solidify.service.HttpRequestInfoProvider; import ch.unige.solidify.service.RemoteResourceService; import ch.unige.solidify.util.StringTool; import ch.dlcm.DLCMConstants; +import ch.dlcm.config.DLCMProperties; import ch.dlcm.message.AipCheckMessage; import ch.dlcm.message.AipMessage; import ch.dlcm.model.AipCheckLevel; @@ -48,6 +50,7 @@ import ch.dlcm.model.oais.ArchivalInfoPackage; import ch.dlcm.model.security.User; import ch.dlcm.model.settings.OrganizationalUnit; import ch.dlcm.repository.ArchivalInfoPackageRepository; +import ch.dlcm.service.HistoryService; import ch.dlcm.service.rest.fallback.FallbackOrganizationalUnitRemoteResourceService; import ch.dlcm.service.rest.fallback.FallbackUserRemoteResourceService; import ch.dlcm.service.rest.trusted.TrustedNotificationRemoteResourceService; @@ -67,10 +70,13 @@ public class ArchivalInfoPackageService extends InfoPackageService<ArchivalInfoP private final TrustedNotificationRemoteResourceService notificationService; private final FallbackUserRemoteResourceService userService; - public ArchivalInfoPackageService( + public ArchivalInfoPackageService(DLCMProperties dlcmProperties, + HttpRequestInfoProvider httpRequestInfoProvider, + SpecificationPermissionsFilter<ArchivalInfoPackage> specificationPermissionFilter, HistoryService historyService, FallbackOrganizationalUnitRemoteResourceService organizationalUnitService, TrustedNotificationRemoteResourceService notificationService, FallbackUserRemoteResourceService userService) { + super(dlcmProperties, httpRequestInfoProvider, specificationPermissionFilter, historyService); this.organizationalUnitService = organizationalUnitService; this.notificationService = notificationService; this.userService = userService; @@ -141,7 +147,7 @@ public class ArchivalInfoPackageService extends InfoPackageService<ArchivalInfoP this.notificationService.createNotification(updaterUser, message, notificationType, organizationalUnit, aip.getResId()); } else if (aip.getInfo().getStatus() == PackageStatus.COMPLETED && (!this.historyService.hasBeenCompleted(aip.getResId()) - || this.historyService.hasBeenUpdatedSinceLastCompletedStatus(aip.getResId()))) { + || this.historyService.hasBeenUpdatedSinceLastCompletedStatus(aip.getResId()))) { message = this.messageService.get(NOTIFICATION_ARCHIVE_COMPLETED, new Object[] { aip.getResId() }); this.notificationService.createArchiveCompletedNotifications(aip, updaterUser, message, organizationalUnit); } @@ -165,7 +171,7 @@ public class ArchivalInfoPackageService extends InfoPackageService<ArchivalInfoP || aip.getInfo().getStatus() == PackageStatus.METADATA_UPGRADE_PENDING || aip.getInfo().getStatus() == PackageStatus.PACKAGE_REPLICATION_PENDING || aip.getInfo().getStatus() == PackageStatus.TOMBSTONE_REPLICATION_PENDING) { - boolean isBigPackage = this.getSize(aip) > this.dlcmProperties.getParameters().getFileSizeLimit().toBytes(); + boolean isBigPackage = this.getSize(aip) > this.fileSizeLimit.toBytes(); SolidifyEventPublisher.getPublisher().publishEvent(new AipMessage(aip.getResId(), isBigPackage)); return true; } @@ -175,7 +181,7 @@ public class ArchivalInfoPackageService extends InfoPackageService<ArchivalInfoP public boolean putPackageInCheckingQueue(ArchivalInfoPackage aip, AipCheckLevel checkLevel, String createdBy) { if (aip.getInfo().getStatus() == PackageStatus.CHECK_PENDING || aip.getInfo().getStatus() == PackageStatus.FIX_PENDING) { - boolean isBigPackage = this.getSize(aip) > this.dlcmProperties.getParameters().getFileSizeLimit().toBytes(); + boolean isBigPackage = this.getSize(aip) > this.fileSizeLimit.toBytes(); SolidifyEventPublisher.getPublisher().publishEvent(new AipCheckMessage(aip.getResId(), isBigPackage, checkLevel, createdBy)); return true; } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/business/InfoPackageService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/business/InfoPackageService.java index 6d32e38fd53199b65062244a61fc2a17a738920b..2ff30e459fb39b4672cc973a935686e9f3a3e19c 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/business/InfoPackageService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/business/InfoPackageService.java @@ -23,7 +23,7 @@ package ch.dlcm.business; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.unit.DataSize; import ch.unige.solidify.exception.SolidifyCheckingException; import ch.unige.solidify.rest.Resource; @@ -38,18 +38,22 @@ import ch.dlcm.service.HistoryService; public abstract class InfoPackageService<T extends Resource> extends CompositeResourceService<T> { - @Autowired protected HttpRequestInfoProvider httpRequestInfoProvider; - @Autowired protected SpecificationPermissionsFilter<T> specificationPermissionFilter; - @Autowired - protected DLCMProperties dlcmProperties; - - @Autowired protected HistoryService historyService; + protected final DataSize fileSizeLimit; + + protected InfoPackageService(DLCMProperties dlcmProperties, HttpRequestInfoProvider httpRequestInfoProvider, + SpecificationPermissionsFilter<T> specificationPermissionFilter, HistoryService historyService) { + this.httpRequestInfoProvider = httpRequestInfoProvider; + this.specificationPermissionFilter = specificationPermissionFilter; + this.historyService = historyService; + this.fileSizeLimit = dlcmProperties.getParameters().getFileSizeLimit(); + } + protected Result savePackageResumeStatus(InfoPackageInterface item) { final Result result = new Result(item.getResId()); if (item.getInfo().getStatus() == PackageStatus.COMPLETED) { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/config/DLCMAsyncConfig.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/config/DLCMAsyncConfig.java index e3961d6cdc93ee9029ac9553b96220a6f19b46a2..f39a6c87be3ab75d5da38a948a6dc7a1a0105fab 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/config/DLCMAsyncConfig.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/config/DLCMAsyncConfig.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -35,10 +35,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @EnableAsync public class DLCMAsyncConfig extends AsyncConfigurerSupport { - private DLCMProperties configService; + private final long defaultAsyncExecutionTimeout; - public DLCMAsyncConfig(DLCMProperties configService) { - this.configService = configService; + public DLCMAsyncConfig(DLCMProperties dlcmProperties) { + this.defaultAsyncExecutionTimeout = dlcmProperties.getParameters().getDefaultAsyncExecutionTimeout(); } /** @@ -52,7 +52,7 @@ public class DLCMAsyncConfig extends AsyncConfigurerSupport { public void configureAsyncSupport(AsyncSupportConfigurer configurer) { // set no time limit for async executions to allow downloading very large files with StreamingResponseBody - configurer.setDefaultTimeout(DLCMAsyncConfig.this.configService.getParameters().getDefaultAsyncExecutionTimeout()).setTaskExecutor(taskExecutor); + configurer.setDefaultTimeout(DLCMAsyncConfig.this.defaultAsyncExecutionTimeout).setTaskExecutor(taskExecutor); } }; } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/AbstractDataFileController.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/AbstractDataFileController.java index b7ba113ae0d499c724fc3fc9ed4f8f3ce990f16c..1f0e11c58da92593eac917e1092616707e8abf23 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/AbstractDataFileController.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/AbstractDataFileController.java @@ -23,13 +23,13 @@ package ch.dlcm.controller; -import jakarta.validation.Valid; - import org.springframework.http.HttpEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import jakarta.validation.Valid; + import ch.unige.solidify.exception.SolidifyResourceNotFoundException; import ch.unige.solidify.rest.RemoteResourceContainer; import ch.unige.solidify.rest.Resource; @@ -39,10 +39,15 @@ import ch.dlcm.model.AbstractDataFile; import ch.dlcm.model.AbstractDataFile.DataFileStatus; import ch.dlcm.model.DataFileOwnerInterface; import ch.dlcm.model.oais.MetadataVersionAware; +import ch.dlcm.service.HistoryService; public abstract class AbstractDataFileController<T extends Resource & RemoteResourceContainer & MetadataVersionAware & DataFileOwnerInterface<V>, V extends AbstractDataFile<T, V>> extends DLCMCompositionController<T, V> { + public AbstractDataFileController(HistoryService historyService) { + super(historyService); + } + @Override @PostMapping public HttpEntity<V> create(@PathVariable final String parentid, final @Valid @RequestBody V childResource) { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/AbstractPackageController.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/AbstractPackageController.java index 6e2f71d076a15b29a104bc0cc42e70e496588344..1392b3e37199a887dfc91a476c7ee8360606a4d0 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/AbstractPackageController.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/AbstractPackageController.java @@ -60,6 +60,7 @@ import ch.dlcm.model.oais.MetadataVersionAware; import ch.dlcm.rest.DLCMActionName; import ch.dlcm.rest.ResourceName; import ch.dlcm.service.DataCategoryService; +import ch.dlcm.service.HistoryService; import ch.dlcm.service.MetadataService; import ch.dlcm.service.rest.propagate.PropagateMetadataTypeRemoteResourceService; @@ -82,13 +83,12 @@ public abstract class AbstractPackageController<S extends AbstractDataFile<T, ?> protected final DataFileService<S> dataFileService; protected final DataCategoryService dataCategoryService; - protected AbstractPackageController( - PropagateMetadataTypeRemoteResourceService metadataTypeService, - MetadataService metadataService, - DataFileService<S> dataFileService, + protected AbstractPackageController(HistoryService historyService, MetadataService metadataService, + PropagateMetadataTypeRemoteResourceService metadataTypeService, DataFileService<S> dataFileService, DataCategoryService dataCategoryService) { - this.metadataTypeService = metadataTypeService; + super(historyService); this.metadataService = metadataService; + this.metadataTypeService = metadataTypeService; this.dataFileService = dataFileService; this.dataCategoryService = dataCategoryService; } @@ -121,19 +121,19 @@ public abstract class AbstractPackageController<S extends AbstractDataFile<T, ?> final DLCMMetadataVersion metadataVersion = this.getVersion(version); final ClassPathResource profile = new ClassPathResource( SolidifyConstants.SCHEMA_HOME + "/" + metadataVersion.getMetsProfile()); - return getXsdAsStreamingResponse(profile); + return this.getXsdAsStreamingResponse(profile); } protected HttpEntity<StreamingResponseBody> getRepresentationInfoSchema(String version) { final DLCMMetadataVersion metadataVersion = this.getVersion(version); final ClassPathResource xsd = this.metadataService.getRepresentationInfoSchema(metadataVersion); - return getXsdAsStreamingResponse(xsd); + return this.getXsdAsStreamingResponse(xsd); } protected HttpEntity<StreamingResponseBody> getSchemaStream(String version, AbstractDataFile<?, ?> df) { final DLCMMetadataVersion metadataVersion = this.getVersion(version); final ClassPathResource xsd = this.metadataService.getResourceSchema(metadataVersion, df); - return getXsdAsStreamingResponse(xsd); + return this.getXsdAsStreamingResponse(xsd); } protected HttpEntity<S> upload(String id, FileUploadDto<S> fileUploadDto, String tmpLocation, UploadMode uploadMode) throws IOException { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/DLCMCompositionController.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/DLCMCompositionController.java index 5df5d85eaf3d55ed373648833d8914f8b1f43c11..eee531cc8a7339802817826e56a338760395c2d4 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/DLCMCompositionController.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/DLCMCompositionController.java @@ -28,7 +28,6 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import java.net.URI; import java.util.NoSuchElementException; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.FileSystemResource; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -55,9 +54,12 @@ import ch.dlcm.service.HistoryService; @UserPermissions public abstract class DLCMCompositionController<T extends Resource, V extends Resource> extends CompositionController<T, V> { - @Autowired protected HistoryService historyService; + public DLCMCompositionController(HistoryService historyService) { + this.historyService = historyService; + } + @GetMapping(SolidifyConstants.URL_ID_PLUS_SEP + ResourceName.HISTORY) public HttpEntity<RestCollection<StatusHistory>> history(@PathVariable String parentid, @PathVariable String id, Pageable pageable) { if (this.checkSubresourceExistsAndIsLinkedToParentAndModifiable(id, parentid, false) == null) { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/DLCMModuleController.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/DLCMModuleController.java index 961b201cbbecbe2d12d507adc278a96425c4530b..08f7c057c4c34d89de2756cc0ba46fbf71f6377b 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/DLCMModuleController.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/DLCMModuleController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -27,7 +27,6 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import org.json.JSONObject; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -44,11 +43,11 @@ import ch.dlcm.service.ToolService; public abstract class DLCMModuleController extends ModuleController { - @Autowired ToolList toolList; - DLCMModuleController(String name) { + public DLCMModuleController(String name, ToolList toolList) { super(name); + this.toolList = toolList; } @GetMapping(value = "/checkTool", produces = { MediaType.APPLICATION_JSON_VALUE }) diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/ResourceWithHistoryController.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/ResourceWithHistoryController.java index 833bfe3e287cbeceabfb945bb1f94c01e330da3b..5cdac7b93d70eee5897cad8ba53fb09de10bcbb5 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/ResourceWithHistoryController.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/controller/ResourceWithHistoryController.java @@ -26,7 +26,6 @@ package ch.dlcm.controller; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpEntity; @@ -43,19 +42,19 @@ import ch.unige.solidify.rest.RestCollection; import ch.unige.solidify.rest.Tool; import ch.unige.solidify.security.UserPermissions; -import ch.dlcm.config.DLCMProperties; import ch.dlcm.model.StatusHistory; import ch.dlcm.rest.ResourceName; import ch.dlcm.service.HistoryService; @UserPermissions public abstract class ResourceWithHistoryController<T extends Resource> extends ResourceController<T> { - @Autowired - protected DLCMProperties config; - @Autowired protected HistoryService historyService; + protected ResourceWithHistoryController(HistoryService historyService) { + this.historyService = historyService; + } + @GetMapping(SolidifyConstants.URL_ID_PLUS_SEP + ResourceName.HISTORY) public HttpEntity<RestCollection<StatusHistory>> history(@PathVariable String id, Pageable pageable) { if (!this.itemService.existsById(id)) { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/fileformat/FileFormatService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/fileformat/FileFormatService.java index f16611d6089287c4de4a236ec3ce6d6faea70ee5..e95e02857bb72cff5ab4d4cd33409d3b306b7a91 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/fileformat/FileFormatService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/fileformat/FileFormatService.java @@ -54,9 +54,9 @@ public abstract class FileFormatService extends ToolService { private final long fileSizeLimit; - protected FileFormatService(DLCMProperties config, MessageService messageService) { - super(messageService, config); - this.fileSizeLimit = config.getParameters().getFileSizeLimit().toBytes(); + protected FileFormatService(DLCMProperties dlcmProperties, MessageService messageService) { + super(messageService, dlcmProperties); + this.fileSizeLimit = dlcmProperties.getParameters().getFileSizeLimit().toBytes(); } // ********************************* diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/AbstractDataFileListenerService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/AbstractDataFileListenerService.java index 2b865ef194b12b56e3c3d00ab6e26b7a1f8058fc..59450666d40bbd7e12ccecd83b4c26dd44267784 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/AbstractDataFileListenerService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/AbstractDataFileListenerService.java @@ -54,21 +54,21 @@ public abstract class AbstractDataFileListenerService<T extends AbstractDataFile private final ResourceService<T> specificDataFileService; private final ExecutorService executorService; - protected AbstractDataFileListenerService(DLCMProperties config, + protected AbstractDataFileListenerService(DLCMProperties dlcmProperties, MessageService messageService, DataFileStatusService dfStatusService, TrustedUserRemoteResourceService userRemoteService, TrustedNotificationRemoteResourceService notificationRemoteService, TrustedOrganizationalUnitRemoteResourceService organizationalUnitRemoteService, ResourceService<T> specificDataFileService) { - super(messageService, config); - this.fileSizeLimit = config.getParameters().getFileSizeLimit().toBytes(); + super(messageService, dlcmProperties); + this.fileSizeLimit = dlcmProperties.getParameters().getFileSizeLimit().toBytes(); this.dfStatusService = dfStatusService; this.userRemoteService = userRemoteService; this.notificationRemoteService = notificationRemoteService; this.organizationalUnitRemoteService = organizationalUnitRemoteService; this.specificDataFileService = specificDataFileService; - this.executorService = Executors.newFixedThreadPool(config.getParameters().getDataFileThreadPoolSize()); + this.executorService = Executors.newFixedThreadPool(dlcmProperties.getParameters().getDataFileThreadPoolSize()); } protected void receiveDataFileMessage(DataFileMessage dataFileMessage) { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/CacheService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/CacheService.java index 828b50b9d96fdd1b64d026519c3f5ccc0772dce3..99e2d2faf944c75a21de894a836d27998a094a58 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/CacheService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/CacheService.java @@ -35,7 +35,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.CacheManager; import org.springframework.cache.annotation.CacheEvict; import org.springframework.context.annotation.Lazy; @@ -62,11 +61,8 @@ public class CacheService extends AbstractCacheService { /** * Autowiring itself allows cache to work on a method inside its own class */ - @Autowired - @Lazy protected CacheService self; - @Autowired CacheManager cacheManager; private final Map<String, List<OrganizationalUnit>> cachedOrganizationalUnits = new ConcurrentHashMap<>(); @@ -81,8 +77,15 @@ public class CacheService extends AbstractCacheService { private final Map<String, Date> cachedArchiveAverageRatingDates = new ConcurrentHashMap<>(); - @Autowired - private DLCMProperties config; + private final int authorizedUnitsCacheTime; + private final int archiveRatingCacheTime; + + public CacheService(DLCMProperties dlcmProperties, @Lazy CacheService self, CacheManager cacheManager) { + this.self = self; + this.cacheManager = cacheManager; + this.authorizedUnitsCacheTime = dlcmProperties.getParameters().getAuthorizedUnitsCacheTime(); + this.archiveRatingCacheTime = dlcmProperties.getParameters().getArchiveRatingCacheTime(); + } /** * Clear entry in OrganizationalUnitRoles cache identified by a personId and an organizational unit id @@ -143,8 +146,7 @@ public class CacheService extends AbstractCacheService { if (!StringTool.isNullOrEmpty(cacheKey)) { final Date cacheDate = this.cachedOrganizationalUnitsDates.get(cacheKey); - if (cacheDate != null && (System.currentTimeMillis() - cacheDate.getTime()) < (this.config.getParameters().getAuthorizedUnitsCacheTime() - * 1000)) { + if (cacheDate != null && (System.currentTimeMillis() - cacheDate.getTime()) < this.authorizedUnitsCacheTime * 1000) { /* * organizationalUnits taken from the cache */ @@ -167,8 +169,7 @@ public class CacheService extends AbstractCacheService { if (!StringTool.isNullOrEmpty(cacheKey)) { final Date cacheDate = this.cachedArchiveAverageRatingDates.get(cacheKey); - if (cacheDate != null && (System.currentTimeMillis() - cacheDate.getTime()) < (this.config.getParameters().getArchiveRatingCacheTime() - * 1000)) { + if (cacheDate != null && (System.currentTimeMillis() - cacheDate.getTime()) < this.archiveRatingCacheTime * 1000) { /* * AverageRating for this Archive taken from the cache */ diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DLCMService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DLCMService.java index cfcd84a996e4965a290d385a710a02b987d8468b..624f053fab72e47ac74484bd7c829be2ca507ac5 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DLCMService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DLCMService.java @@ -72,11 +72,11 @@ public abstract class DLCMService { protected final MessageService messageService; - protected DLCMService(MessageService messageService, DLCMProperties config) { + protected DLCMService(MessageService messageService, DLCMProperties dlcmProperties) { this.messageService = messageService; - Arrays.asList(config.getParameters().getChecksumList()) + Arrays.asList(dlcmProperties.getParameters().getChecksumList()) .forEach(el -> this.supportedChecksumAlgo.add(StandardSupportedAlgorithms.valueOf(el))); - this.batItInternalFileNumber = (config.getParameters().getChecksumList().length * 2L) + BAGIT_FIXED_FILES.size(); + this.batItInternalFileNumber = (dlcmProperties.getParameters().getChecksumList().length * 2L) + BAGIT_FIXED_FILES.size(); } protected <T extends Resource> boolean belongsToList(T item, List<T> list) { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DataCategoryService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DataCategoryService.java index 21be440c1932cdafd116f84cbf5d26bee0f3da0e..4d4933ad71fb53f793bf0972acec69ac173e8d98 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DataCategoryService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DataCategoryService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -43,11 +43,11 @@ public class DataCategoryService extends DLCMService { private final List<DataCategory> dataFileCategoryList; private final List<DataCategory> packageCategoryList; - public DataCategoryService(MessageService messageService, DLCMProperties config) { - super(messageService, config); + public DataCategoryService(MessageService messageService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); // Configuration - this.researchDataEnabled = config.getParameters().isResearchDataEnabled(); - this.administrativeDataEnabled = config.getParameters().isAdministrativeDataEnabled(); + this.researchDataEnabled = dlcmProperties.getParameters().isResearchDataEnabled(); + this.administrativeDataEnabled = dlcmProperties.getParameters().isAdministrativeDataEnabled(); // Data File list this.dataFileCategoryList = DataCategory.listCategories(); if (!this.researchDataEnabled) { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DataFileStatusService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DataFileStatusService.java index dadee88a676f7740477246c5a8dc20d39f321ec1..2406f7aed9ac47a59a6ed48e800c4e84fda0d2b3 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DataFileStatusService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/DataFileStatusService.java @@ -97,21 +97,21 @@ public class DataFileStatusService extends DLCMService { private final FallbackRestClientService restClientService; public DataFileStatusService( - DLCMProperties config, + DLCMProperties dlcmProperties, MessageService messageService, FallbackRestClientService restClientService, MetadataService metadataService, FileFormatService fileFormatService, VirusCheckService virusCheckService) { - super(messageService, config); + super(messageService, dlcmProperties); this.metadataService = metadataService; this.fileFormatService = fileFormatService; this.virusCheckService = virusCheckService; this.restClientService = restClientService; - this.checksumList = config.getParameters().getChecksumList(); - this.excludeList = config.getParameters().getExcludeList(); - this.ignoreList = config.getParameters().getIgnoreList(); - this.fileSizeLimit = config.getParameters().getFileSizeLimit().toBytes(); + this.checksumList = dlcmProperties.getParameters().getChecksumList(); + this.excludeList = dlcmProperties.getParameters().getExcludeList(); + this.ignoreList = dlcmProperties.getParameters().getIgnoreList(); + this.fileSizeLimit = dlcmProperties.getParameters().getFileSizeLimit().toBytes(); } public boolean getData(AbstractDataFile<?, ?> dataFile, String preparationPath) { @@ -317,7 +317,7 @@ public class DataFileStatusService extends DLCMService { } if (df.getDataCategory() == DataCategory.Package && (df.getDataType() == DataCategory.UpdatePackage - || df.getDataType() == DataCategory.UpdatedMetadata)) { + || df.getDataType() == DataCategory.UpdatedMetadata)) { if (df.getInfoPackage() instanceof Deposit deposit) { deposit.setContainsUpdatedMetadata(true); } else { @@ -471,7 +471,7 @@ public class DataFileStatusService extends DLCMService { // Skip check for OAIS information packages if (df.getDataCategory() == DataCategory.Package && (df.getDataType() == DataCategory.InformationPackage - || df.getDataType() == DataCategory.UpdatePackage)) { + || df.getDataType() == DataCategory.UpdatePackage)) { return; } // Check PUID if data file has a PUID diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/EmailProcessingService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/EmailProcessingService.java index 94dfcfa56d456a2031d88abf89268f13c1d81f98..fe5e993987b6989967061564ddc21737f780850b 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/EmailProcessingService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/EmailProcessingService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -42,14 +42,12 @@ public abstract class EmailProcessingService extends DLCMService { protected final EmailService emailService; protected final String submissionPortalHomepage; protected final String project; - protected final DLCMProperties config; - protected EmailProcessingService(MessageService messageService, EmailService emailService, DLCMProperties config) { - super(messageService, config); + protected EmailProcessingService(MessageService messageService, EmailService emailService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.emailService = emailService; - this.config = config; - this.submissionPortalHomepage = config.getParameters().getSubmissionPortalHomepage(); - this.project = config.getParameters().getProjectNameForEmailTemplates(); + this.submissionPortalHomepage = dlcmProperties.getParameters().getSubmissionPortalHomepage(); + this.project = dlcmProperties.getParameters().getProjectNameForEmailTemplates(); } @JmsListener(destination = "${dlcm.topic.emails}", containerFactory = "topicListenerFactory") diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/HistoryService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/HistoryService.java index 7fce1e80a944b078862f731c35589f347a2d9d36..425f486c56c7a49d17c8cd561824f65a84480c95 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/HistoryService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/HistoryService.java @@ -57,8 +57,8 @@ public class HistoryService extends DLCMService { private final FallbackUserRemoteResourceService userResourceService; public HistoryService(MessageService messageService, HistoryRepository historyRepository, - FallbackUserRemoteResourceService userResourceService, DLCMProperties config) { - super(messageService, config); + FallbackUserRemoteResourceService userResourceService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.historyRepository = historyRepository; this.userResourceService = userResourceService; } @@ -285,7 +285,7 @@ public class HistoryService extends DLCMService { String currentStatus = fullHistory.get(i).getStatus(); if (!currentStatus.equals(StatusHistory.CREATED_STATUS) && (PackageStatus.isCompletedProcess(PackageStatus.valueOf(currentStatus)) - || PackageStatus.isInError(PackageStatus.valueOf(currentStatus)))) { + || PackageStatus.isInError(PackageStatus.valueOf(currentStatus)))) { secondLast = i; } } @@ -307,7 +307,7 @@ public class HistoryService extends DLCMService { String currentStatus = fullHistory.get(i).getStatus(); if (!currentStatus.equals(StatusHistory.CREATED_STATUS) && (DepositStatus.isCompletedProcess(DepositStatus.valueOf(currentStatus)) - || DepositStatus.isInError(DepositStatus.valueOf(currentStatus)))) { + || DepositStatus.isInError(DepositStatus.valueOf(currentStatus)))) { secondLast = i; } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/JmsService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/JmsService.java index 04cdc71c7e597bb2d0db30bfc497bb77db8832bb..256b7896bbe485f063caf0bd29b926b305751d68 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/JmsService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/JmsService.java @@ -84,31 +84,31 @@ public class JmsService extends DLCMService { private final JsonSerializerMessagePostCreator jsonSerializerMessagePostCreator; - public JmsService(JmsTemplate queueJmsTemplate, @Qualifier("topicJmsTemplate") JmsTemplate topicJmsTemplate, DLCMProperties config, + public JmsService(JmsTemplate queueJmsTemplate, @Qualifier("topicJmsTemplate") JmsTemplate topicJmsTemplate, DLCMProperties dlcmProperties, MessageService messageService) { - super(messageService, config); + super(messageService, dlcmProperties); this.queueJmsTemplate = queueJmsTemplate; this.topicJmsTemplate = topicJmsTemplate; this.jsonSerializerMessagePostCreator = new JsonSerializerMessagePostCreator(); - this.aipDownloadQueue = config.getQueue().getAipDownload(); - this.aipRefreshQueue = config.getQueue().getAipRefresh(); - this.aipFixityQueue = config.getQueue().getAipFixity(); - this.aipQueue = config.getQueue().getAip(); - this.depositDataFileQueue = config.getQueue().getDepositDataFile(); - this.sipDataFileQueue = config.getQueue().getSipDataFile(); - this.aipDataFileQueue = config.getQueue().getAipDataFile(); - this.dipDataFileQueue = config.getQueue().getDipDataFile(); - this.depositQueue = config.getQueue().getDeposit(); - this.dipQueue = config.getQueue().getDip(); - this.jobQueue = config.getQueue().getJob(); - this.orderQueue = config.getQueue().getOrder(); - this.orgUnitQueue = config.getQueue().getOrgunit(); - this.sipQueue = config.getQueue().getSip(); - this.archiveQueue = config.getQueue().getArchive(); - this.notificationQueue = config.getQueue().getNotification(); - this.cacheTopic = config.getTopic().getCache(); - this.emailsQueue = config.getTopic().getEmails(); - this.archiveReindexedTopic = config.getTopic().getArchiveReindexed(); + this.aipDownloadQueue = dlcmProperties.getQueue().getAipDownload(); + this.aipRefreshQueue = dlcmProperties.getQueue().getAipRefresh(); + this.aipFixityQueue = dlcmProperties.getQueue().getAipFixity(); + this.aipQueue = dlcmProperties.getQueue().getAip(); + this.depositDataFileQueue = dlcmProperties.getQueue().getDepositDataFile(); + this.sipDataFileQueue = dlcmProperties.getQueue().getSipDataFile(); + this.aipDataFileQueue = dlcmProperties.getQueue().getAipDataFile(); + this.dipDataFileQueue = dlcmProperties.getQueue().getDipDataFile(); + this.depositQueue = dlcmProperties.getQueue().getDeposit(); + this.dipQueue = dlcmProperties.getQueue().getDip(); + this.jobQueue = dlcmProperties.getQueue().getJob(); + this.orderQueue = dlcmProperties.getQueue().getOrder(); + this.orgUnitQueue = dlcmProperties.getQueue().getOrgunit(); + this.sipQueue = dlcmProperties.getQueue().getSip(); + this.archiveQueue = dlcmProperties.getQueue().getArchive(); + this.notificationQueue = dlcmProperties.getQueue().getNotification(); + this.cacheTopic = dlcmProperties.getTopic().getCache(); + this.emailsQueue = dlcmProperties.getTopic().getEmails(); + this.archiveReindexedTopic = dlcmProperties.getTopic().getArchiveReindexed(); } private void convertAndSendToQueue(String queue, Object event) { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/MessageProcessorBySize.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/MessageProcessorBySize.java index 786c200f1dee53813047a8bc3908540535db67e9..b94623fc5dbafc0054f18de804adc9ddfb4dc676 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/MessageProcessorBySize.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/MessageProcessorBySize.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -38,6 +38,7 @@ import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextImpl; import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.util.unit.DataSize; import ch.unige.solidify.SolidifyConstants; @@ -50,18 +51,17 @@ public abstract class MessageProcessorBySize<T extends PackageMessage> { final ExecutorService bigSizeExecutor; final ExecutorService smallSizeExecutor; + private final DataSize fileSizeLimit; - protected DLCMProperties configService; - - protected MessageProcessorBySize(DLCMProperties configService) { + protected MessageProcessorBySize(DLCMProperties dlcmProperties) { this.bigSizeExecutor = Executors.newFixedThreadPool(1); this.smallSizeExecutor = Executors.newFixedThreadPool(1); - this.configService = configService; + this.fileSizeLimit = dlcmProperties.getParameters().getFileSizeLimit(); } public abstract void processMessage(T message); - public abstract void receiveMessage(T Message); + public abstract void receiveMessage(T message); void sendForParallelProcessing(T message) { if (message.isBigPackage()) { @@ -123,7 +123,7 @@ public abstract class MessageProcessorBySize<T extends PackageMessage> { } protected boolean isBigPackageSize(long bytes) { - return bytes > this.configService.getParameters().getFileSizeLimit().toBytes(); + return bytes > this.fileSizeLimit.toBytes(); } private Runnable runnableWithStacktrace(Runnable runnable) { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/MetadataService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/MetadataService.java index 12ad7e81aa4305f33df3b56a197d95646307dfdb..27761b73df034bbbca71010b02360265fe4175b6 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/MetadataService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/MetadataService.java @@ -33,16 +33,16 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBException; -import jakarta.xml.bind.Marshaller; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.logging.LogLevel; import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; + import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyCheckingException; import ch.unige.solidify.exception.SolidifyProcessingException; @@ -98,7 +98,7 @@ import ch.dlcm.service.rest.trusted.TrustedDepositRemoteResourceService; @Service public class MetadataService extends DLCMService implements OAIMetadataService { private final String preingestTempLocation; - private final DLCMProperties config; + private final DLCMProperties dlcmProperties; private final DLCMRepositoryDescription repositoryDescription; private final FallbackArchivalInfoPackageRemoteResourceService aipRemoteService; private final GitInfoProperties gitInfoProperties; @@ -122,7 +122,7 @@ public class MetadataService extends DLCMService implements OAIMetadataService { FallbackOrganizationalUnitRemoteResourceService orgUnitRemoteService, FallbackArchivalInfoPackageRemoteResourceService aipRemoteService, HistoryService historyService, - DLCMProperties config, + DLCMProperties dlcmProperties, DLCMRepositoryDescription repositoryDescription, MessageService messageService, GitInfoProperties gitInfoProperties, @@ -135,9 +135,9 @@ public class MetadataService extends DLCMService implements OAIMetadataService { FallbackPreservationPolicyRemoteResourceService preservationPolicyRemoteService, FallbackArchiveTypeRemoteResourceService archiveTypeResourceService, TrustedDepositRemoteResourceService depositRemoteService) { - super(messageService, config); - this.preingestTempLocation = config.getTempLocation(config.getPreingestLocation()); - this.config = config; + super(messageService, dlcmProperties); + this.preingestTempLocation = dlcmProperties.getTempLocation(dlcmProperties.getPreingestLocation()); + this.dlcmProperties = dlcmProperties; this.repositoryDescription = repositoryDescription; this.languageRemoteService = languageRemoteService; this.orgUnitRemoteService = orgUnitRemoteService; @@ -462,7 +462,7 @@ public class MetadataService extends DLCMService implements OAIMetadataService { } else { if (df.getStatus() != null && (df.getStatus().equals(DataFileStatus.CHECK_COMPLIANCE) - || df.getStatus().equals(DataFileStatus.CHECK_COMPLIANCE_CLEANED))) { + || df.getStatus().equals(DataFileStatus.CHECK_COMPLIANCE_CLEANED))) { xsd = new ClassPathResource(SolidifyConstants.SCHEMA_HOME + "/" + version.getMetsSchema()); } else { xsd = new ClassPathResource(SolidifyConstants.SCHEMA_HOME + "/" + version.getRepresentationInfoSchema()); @@ -478,8 +478,8 @@ public class MetadataService extends DLCMService implements OAIMetadataService { // Add FITS schema if (!(df instanceof DepositDataFile) || (df.getStatus() != null - && (df.getStatus().equals(DataFileStatus.CHECK_COMPLIANCE) - || df.getStatus().equals(DataFileStatus.CHECK_COMPLIANCE_CLEANED)))) { + && (df.getStatus().equals(DataFileStatus.CHECK_COMPLIANCE) + || df.getStatus().equals(DataFileStatus.CHECK_COMPLIANCE_CLEANED)))) { list.add(new ClassPathResource(SolidifyConstants.SCHEMA_HOME + "/fits_output.xsd").getURL()); } return list; @@ -489,7 +489,7 @@ public class MetadataService extends DLCMService implements OAIMetadataService { return switch (version) { case V1_0, V1_1 -> new MetadataVersion1( version, - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.archivePublicMetadataRemoteService, @@ -506,7 +506,7 @@ public class MetadataService extends DLCMService implements OAIMetadataService { this.gitInfoProperties); case V2_0, V2_1 -> new MetadataVersion2( version, - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.archivePublicMetadataRemoteService, @@ -523,7 +523,7 @@ public class MetadataService extends DLCMService implements OAIMetadataService { this.gitInfoProperties); case V3_0, V3_1 -> new MetadataVersion3( version, - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.archivePublicMetadataRemoteService, @@ -540,7 +540,7 @@ public class MetadataService extends DLCMService implements OAIMetadataService { this.gitInfoProperties); case V4_0 -> new MetadataVersion4( version, - this.config, + this.dlcmProperties, this.repositoryDescription, this.messageService, this.archivePublicMetadataRemoteService, diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/OrganizationalUnitListenerService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/OrganizationalUnitListenerService.java index a11c5674bdd87c39290a73ef34a34f1f37904252..7e62391f855792acb44e5ee2358fdc6d4d122012 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/OrganizationalUnitListenerService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/OrganizationalUnitListenerService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -42,8 +42,8 @@ public class OrganizationalUnitListenerService extends DLCMService { private final FallbackOrganizationalUnitRemoteResourceService organizationalUnitRemoteResourceService; public OrganizationalUnitListenerService(MessageService messageService, - FallbackOrganizationalUnitRemoteResourceService organizationalUnitRemoteResourceService, DLCMProperties config) { - super(messageService, config); + FallbackOrganizationalUnitRemoteResourceService organizationalUnitRemoteResourceService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.organizationalUnitRemoteResourceService = organizationalUnitRemoteResourceService; } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/SearchMgmt.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/SearchMgmt.java index 0be470abcc1fc9d6268a785ba93ffe0876180221..9fc2d067156463699d6c7fceb5dc11c369c5de23 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/SearchMgmt.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/SearchMgmt.java @@ -68,8 +68,8 @@ public class SearchMgmt extends DLCMService implements OAISearchService { TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService, FallbackArchivePublicMetadataRemoteResourceService archivePublicMetadataRemoteResourceService, FallbackArchivePrivateMetadataRemoteResourceService archivePrivateMetadataRemoteResourceService, - DLCMProperties config) { - super(messageService, config); + DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); this.aipRemoteResourceService = aipRemoteResourceService; this.archivePublicMetadataRemoteResourceService = archivePublicMetadataRemoteResourceService; this.archivePrivateMetadataRemoteResourceService = archivePrivateMetadataRemoteResourceService; diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/ToolService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/ToolService.java index f44a8ed8b34ddee46465e455492d37c3b550c803..13d1715bf5a2d30c09687a35167026b8c515bdb3 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/ToolService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/ToolService.java @@ -38,8 +38,8 @@ import ch.dlcm.model.ToolContainer; public abstract class ToolService extends DLCMService { - protected ToolService(MessageService messageService, DLCMProperties config) { - super(messageService, config); + protected ToolService(MessageService messageService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataGenerator.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataGenerator.java index 87ebc670f4373ccf7edfd0a98da7f2b05b8bd185..86a5866fa11d76792c6affe17631a92aa9e65135 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataGenerator.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataGenerator.java @@ -190,7 +190,7 @@ public abstract class MetadataGenerator { // ** Constructor ** // ***************** protected MetadataGenerator(DLCMMetadataVersion metadataVersion, - DLCMProperties config, + DLCMProperties dlcmProperties, DLCMRepositoryDescription repositoryDescription, MessageService messageService, FallbackArchivePublicMetadataRemoteResourceService archivePublicMetadataResourceService, @@ -221,10 +221,10 @@ public abstract class MetadataGenerator { this.preservationPolicyResourceService = preservationPolicyResourceService; this.archiveTypeResourceService = archiveTypeResourceService; this.gitInfoProperties = gitInfoProperties; - this.defaultChecksumAlgo = ChecksumAlgorithm.valueOf(config.getParameters().getDefaultChecksum()); - this.idPrefix = config.getParameters().getMetsIdPrefix(); - this.webUrls = config.getWebUrls(); - this.defaultIdentifierType = config.getParameters().getDefaultIdentifierType(); + this.defaultChecksumAlgo = ChecksumAlgorithm.valueOf(dlcmProperties.getParameters().getDefaultChecksum()); + this.idPrefix = dlcmProperties.getParameters().getMetsIdPrefix(); + this.webUrls = dlcmProperties.getWebUrls(); + this.defaultIdentifierType = dlcmProperties.getParameters().getDefaultIdentifierType(); } // ********************** diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion1.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion1.java index ac1c87ad05081a117804be5e08032e7ec950c9b8..287412a52e8da996229ea269fcfe0b361dc05c3e 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion1.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion1.java @@ -45,21 +45,20 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; - import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactoryConfigurationError; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; + import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.Marshaller; import jakarta.xml.bind.Unmarshaller; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.StringUtils; - import ch.unige.solidify.OAIConstants; import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyCheckingException; @@ -180,7 +179,7 @@ public class MetadataVersion1 extends MetadataGenerator { public MetadataVersion1( DLCMMetadataVersion version, - DLCMProperties config, + DLCMProperties dlcmProperties, DLCMRepositoryDescription repositoryDescription, MessageService messageService, FallbackArchivePublicMetadataRemoteResourceService archivePublicMetadataResourceService, @@ -195,7 +194,8 @@ public class MetadataVersion1 extends MetadataGenerator { FileFormatService fileFormatService, HistoryService historyService, GitInfoProperties gitInfoProperties) { - super(version, config, repositoryDescription, messageService, archivePublicMetadataResourceService, archivePrivateMetadataResourceService, + super(version, dlcmProperties, repositoryDescription, messageService, archivePublicMetadataResourceService, + archivePrivateMetadataResourceService, metadataTypeService, orgUnitResourceService, licenseRemoteResourceService, languageResourceService, personRemoteResourceService, preservationPolicyRemoteService, archiveTypeResourceService, fileFormatService, historyService, gitInfoProperties); // JAXB context @@ -1845,7 +1845,7 @@ public class MetadataVersion1 extends MetadataGenerator { case Package -> { switch (df.getDataType()) { case Metadata -> - // DLCM metadata + // DLCM metadata mets.getDmdSec().setMdWrap(this.loadDescriptiveMetadata(df)); case CustomMetadata -> { // Custom Metadata @@ -1858,13 +1858,13 @@ public class MetadataVersion1 extends MetadataGenerator { } } case Primary -> - // Primary data (research data) + // Primary data (research data) this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.RESEARCH_DATA_ROOT, df, outputLocation); case Secondary -> - // Secondary data (documentation) + // Secondary data (documentation) this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.DOC_ROOT, df, outputLocation); case Software -> - // Software + // Software this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.SOFTWARE_ROOT, df, outputLocation); default -> throw new SolidifyProcessingException("Wrong Data Category"); } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion2.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion2.java index f6bfdcee44ee5b3453f813bd32170a4126fa8128..0f5b9f0b30963d2f926bc31e9b20f3cb69ee2f4b 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion2.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion2.java @@ -45,21 +45,20 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; - import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactoryConfigurationError; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; + import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.Marshaller; import jakarta.xml.bind.Unmarshaller; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.StringUtils; - import ch.unige.solidify.OAIConstants; import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyCheckingException; @@ -184,7 +183,7 @@ public class MetadataVersion2 extends MetadataGenerator { public MetadataVersion2( DLCMMetadataVersion version, - DLCMProperties config, + DLCMProperties dlcmProperties, DLCMRepositoryDescription repositoryDescription, MessageService messageService, FallbackArchivePublicMetadataRemoteResourceService archivePublicMetadataResourceService, @@ -199,7 +198,8 @@ public class MetadataVersion2 extends MetadataGenerator { FileFormatService fileFormatService, HistoryService historyService, GitInfoProperties gitInfoProperties) { - super(version, config, repositoryDescription, messageService, archivePublicMetadataResourceService, archivePrivateMetadataResourceService, + super(version, dlcmProperties, repositoryDescription, messageService, archivePublicMetadataResourceService, + archivePrivateMetadataResourceService, metadataTypeService, orgUnitResourceService, licenseRemoteResourceService, languageResourceService, personRemoteResourceService, preservationPolicyResourceService, archiveTypeResourceService, fileFormatService, historyService, gitInfoProperties); // JAXB context @@ -1183,9 +1183,7 @@ public class MetadataVersion2 extends MetadataGenerator { /* * Set License */ - if (!StringTool.isNullOrEmpty(deposit.getLicenseId())) - - { + if (!StringTool.isNullOrEmpty(deposit.getLicenseId())) { final License license = this.getLicense(deposit.getLicenseId()); @@ -1981,7 +1979,7 @@ public class MetadataVersion2 extends MetadataGenerator { case Package -> { switch (df.getDataType()) { case Metadata -> - // DLCM metadata + // DLCM metadata mets.getDmdSec().setMdWrap(this.loadDescriptiveMetadata(df)); case CustomMetadata -> { // Custom Metadata @@ -1994,16 +1992,16 @@ public class MetadataVersion2 extends MetadataGenerator { } } case Primary -> - // Primary data (research data) + // Primary data (research data) this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.RESEARCH_DATA_ROOT, df, outputLocation); case Secondary -> - // Secondary data (documentation) + // Secondary data (documentation) this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.DOC_ROOT, df, outputLocation); case Software -> - // Software + // Software this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.SOFTWARE_ROOT, df, outputLocation); case Internal -> - // Internal (preview files) + // Internal (preview files) this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.INTERNAL_ROOT, df, outputLocation); default -> throw new SolidifyProcessingException("Wrong Data Category"); } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion3.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion3.java index d1f1174da76ded0f20bb5d2e322ba8efdcaa5c80..ab5b2d1ddb2192d84816aee9644118964f4758bf 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion3.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion3.java @@ -44,21 +44,20 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; - import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactoryConfigurationError; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; + import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.Marshaller; import jakarta.xml.bind.Unmarshaller; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.StringUtils; - import ch.unige.solidify.OAIConstants; import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyCheckingException; @@ -198,7 +197,7 @@ public class MetadataVersion3 extends MetadataGenerator { public MetadataVersion3( DLCMMetadataVersion version, - DLCMProperties config, + DLCMProperties dlcmProperties, DLCMRepositoryDescription repositoryDescription, MessageService messageService, FallbackArchivePublicMetadataRemoteResourceService archivePublicMetadataResourceService, @@ -213,7 +212,8 @@ public class MetadataVersion3 extends MetadataGenerator { FileFormatService fileFormatService, HistoryService historyService, GitInfoProperties gitInfoProperties) { - super(version, config, repositoryDescription, messageService, archivePublicMetadataResourceService, archivePrivateMetadataResourceService, + super(version, dlcmProperties, repositoryDescription, messageService, archivePublicMetadataResourceService, + archivePrivateMetadataResourceService, metadataTypeService, orgUnitResourceService, licenseRemoteResourceService, languageResourceService, personRemoteResourceService, preservationPolicyRemoteService, archiveTypeResourceService, fileFormatService, historyService, gitInfoProperties); // JAXB context @@ -2281,7 +2281,7 @@ public class MetadataVersion3 extends MetadataGenerator { case Package -> { switch (df.getDataType()) { case Metadata -> - // DLCM metadata + // DLCM metadata mets.getDmdSec().setMdWrap(this.loadDescriptiveMetadata(df)); case CustomMetadata -> { // Custom Metadata @@ -2294,19 +2294,19 @@ public class MetadataVersion3 extends MetadataGenerator { } } case Primary -> - // Primary data (research data) + // Primary data (research data) this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.RESEARCH_DATA_ROOT, df, outputLocation); case Secondary -> - // Secondary data (documentation) + // Secondary data (documentation) this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.DOC_ROOT, df, outputLocation); case Software -> - // Software + // Software this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.SOFTWARE_ROOT, df, outputLocation); case Administrative -> - // Administrative data + // Administrative data this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.ADMIN_DATA_ROOT, df, outputLocation); case Internal -> - // Internal (preview files) + // Internal (preview files) this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.INTERNAL_ROOT, df, outputLocation); default -> throw new SolidifyProcessingException("Wrong Data Category"); } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion4.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion4.java index 4e1e8a165c630140c2b546b999a86ecf37a1bb24..025528af9df59062e2c15015e8dcd13310d206bd 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion4.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/metadata/MetadataVersion4.java @@ -50,21 +50,20 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; - import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactoryConfigurationError; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; + import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.Marshaller; import jakarta.xml.bind.Unmarshaller; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.StringUtils; - import ch.unige.solidify.OAIConstants; import ch.unige.solidify.SolidifyConstants; import ch.unige.solidify.exception.SolidifyCheckingException; @@ -198,7 +197,7 @@ public class MetadataVersion4 extends MetadataGenerator { public MetadataVersion4( DLCMMetadataVersion version, - DLCMProperties config, + DLCMProperties dlcmProperties, DLCMRepositoryDescription repositoryDescription, MessageService messageService, FallbackArchivePublicMetadataRemoteResourceService archivePublicMetadataResourceService, @@ -214,7 +213,8 @@ public class MetadataVersion4 extends MetadataGenerator { HistoryService historyService, GitInfoProperties gitInfoProperties, TrustedDepositRemoteResourceService depositRemoteService) { - super(version, config, repositoryDescription, messageService, archivePublicMetadataResourceService, archivePrivateMetadataResourceService, + super(version, dlcmProperties, repositoryDescription, messageService, archivePublicMetadataResourceService, + archivePrivateMetadataResourceService, metadataTypeService, orgUnitResourceService, licenseRemoteResourceService, languageResourceService, personRemoteResourceService, preservationPolicyRemoteService, archiveTypeResourceService, fileFormatService, historyService, gitInfoProperties); this.depositRemoteService = depositRemoteService; @@ -2586,7 +2586,7 @@ public class MetadataVersion4 extends MetadataGenerator { case Package -> { switch (df.getDataType()) { case Metadata -> - // DLCM metadata + // DLCM metadata mets.getDmdSec().setMdWrap(this.loadDescriptiveMetadata(df)); case CustomMetadata -> { // Custom Metadata @@ -2599,19 +2599,19 @@ public class MetadataVersion4 extends MetadataGenerator { } } case Primary -> - // Primary data (research data) + // Primary data (research data) this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.RESEARCH_DATA_ROOT, df, outputLocation); case Secondary -> - // Secondary data (documentation) + // Secondary data (documentation) this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.DOC_ROOT, df, outputLocation); case Software -> - // Software + // Software this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.SOFTWARE_ROOT, df, outputLocation); case Administrative -> - // Administrative data + // Administrative data this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.ADMIN_DATA_ROOT, df, outputLocation); case Internal -> - // Internal (preview files) + // Internal (preview files) this.loadFile(root, structMap.getDiv(), premis, DLCMConstants.INTERNAL_ROOT, df, outputLocation); default -> throw new SolidifyProcessingException("Wrong Data Category"); } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/AIPDownloadRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/AIPDownloadRemoteResourceService.java index f529ffb6ad5b12ac13a17c407d5c140f502dbf19..1c458946fff60a7272d8502408482fbf9662b16a 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/AIPDownloadRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/AIPDownloadRemoteResourceService.java @@ -37,9 +37,9 @@ public abstract class AIPDownloadRemoteResourceService extends RemoteResourceSer private final String accessUrl; - protected AIPDownloadRemoteResourceService(DLCMProperties config, SolidifyRestClientService restClientService) { + protected AIPDownloadRemoteResourceService(DLCMProperties dlcmProperties, SolidifyRestClientService restClientService) { super(restClientService); - this.accessUrl = config.getModule().getAccess().getUrl(); + this.accessUrl = dlcmProperties.getModule().getAccess().getUrl(); } public RestCollection<ArchivalInfoPackage> getAipsByOrder(String orderId, Pageable pageable) { @@ -55,7 +55,7 @@ public abstract class AIPDownloadRemoteResourceService extends RemoteResourceSer public void deleteAIPDownload(String aipId) { String url = this.accessUrl + "/" + ResourceName.AIP + "/" + aipId; - restClientService.deleteResource(url); + this.restClientService.deleteResource(url); } public int getCountAIPDownloadOfCompletedOrders() { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveAllMetadataRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveAllMetadataRemoteResourceService.java index b4b2ff3ef69c63fbf32c99968391041a66bd23d4..a94f9a9d66fd06c86d9a2529e59ea4e28e3c0598 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveAllMetadataRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveAllMetadataRemoteResourceService.java @@ -30,7 +30,7 @@ import ch.dlcm.model.MetadataVisibility; public abstract class ArchiveAllMetadataRemoteResourceService extends ArchiveMetadataRemoteResourceService { - protected ArchiveAllMetadataRemoteResourceService(DLCMProperties config, SolidifyRestClientService dlcmRestClientService) { - super(config, dlcmRestClientService, MetadataVisibility.ALL); + protected ArchiveAllMetadataRemoteResourceService(DLCMProperties dlcmProperties, SolidifyRestClientService dlcmRestClientService) { + super(dlcmProperties, dlcmRestClientService, MetadataVisibility.ALL); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveDownloadRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveDownloadRemoteResourceService.java index 9b4218f8adbd0ae34974d0fcc61bc47c799d53ea..1bf700db7e5cd13a10e89cb451aa7a0cf860fee4 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveDownloadRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveDownloadRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -31,25 +31,24 @@ import ch.dlcm.rest.ResourceName; public abstract class ArchiveDownloadRemoteResourceService { - protected final DLCMProperties config; protected final SolidifyRestClientService restClientService; - protected ArchiveDownloadRemoteResourceService(DLCMProperties config, SolidifyRestClientService restClientService) { - this.config = config; + private final String accessModuleUrl; + + protected ArchiveDownloadRemoteResourceService(DLCMProperties dlcmProperties, SolidifyRestClientService restClientService) { + this.accessModuleUrl = dlcmProperties.getModule().getAccess().getUrl(); this.restClientService = restClientService; } public String getArchiveDownloadStatus(String resId) { this.restClientService.checkResId(resId); - String url = this.config.getModule().getAccess().getUrl() + "/" + ResourceName.PUBLIC_METADATA + "/" + resId + "/" + - DLCMActionName.DOWNLOAD_STATUS; + String url = this.accessModuleUrl + "/" + ResourceName.PUBLIC_METADATA + "/" + resId + "/" + DLCMActionName.DOWNLOAD_STATUS; return this.restClientService.getResource(url, String.class); } public String prepareArchiveDownload(String resId) { this.restClientService.checkResId(resId); - String url = this.config.getModule().getAccess().getUrl() + "/" + ResourceName.PUBLIC_METADATA + "/" + resId + "/" + - DLCMActionName.PREPARE_DOWNLOAD; + String url = this.accessModuleUrl + "/" + ResourceName.PUBLIC_METADATA + "/" + resId + "/" + DLCMActionName.PREPARE_DOWNLOAD; return this.restClientService.postResource(url, String.class); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveMetadataRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveMetadataRemoteResourceService.java index a109e8c1433d9f6b6f9a4099cdc0cd4867de9d0d..2d17ce6a88decc7af9ac20465c2e54d393ec25f2 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveMetadataRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveMetadataRemoteResourceService.java @@ -47,14 +47,14 @@ public abstract class ArchiveMetadataRemoteResourceService extends IndexMetadata private final String dataMgmtIndexUrl; protected ArchiveMetadataRemoteResourceService( - DLCMProperties config, + DLCMProperties dlcmProperties, SolidifyRestClientService dlcmRestClientService, MetadataVisibility metadataVisibility) { - super(ArchiveMetadata.class, dlcmRestClientService, config.getIndexing().getIndexName(metadataVisibility)); + super(ArchiveMetadata.class, dlcmRestClientService, dlcmProperties.getIndexing().getIndexName(metadataVisibility)); switch (metadataVisibility) { - case ALL -> this.dataMgmtIndexUrl = config.getModule().getDataMgmt().getUrl() + "/" + ResourceName.DI; - case RESTRICTED -> this.dataMgmtIndexUrl = config.getModule().getDataMgmt().getUrl() + "/" + ResourceName.DI_PRIVATE; - default -> this.dataMgmtIndexUrl = config.getModule().getDataMgmt().getUrl() + "/" + ResourceName.DI_PUBLIC; + case ALL -> this.dataMgmtIndexUrl = dlcmProperties.getModule().getDataMgmt().getUrl() + "/" + ResourceName.DI; + case RESTRICTED -> this.dataMgmtIndexUrl = dlcmProperties.getModule().getDataMgmt().getUrl() + "/" + ResourceName.DI_PRIVATE; + default -> this.dataMgmtIndexUrl = dlcmProperties.getModule().getDataMgmt().getUrl() + "/" + ResourceName.DI_PUBLIC; } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivePrivateMetadataRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivePrivateMetadataRemoteResourceService.java index d11dd448bdab8e747111d7a3256afcf1d04bbb01..6e41f073a899c9fe5cdbdb41fd4b55bd3bda6459 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivePrivateMetadataRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivePrivateMetadataRemoteResourceService.java @@ -52,8 +52,8 @@ public abstract class ArchivePrivateMetadataRemoteResourceService extends Archiv private static final String DEPOSIT_ID = "packages.deposits.id"; private static final String SIP_ID = "packages.sip.id"; - protected ArchivePrivateMetadataRemoteResourceService(DLCMProperties config, SolidifyRestClientService dlcmRestClientService) { - super(config, dlcmRestClientService, MetadataVisibility.RESTRICTED); + protected ArchivePrivateMetadataRemoteResourceService(DLCMProperties dlcmProperties, SolidifyRestClientService dlcmRestClientService) { + super(dlcmProperties, dlcmRestClientService, MetadataVisibility.RESTRICTED); } public String getDepositId(String aipId) { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivePublicMetadataRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivePublicMetadataRemoteResourceService.java index f62d257d496a22e475a5aa538dfab273818385a3..08e8a41a7f67ca2c6f98f1f6ba2c48825d8ad28a 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivePublicMetadataRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivePublicMetadataRemoteResourceService.java @@ -46,8 +46,8 @@ import ch.dlcm.model.index.ArchiveMetadata; public abstract class ArchivePublicMetadataRemoteResourceService extends ArchiveMetadataRemoteResourceService { private static final Logger log = LoggerFactory.getLogger(ArchivePublicMetadataRemoteResourceService.class); - protected ArchivePublicMetadataRemoteResourceService(DLCMProperties config, SolidifyRestClientService dlcmRestClientService) { - super(config, dlcmRestClientService, MetadataVisibility.PUBLIC); + protected ArchivePublicMetadataRemoteResourceService(DLCMProperties dlcmProperties, SolidifyRestClientService dlcmRestClientService) { + super(dlcmProperties, dlcmRestClientService, MetadataVisibility.PUBLIC); } public ArchiveMetadata getMetadataByDoi(String aipDoi) { diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveRatingRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveRatingRemoteResourceService.java index 53138bba51fb61732a470f91b1c325221f49e977..d238d5dd07f168fca764a8f59e54f21a2f2b6401 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveRatingRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchiveRatingRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -36,59 +36,57 @@ import ch.dlcm.rest.ResourceName; public abstract class ArchiveRatingRemoteResourceService { - protected final DLCMProperties config; protected final SolidifyRestClientService restClientService; + private final String adminModuleUrl; - protected ArchiveRatingRemoteResourceService(DLCMProperties config, SolidifyRestClientService restClientService) { - this.config = config; + protected ArchiveRatingRemoteResourceService(DLCMProperties dlcmProperties, SolidifyRestClientService restClientService) { + this.adminModuleUrl = dlcmProperties.getModule().getAdmin().getUrl(); this.restClientService = restClientService; } public ArchiveUserRating createArchiveUserRating(ArchiveUserRating archiveUserRating) { - String url = this.config.getModule().getAdmin().getUrl() + "/" + ResourceName.ARCHIVE_RATING; + String url = this.adminModuleUrl + "/" + ResourceName.ARCHIVE_RATING; return this.restClientService.postResource(url, archiveUserRating, ArchiveUserRating.class); } public ArchiveUserRating updateArchiveUserRating(String archiveId, ArchiveUserRating archiveUserRating) { - String url = this.config.getModule().getAdmin().getUrl() + "/" + ResourceName.ARCHIVE_RATING + "/" + archiveId; + String url = this.adminModuleUrl + "/" + ResourceName.ARCHIVE_RATING + "/" + archiveId; return this.restClientService.patchResource(url, archiveUserRating, ArchiveUserRating.class); } public RestCollection<ArchiveUserRating> getArchiveUserRating(String archiveId, Pageable pageable) { - String url = this.config.getModule().getAdmin().getUrl() + "/" + ResourceName.ARCHIVE_RATING + "?" + DLCMConstants.DB_ARCHIVE_ID + - "=" + archiveId; + String url = this.adminModuleUrl + "/" + ResourceName.ARCHIVE_RATING + "?" + DLCMConstants.DB_ARCHIVE_ID + "=" + archiveId; String jsonString = this.restClientService.getResource(url, pageable); return new RestCollection<>(jsonString, ArchiveUserRating.class); } public RestCollection<ArchiveUserRating> getArchiveByUserAndRating(String archiveId, String userId, String ratingId) { - String url = this.config.getModule().getAdmin().getUrl() + "/" + ResourceName.ARCHIVE_RATING + "?" + DLCMConstants.DB_ARCHIVE_ID + "=" + - archiveId + "&user.resId=" + userId + "&ratingType.resId=" + ratingId; + String url = this.adminModuleUrl + "/" + ResourceName.ARCHIVE_RATING + "?" + DLCMConstants.DB_ARCHIVE_ID + "=" + archiveId + + "&user.resId=" + userId + "&ratingType.resId=" + ratingId; String jsonString = this.restClientService.getResource(url); return new RestCollection<>(jsonString, ArchiveUserRating.class); } public RestCollection<ArchiveUserRating> getAllRatingByUser(String resId, String userId) { - String url = this.config.getModule().getAdmin().getUrl() + "/" + ResourceName.ARCHIVE_RATING + "?" - + DLCMConstants.DB_ARCHIVE_ID - + "=" + resId + "&user.resId=" + userId; + String url = + this.adminModuleUrl + "/" + ResourceName.ARCHIVE_RATING + "?" + DLCMConstants.DB_ARCHIVE_ID + "=" + resId + "&user.resId=" + userId; String jsonString = this.restClientService.getResource(url); return new RestCollection<>(jsonString, ArchiveUserRating.class); } public void deleteArchiveUserRating(String resId) { - String url = this.config.getModule().getAdmin().getUrl() + "/" + ResourceName.ARCHIVE_RATING + "/" + resId; + String url = this.adminModuleUrl + "/" + ResourceName.ARCHIVE_RATING + "/" + resId; this.restClientService.deleteResource(url); } public RatingType getRatingType(String ratingTypeId) { - String url = this.config.getModule().getAdmin().getUrl() + "/" + ResourceName.RATING_TYPE + "/" + ratingTypeId; + String url = this.adminModuleUrl + "/" + ResourceName.RATING_TYPE + "/" + ratingTypeId; return this.restClientService.getResource(url, RatingType.class); } public RestCollection<RatingType> getAllRatingType() { - String url = this.config.getModule().getAdmin().getUrl() + "/" + ResourceName.RATING_TYPE; + String url = this.adminModuleUrl + "/" + ResourceName.RATING_TYPE; String jsonString = this.restClientService.getResource(url); return new RestCollection<>(jsonString, RatingType.class); } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/SubmissionAgreementUserRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/SubmissionAgreementUserRemoteResourceService.java index 940834d0f7d78f655725b730230ef1ec99a4fcec..746a4618d63fc2317082da7e732afe9d5875ea5f 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/SubmissionAgreementUserRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/SubmissionAgreementUserRemoteResourceService.java @@ -31,29 +31,28 @@ import ch.dlcm.rest.ResourceName; public abstract class SubmissionAgreementUserRemoteResourceService { - protected final DLCMProperties config; protected final SolidifyRestClientService restClientService; + private final String adminModuleUrl; - protected SubmissionAgreementUserRemoteResourceService(DLCMProperties config, SolidifyRestClientService restClientService) { - this.config = config; + protected SubmissionAgreementUserRemoteResourceService(DLCMProperties dlcmProperties, SolidifyRestClientService restClientService) { + this.adminModuleUrl = dlcmProperties.getModule().getAdmin().getUrl(); this.restClientService = restClientService; } public void approveSubmissionAgreement(String submissionAgreementId, String userId) { this.restClientService.checkResId(submissionAgreementId); this.restClientService.checkResId(userId); - final String url = this.config.getModule().getAdmin().getUrl() + "/" + ResourceName.SUBMISSION_AGREEMENT + "/" + submissionAgreementId + "/" + - ResourceName.USER; + final String url = this.adminModuleUrl + "/" + ResourceName.SUBMISSION_AGREEMENT + "/" + submissionAgreementId + "/" + ResourceName.USER; this.restClientService.postObject(url, new String[] { userId }, String.class); } public boolean checkSubmissionAgreement(String submissionAgreementId, String userId) { this.restClientService.checkResId(submissionAgreementId); this.restClientService.checkResId(userId); - final String url = this.config.getModule().getAdmin().getUrl() + "/" + ResourceName.SUBMISSION_AGREEMENT + "/" + submissionAgreementId + "/" + - ResourceName.USER + "/" + userId; + final String url = + this.adminModuleUrl + "/" + ResourceName.SUBMISSION_AGREEMENT + "/" + submissionAgreementId + "/" + ResourceName.USER + "/" + userId; try { - final String result = this.restClientService.getResource(url); + this.restClientService.getResource(url); return true; } catch (SolidifyResourceNotFoundException e) { return false; diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackAdditionalFieldsFormRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackAdditionalFieldsFormRemoteResourceService.java index 55875826891e9b17a25adf89535be7818f18bfd0..9ab06aaad013614945c304066fb5edbf9cb9dbd8 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackAdditionalFieldsFormRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackAdditionalFieldsFormRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,16 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.AdditionalFieldsFormRemoteResourceService; @Service public class FallbackAdditionalFieldsFormRemoteResourceService extends AdditionalFieldsFormRemoteResourceService { - public FallbackAdditionalFieldsFormRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackAdditionalFieldsFormRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivalInfoPackageRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivalInfoPackageRemoteResourceService.java index 01d3b38c8301083cc921ebb192e10d434fcde97d..9e02bdcadc21a287022474861f32c01705d29d8e 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivalInfoPackageRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivalInfoPackageRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,18 +25,18 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; +import ch.unige.solidify.service.FallbackRestClientService; import ch.unige.solidify.service.MessageService; import ch.dlcm.config.DLCMProperties; -import ch.unige.solidify.service.FallbackRestClientService; import ch.dlcm.service.rest.abstractservice.ArchivalInfoPackageRemoteResourceService; @Service public class FallbackArchivalInfoPackageRemoteResourceService extends ArchivalInfoPackageRemoteResourceService { public FallbackArchivalInfoPackageRemoteResourceService( - DLCMProperties config, FallbackRestClientService restClientService, MessageService messageService) { - super(config, restClientService, messageService); + DLCMProperties dlcmProperties, FallbackRestClientService restClientService, MessageService messageService) { + super(dlcmProperties, restClientService, messageService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveACLRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveACLRemoteResourceService.java index b23eca8ae4220d3449ec11ad8be71184f3820f41..ee20d40828570f5df25c7d5682608918e165c820 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveACLRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveACLRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,16 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.ArchiveACLRemoteResourceService; @Service public class FallbackArchiveACLRemoteResourceService extends ArchiveACLRemoteResourceService { - public FallbackArchiveACLRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackArchiveACLRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePrivateMetadataRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePrivateMetadataRemoteResourceService.java index 7b5c36d2d113900e5106a05fdf706310b6ffb7a8..3c3f501d4e1c76043724c17c8cae816cb4d70d76 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePrivateMetadataRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePrivateMetadataRemoteResourceService.java @@ -32,7 +32,7 @@ import ch.dlcm.service.rest.abstractservice.ArchivePrivateMetadataRemoteResource @Service public class FallbackArchivePrivateMetadataRemoteResourceService extends ArchivePrivateMetadataRemoteResourceService { - public FallbackArchivePrivateMetadataRemoteResourceService(DLCMProperties config, FallbackRestClientService dlcmRestClientService) { - super(config, dlcmRestClientService); + public FallbackArchivePrivateMetadataRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService dlcmRestClientService) { + super(dlcmProperties, dlcmRestClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePublicDataRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePublicDataRemoteResourceService.java index ec1c1bd9cf14970c1e52e81bd7f3790fd31d6c0f..b92cdca9aa5a1c87f86e3cc9628e65954eb750be 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePublicDataRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePublicDataRemoteResourceService.java @@ -32,7 +32,7 @@ import ch.dlcm.service.rest.abstractservice.ArchivePublicDataRemoteResourceServi @Service public class FallbackArchivePublicDataRemoteResourceService extends ArchivePublicDataRemoteResourceService { - public FallbackArchivePublicDataRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackArchivePublicDataRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePublicMetadataRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePublicMetadataRemoteResourceService.java index 343cf107781b036c380cdfac5aab3134c52ee358..c6ef920f21b2d5db0caa99ef0f99a4af1c09530c 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePublicMetadataRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchivePublicMetadataRemoteResourceService.java @@ -34,8 +34,8 @@ import ch.dlcm.service.rest.abstractservice.ArchivePublicMetadataRemoteResourceS @Service public class FallbackArchivePublicMetadataRemoteResourceService extends ArchivePublicMetadataRemoteResourceService implements OAIRecordService { - public FallbackArchivePublicMetadataRemoteResourceService(DLCMProperties config, FallbackRestClientService dlcmRestClientService) { - super(config, dlcmRestClientService); + public FallbackArchivePublicMetadataRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService dlcmRestClientService) { + super(dlcmProperties, dlcmRestClientService); } @Override diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveStatisticsRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveStatisticsRemoteResourceService.java index 349bfa106ea151d246bbbce5e29c46c6edd202db..724eab2b2aa379175eb62e79125715c0ca612f23 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveStatisticsRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveStatisticsRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,13 +25,14 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.ArchiveStatisticsRemoteResourceService; @Service public class FallbackArchiveStatisticsRemoteResourceService extends ArchiveStatisticsRemoteResourceService { - public FallbackArchiveStatisticsRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackArchiveStatisticsRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveTypeRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveTypeRemoteResourceService.java index 2fdfb2a4c1017bc777543feb83eda3b8597c3c0b..fc8159b701c48e9ce72feb6e0746f49e3f197e6b 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveTypeRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackArchiveTypeRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,13 +25,14 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.ArchiveTypeRemoteResourceService; @Service public class FallbackArchiveTypeRemoteResourceService extends ArchiveTypeRemoteResourceService { - public FallbackArchiveTypeRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackArchiveTypeRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackLanguageRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackLanguageRemoteResourceService.java index a30982d78897b80ae1da58cd538cb63e37874b84..c88f429f8901a393c5ba4c5252765cebc2fe062e 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackLanguageRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackLanguageRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,13 +25,14 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.LanguageRemoteResourceService; @Service public class FallbackLanguageRemoteResourceService extends LanguageRemoteResourceService { - public FallbackLanguageRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackLanguageRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackLicenseRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackLicenseRemoteResourceService.java index 641d2ce32eea641fa6081cdba112dee61bbb978b..4692f72adf9ae6c8472083b4b9ba3b78e4d8b79c 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackLicenseRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackLicenseRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,13 +25,14 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.LicenseRemoteResourceService; @Service public class FallbackLicenseRemoteResourceService extends LicenseRemoteResourceService { - public FallbackLicenseRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackLicenseRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackMetadataTypeRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackMetadataTypeRemoteResourceService.java index 75f598f2a9bbff3dccfa0b8b87c2128e7567e2f8..3f56ee6ee4340612e6806eaded8d8c561daf4f7d 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackMetadataTypeRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackMetadataTypeRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,16 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.MetadataTypeRemoteResourceService; @Service public class FallbackMetadataTypeRemoteResourceService extends MetadataTypeRemoteResourceService { - public FallbackMetadataTypeRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackMetadataTypeRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackNotificationRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackNotificationRemoteResourceService.java index 19a7f28e22b4806585f934f8c59ff944cbb6bc1b..c8f5b84aeab5a83ed2f0f0116344807f471c6715 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackNotificationRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackNotificationRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,17 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.NotificationRemoteResourceService; @Service public class FallbackNotificationRemoteResourceService extends NotificationRemoteResourceService { - public FallbackNotificationRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService, FallbackUserRemoteResourceService fallbackUserRemoteResourceService) { - super(config, restClientService, fallbackUserRemoteResourceService); + public FallbackNotificationRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService, + FallbackUserRemoteResourceService fallbackUserRemoteResourceService) { + super(dlcmProperties, restClientService, fallbackUserRemoteResourceService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackOrganizationalUnitRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackOrganizationalUnitRemoteResourceService.java index 173a60c45341167303ea30edba5246a211f19588..71c95ea31b9d6804ab4344013e538418ae8acf7b 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackOrganizationalUnitRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackOrganizationalUnitRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,17 +25,18 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; +import ch.unige.solidify.service.FallbackRestClientService; + import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.CacheService; -import ch.unige.solidify.service.FallbackRestClientService; import ch.dlcm.service.rest.abstractservice.OrganizationalUnitRemoteResourceService; @Service public class FallbackOrganizationalUnitRemoteResourceService extends OrganizationalUnitRemoteResourceService { public FallbackOrganizationalUnitRemoteResourceService( - DLCMProperties config, + DLCMProperties dlcmProperties, FallbackRestClientService restClientService, CacheService cacheService) { - super(config, restClientService, cacheService); + super(dlcmProperties, restClientService, cacheService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPersonRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPersonRemoteResourceService.java index 0994531a40f7ed6b624f99669791c9d24846980b..026296deb99cbb07f56f828531a8cd9183369dd1 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPersonRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPersonRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,14 +25,16 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.PersonRemoteResourceService; @Service public class FallbackPersonRemoteResourceService extends PersonRemoteResourceService { - public FallbackPersonRemoteResourceService(FallbackUserRemoteResourceService userRemoteResourceService, DLCMProperties config, FallbackRestClientService restClientService) { - super(userRemoteResourceService, config, restClientService); + public FallbackPersonRemoteResourceService(FallbackUserRemoteResourceService userRemoteResourceService, DLCMProperties dlcmProperties, + FallbackRestClientService restClientService) { + super(userRemoteResourceService, dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPreservationJobRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPreservationJobRemoteResourceService.java index 823a6c6ad5baf07cf39185cbdb5c0ae27dbeff08..680a1d67d2f9f8ccc6f88762b0c1df24169ddaa4 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPreservationJobRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPreservationJobRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,13 +25,14 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.PreservationJobRemoteResourceService; @Service public class FallbackPreservationJobRemoteResourceService extends PreservationJobRemoteResourceService { - public FallbackPreservationJobRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackPreservationJobRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPreservationPolicyRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPreservationPolicyRemoteResourceService.java index 99e87e54dfa36f626d60867001b80a4fa47a3747..fa2a7b382dbfc2d69d9577fc3ec4cf5a7e755e2b 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPreservationPolicyRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackPreservationPolicyRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,13 +25,14 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.PreservationPolicyRemoteResourceService; @Service public class FallbackPreservationPolicyRemoteResourceService extends PreservationPolicyRemoteResourceService { - public FallbackPreservationPolicyRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackPreservationPolicyRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionAgreementRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionAgreementRemoteResourceService.java index 5b18a355f9509874aa5f806777a41a24d7b9216f..8ceaa9327b6cc785477b506cf3c4e87f55b18ce0 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionAgreementRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionAgreementRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,14 +25,15 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.SubmissionAgreementRemoteResourceService; @Service public class FallbackSubmissionAgreementRemoteResourceService extends SubmissionAgreementRemoteResourceService { - public FallbackSubmissionAgreementRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackSubmissionAgreementRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionInfoPackageRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionInfoPackageRemoteResourceService.java index c225360427ad62fb876f87e0be7f23265faa6881..9d1ba847d9f4be6eb06ac94c755d659c4aa2acf7 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionInfoPackageRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionInfoPackageRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,16 +25,16 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; +import ch.unige.solidify.service.FallbackRestClientService; import ch.unige.solidify.service.MessageService; import ch.dlcm.config.DLCMProperties; -import ch.unige.solidify.service.FallbackRestClientService; import ch.dlcm.service.rest.abstractservice.SubmissionInfoPackageRemoteResourceService; @Service public class FallbackSubmissionInfoPackageRemoteResourceService extends SubmissionInfoPackageRemoteResourceService { public FallbackSubmissionInfoPackageRemoteResourceService( - DLCMProperties config, FallbackRestClientService restClientService, MessageService messageService) { - super(config, restClientService, messageService); + DLCMProperties dlcmProperties, FallbackRestClientService restClientService, MessageService messageService) { + super(dlcmProperties, restClientService, messageService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionPolicyRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionPolicyRemoteResourceService.java index 83ae62ea4ccd4cad589335c6ff4acf5c4ca51680..fa8b707204812de5fc05ee62d69fc31a5f65b5be 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionPolicyRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackSubmissionPolicyRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,13 +25,14 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.SubmissionPolicyRemoteResourceService; @Service public class FallbackSubmissionPolicyRemoteResourceService extends SubmissionPolicyRemoteResourceService { - public FallbackSubmissionPolicyRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackSubmissionPolicyRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackUserRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackUserRemoteResourceService.java index 990f31b9805eab3bb1a07988507277797180352d..2ea0c10ac46656345f4bab50519a8756897a7879 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackUserRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/fallback/FallbackUserRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,14 +25,15 @@ package ch.dlcm.service.rest.fallback; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.FallbackRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.UserRemoteResourceService; @Service public class FallbackUserRemoteResourceService extends UserRemoteResourceService { - public FallbackUserRemoteResourceService(DLCMProperties config, FallbackRestClientService restClientService) { - super(config, restClientService); + public FallbackUserRemoteResourceService(DLCMProperties dlcmProperties, FallbackRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateArchiveRatingRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateArchiveRatingRemoteResourceService.java index 62a1f9c018e01d636805a979cbd95e29072f4c53..972e9f263aa8c92744aa8bb3982d981fd7eb1b91 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateArchiveRatingRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateArchiveRatingRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,16 @@ package ch.dlcm.service.rest.propagate; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.PropagateRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.ArchiveRatingRemoteResourceService; @Service public class PropagateArchiveRatingRemoteResourceService extends ArchiveRatingRemoteResourceService { - public PropagateArchiveRatingRemoteResourceService(DLCMProperties config, PropagateRestClientService restClientService) { - super(config, restClientService); + public PropagateArchiveRatingRemoteResourceService(DLCMProperties dlcmProperties, PropagateRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateArchiveStatisticsRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateArchiveStatisticsRemoteResourceService.java index 672852e890529db85dc6e9bfab1b4632baa7c90c..00d7084119ce92a8aada3b971fa63502a0a11d62 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateArchiveStatisticsRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateArchiveStatisticsRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,16 @@ package ch.dlcm.service.rest.propagate; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.PropagateRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.ArchiveStatisticsRemoteResourceService; @Service public class PropagateArchiveStatisticsRemoteResourceService extends ArchiveStatisticsRemoteResourceService { - public PropagateArchiveStatisticsRemoteResourceService(DLCMProperties config, PropagateRestClientService restClientService) { - super(config, restClientService); + public PropagateArchiveStatisticsRemoteResourceService(DLCMProperties dlcmProperties, PropagateRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateMetadataTypeRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateMetadataTypeRemoteResourceService.java index 4fcbd6bc0bb2ae943ec983b68169c44a191922c8..749ad7377d9365372975c2aa3773d364d970df75 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateMetadataTypeRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateMetadataTypeRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,16 @@ package ch.dlcm.service.rest.propagate; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.PropagateRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.MetadataTypeRemoteResourceService; @Service public class PropagateMetadataTypeRemoteResourceService extends MetadataTypeRemoteResourceService { - public PropagateMetadataTypeRemoteResourceService(DLCMProperties config, PropagateRestClientService restClientService) { - super(config, restClientService); + public PropagateMetadataTypeRemoteResourceService(DLCMProperties dlcmProperties, PropagateRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateOrderRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateOrderRemoteResourceService.java index 2f11bead4383624084e97a25297f62b2a829a505..f418f570393f64ed0e39e9e014688e49cc0ff174 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateOrderRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateOrderRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,14 +25,15 @@ package ch.dlcm.service.rest.propagate; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.PropagateRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.OrderRemoteResourceService; @Service public class PropagateOrderRemoteResourceService extends OrderRemoteResourceService { - public PropagateOrderRemoteResourceService(DLCMProperties config, PropagateRestClientService restClientService) { - super(config, restClientService); + public PropagateOrderRemoteResourceService(DLCMProperties dlcmProperties, PropagateRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateOrganizationalUnitRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateOrganizationalUnitRemoteResourceService.java index ae9e776c75b4bb48bb624cdbb2023b44ee7081a6..a6691e46c42784d51816be28eef982256ed2d6d0 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateOrganizationalUnitRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateOrganizationalUnitRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,18 +25,19 @@ package ch.dlcm.service.rest.propagate; import org.springframework.stereotype.Service; +import ch.unige.solidify.service.PropagateRestClientService; + import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.CacheService; -import ch.unige.solidify.service.PropagateRestClientService; import ch.dlcm.service.rest.abstractservice.OrganizationalUnitRemoteResourceService; @Service public class PropagateOrganizationalUnitRemoteResourceService extends OrganizationalUnitRemoteResourceService { public PropagateOrganizationalUnitRemoteResourceService( - DLCMProperties config, + DLCMProperties dlcmProperties, PropagateRestClientService restClientService, CacheService cacheService) { - super(config, restClientService, cacheService); + super(dlcmProperties, restClientService, cacheService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagatePersonRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagatePersonRemoteResourceService.java index 48b9b64c7906277ee04be8efde271c1633dca111..10a62cdec97d34e0a8e44a1f857618d6312b7e49 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagatePersonRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagatePersonRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,17 @@ package ch.dlcm.service.rest.propagate; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.PropagateRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.PersonRemoteResourceService; @Service public class PropagatePersonRemoteResourceService extends PersonRemoteResourceService { - public PropagatePersonRemoteResourceService(PropagateUserRemoteResourceService userRemoteResourceService, DLCMProperties config, PropagateRestClientService restClientService) { - super(userRemoteResourceService, config, restClientService); + public PropagatePersonRemoteResourceService(PropagateUserRemoteResourceService userRemoteResourceService, DLCMProperties dlcmProperties, + PropagateRestClientService restClientService) { + super(userRemoteResourceService, dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateUserRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateUserRemoteResourceService.java index 96e986feaedf00bbe4023c90917ee6a98accf727..354e30c0015262a4b571d7292a476df6a6ecf8f6 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateUserRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/propagate/PropagateUserRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,16 @@ package ch.dlcm.service.rest.propagate; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.PropagateRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.UserRemoteResourceService; @Service public class PropagateUserRemoteResourceService extends UserRemoteResourceService { - public PropagateUserRemoteResourceService(DLCMProperties config, PropagateRestClientService restClientService) { - super(config, restClientService); + public PropagateUserRemoteResourceService(DLCMProperties dlcmProperties, PropagateRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedAIPDownloadRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedAIPDownloadRemoteResourceService.java index 97b70806fc296a1d8c347db9c898e2ad557cbf77..3803c04d198a7f6afae12b15ac958fe9be4d685c 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedAIPDownloadRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedAIPDownloadRemoteResourceService.java @@ -25,15 +25,15 @@ package ch.dlcm.service.rest.trusted; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; - import ch.unige.solidify.service.TrustedRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.AIPDownloadRemoteResourceService; @Service public class TrustedAIPDownloadRemoteResourceService extends AIPDownloadRemoteResourceService { - public TrustedAIPDownloadRemoteResourceService(DLCMProperties config, TrustedRestClientService trustedDLCMRestClientService) { - super(config, trustedDLCMRestClientService); + public TrustedAIPDownloadRemoteResourceService(DLCMProperties dlcmProperties, TrustedRestClientService trustedDLCMRestClientService) { + super(dlcmProperties, trustedDLCMRestClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivalInfoPackageRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivalInfoPackageRemoteResourceService.java index ab2bf75953bd25975f74df849b164f99c22cd3da..8dc795b8d241c23c1d721780bdec27c986c4abdb 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivalInfoPackageRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivalInfoPackageRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -26,14 +26,15 @@ package ch.dlcm.service.rest.trusted; import org.springframework.stereotype.Service; import ch.unige.solidify.service.MessageService; +import ch.unige.solidify.service.TrustedRestClientService; import ch.dlcm.config.DLCMProperties; -import ch.unige.solidify.service.TrustedRestClientService; import ch.dlcm.service.rest.abstractservice.ArchivalInfoPackageRemoteResourceService; @Service public class TrustedArchivalInfoPackageRemoteResourceService extends ArchivalInfoPackageRemoteResourceService { - public TrustedArchivalInfoPackageRemoteResourceService(DLCMProperties config, TrustedRestClientService trustedDLCMRestClientService, MessageService messageService) { - super(config, trustedDLCMRestClientService, messageService); + public TrustedArchivalInfoPackageRemoteResourceService(DLCMProperties dlcmProperties, TrustedRestClientService trustedDLCMRestClientService, + MessageService messageService) { + super(dlcmProperties, trustedDLCMRestClientService, messageService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveAllMetadataRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveAllMetadataRemoteResourceService.java index 1c1873475e02e44e3dce399a07a480e4ab5bc09c..94911610ae81a557b42736e8fae6c1612bf57886 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveAllMetadataRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveAllMetadataRemoteResourceService.java @@ -32,7 +32,7 @@ import ch.dlcm.service.rest.abstractservice.ArchiveAllMetadataRemoteResourceServ @Service public class TrustedArchiveAllMetadataRemoteResourceService extends ArchiveAllMetadataRemoteResourceService { - public TrustedArchiveAllMetadataRemoteResourceService(DLCMProperties config, TrustedRestClientService dlcmRestClientService) { - super(config, dlcmRestClientService); + public TrustedArchiveAllMetadataRemoteResourceService(DLCMProperties dlcmProperties, TrustedRestClientService dlcmRestClientService) { + super(dlcmProperties, dlcmRestClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveDownloadRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveDownloadRemoteResourceService.java index fa369a88fade2afded2d1882acd3ae93c14686c1..fc3409d28d40b7e1e5e84cca380b9750e0c98d41 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveDownloadRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveDownloadRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,16 @@ package ch.dlcm.service.rest.trusted; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.TrustedRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.ArchiveDownloadRemoteResourceService; @Service public class TrustedArchiveDownloadRemoteResourceService extends ArchiveDownloadRemoteResourceService { - public TrustedArchiveDownloadRemoteResourceService(DLCMProperties config, TrustedRestClientService trustedDLCMRestClientService) { - super(config, trustedDLCMRestClientService); + public TrustedArchiveDownloadRemoteResourceService(DLCMProperties dlcmProperties, TrustedRestClientService trustedDLCMRestClientService) { + super(dlcmProperties, trustedDLCMRestClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePrivateMetadataRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePrivateMetadataRemoteResourceService.java index 6103e739c8a7c06e5a348af39a846a3d883a69d6..1991007e093f1c26d928962c2ff1b5e038061bb6 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePrivateMetadataRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePrivateMetadataRemoteResourceService.java @@ -32,7 +32,7 @@ import ch.dlcm.service.rest.abstractservice.ArchivePrivateMetadataRemoteResource @Service public class TrustedArchivePrivateMetadataRemoteResourceService extends ArchivePrivateMetadataRemoteResourceService { - public TrustedArchivePrivateMetadataRemoteResourceService(DLCMProperties config, TrustedRestClientService dlcmRestClientService) { - super(config, dlcmRestClientService); + public TrustedArchivePrivateMetadataRemoteResourceService(DLCMProperties dlcmProperties, TrustedRestClientService dlcmRestClientService) { + super(dlcmProperties, dlcmRestClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePublicDataRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePublicDataRemoteResourceService.java index 324c538f4de108aad7e69eba6f3016638d68bc4b..7c6464c16507872724cedbb2b15f0985b5835042 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePublicDataRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePublicDataRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -34,9 +34,9 @@ import ch.dlcm.service.rest.abstractservice.ArchivePublicDataRemoteResourceServi public class TrustedArchivePublicDataRemoteResourceService extends ArchivePublicDataRemoteResourceService { public TrustedArchivePublicDataRemoteResourceService( - DLCMProperties config, + DLCMProperties dlcmProperties, TrustedRestClientService restClientService) { - super(config, restClientService); + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePublicMetadataRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePublicMetadataRemoteResourceService.java index d577de66e44f700551ee6de66cab7155e06a91b9..2868ee80ca4d0c70e0080a37dda8ad9f82ad6867 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePublicMetadataRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchivePublicMetadataRemoteResourceService.java @@ -32,7 +32,7 @@ import ch.dlcm.service.rest.abstractservice.ArchivePublicMetadataRemoteResourceS @Service public class TrustedArchivePublicMetadataRemoteResourceService extends ArchivePublicMetadataRemoteResourceService { - public TrustedArchivePublicMetadataRemoteResourceService(DLCMProperties config, TrustedRestClientService dlcmRestClientService) { - super(config, dlcmRestClientService); + public TrustedArchivePublicMetadataRemoteResourceService(DLCMProperties dlcmProperties, TrustedRestClientService dlcmRestClientService) { + super(dlcmProperties, dlcmRestClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveRatingRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveRatingRemoteResourceService.java index 343a833d0792d5c577f1ffc6405168129676171d..2c35042bb6fb656bef05c20824d4d7a7ad9edbeb 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveRatingRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedArchiveRatingRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,16 @@ package ch.dlcm.service.rest.trusted; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.TrustedRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.ArchiveRatingRemoteResourceService; @Service public class TrustedArchiveRatingRemoteResourceService extends ArchiveRatingRemoteResourceService { - public TrustedArchiveRatingRemoteResourceService(DLCMProperties config, TrustedRestClientService restClientService) { - super(config, restClientService); + public TrustedArchiveRatingRemoteResourceService(DLCMProperties dlcmProperties, TrustedRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedDepositRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedDepositRemoteResourceService.java index 42f829eec0ed7c37e95e8b083705836eaaa4f135..d7e9c350441fb7693cb059756f02e00a1c58e4e8 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedDepositRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedDepositRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,16 @@ package ch.dlcm.service.rest.trusted; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.TrustedRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.DepositRemoteResourceService; @Service public class TrustedDepositRemoteResourceService extends DepositRemoteResourceService { - public TrustedDepositRemoteResourceService(DLCMProperties config, TrustedRestClientService restClientService) { - super(config, restClientService); + public TrustedDepositRemoteResourceService(DLCMProperties dlcmProperties, TrustedRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedNotificationRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedNotificationRemoteResourceService.java index 8f9a17d2917cebb8488ff80d1997e5a59c86f677..c82ebd01e076b9b21b71f54f0efb39119674b648 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedNotificationRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedNotificationRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -23,18 +23,19 @@ package ch.dlcm.service.rest.trusted; -import ch.dlcm.config.DLCMProperties; +import org.springframework.stereotype.Service; + import ch.unige.solidify.service.TrustedRestClientService; -import ch.dlcm.service.rest.abstractservice.NotificationRemoteResourceService; -import org.springframework.stereotype.Service; +import ch.dlcm.config.DLCMProperties; +import ch.dlcm.service.rest.abstractservice.NotificationRemoteResourceService; @Service public class TrustedNotificationRemoteResourceService extends NotificationRemoteResourceService { - public TrustedNotificationRemoteResourceService(DLCMProperties config, TrustedRestClientService trustedDLCMRestClientService, + public TrustedNotificationRemoteResourceService(DLCMProperties dlcmProperties, TrustedRestClientService trustedDLCMRestClientService, TrustedUserRemoteResourceService trustedUserRemoteResourceService) { - super(config, trustedDLCMRestClientService, trustedUserRemoteResourceService); + super(dlcmProperties, trustedDLCMRestClientService, trustedUserRemoteResourceService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedPersonRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedPersonRemoteResourceService.java index af669adac5a5a216f49eea23105b609d59576757..1a6f7d39b74d1a122f64cca8f2eb9e9508c9c562 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedPersonRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedPersonRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,15 +25,16 @@ package ch.dlcm.service.rest.trusted; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.TrustedRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.PersonRemoteResourceService; @Service public class TrustedPersonRemoteResourceService extends PersonRemoteResourceService { public TrustedPersonRemoteResourceService(TrustedUserRemoteResourceService userRemoteResourceService, - DLCMProperties config, TrustedRestClientService restClientService) { - super(userRemoteResourceService, config, restClientService); + DLCMProperties dlcmProperties, TrustedRestClientService restClientService) { + super(userRemoteResourceService, dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionAgreementUserRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionAgreementUserRemoteResourceService.java index 2edbc29bb46c07f188843399e20120a309e1202d..1ca065223f91f8941bb4fb374f0f627e9f0dd2e1 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionAgreementUserRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionAgreementUserRemoteResourceService.java @@ -33,8 +33,9 @@ import ch.dlcm.service.rest.abstractservice.SubmissionAgreementUserRemoteResourc @Service public class TrustedSubmissionAgreementUserRemoteResourceService extends SubmissionAgreementUserRemoteResourceService { - public TrustedSubmissionAgreementUserRemoteResourceService(DLCMProperties config, TrustedRestClientService trustedDLCMRestClientService) { - super(config, trustedDLCMRestClientService); + public TrustedSubmissionAgreementUserRemoteResourceService(DLCMProperties dlcmProperties, + TrustedRestClientService trustedDLCMRestClientService) { + super(dlcmProperties, trustedDLCMRestClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionInfoPackageRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionInfoPackageRemoteResourceService.java index fcdd6cf4cccfa8616d5f47b34af295a82caa6970..666b108bb0838906d4ef082274733ee38b76b068 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionInfoPackageRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionInfoPackageRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -26,17 +26,17 @@ package ch.dlcm.service.rest.trusted; import org.springframework.stereotype.Service; import ch.unige.solidify.service.MessageService; +import ch.unige.solidify.service.TrustedRestClientService; import ch.dlcm.config.DLCMProperties; -import ch.unige.solidify.service.TrustedRestClientService; import ch.dlcm.service.rest.abstractservice.SubmissionInfoPackageRemoteResourceService; @Service public class TrustedSubmissionInfoPackageRemoteResourceService extends SubmissionInfoPackageRemoteResourceService { - public TrustedSubmissionInfoPackageRemoteResourceService ( - DLCMProperties config, TrustedRestClientService restClientService, MessageService messageService) { - super(config, restClientService, messageService); + public TrustedSubmissionInfoPackageRemoteResourceService( + DLCMProperties dlcmProperties, TrustedRestClientService restClientService, MessageService messageService) { + super(dlcmProperties, restClientService, messageService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionPolicyRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionPolicyRemoteResourceService.java index b01045b17d637ad4532fc6e1841ab82410477186..bfbed78ca4a5bc99709f62f39b4f3db7f936abf2 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionPolicyRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/trusted/TrustedSubmissionPolicyRemoteResourceService.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -25,13 +25,14 @@ package ch.dlcm.service.rest.trusted; import org.springframework.stereotype.Service; -import ch.dlcm.config.DLCMProperties; import ch.unige.solidify.service.TrustedRestClientService; + +import ch.dlcm.config.DLCMProperties; import ch.dlcm.service.rest.abstractservice.SubmissionPolicyRemoteResourceService; @Service public class TrustedSubmissionPolicyRemoteResourceService extends SubmissionPolicyRemoteResourceService { - public TrustedSubmissionPolicyRemoteResourceService(DLCMProperties config, TrustedRestClientService restClientService) { - super(config, restClientService); + public TrustedSubmissionPolicyRemoteResourceService(DLCMProperties dlcmProperties, TrustedRestClientService restClientService) { + super(dlcmProperties, restClientService); } } diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/VirusCheckService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/VirusCheckService.java index 052466fae17d2138ea267c53386d20741231d3f1..c3007e33924a15723b33beb26424b5e376fcdab5 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/VirusCheckService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/VirusCheckService.java @@ -39,8 +39,8 @@ import ch.dlcm.service.ToolService; public abstract class VirusCheckService extends ToolService { - protected VirusCheckService(MessageService messageService, DLCMProperties config) { - super(messageService, config); + protected VirusCheckService(MessageService messageService, DLCMProperties dlcmProperties) { + super(messageService, dlcmProperties); } // ************************** diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/clamav/ClamAVTool.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/clamav/ClamAVTool.java index 398d5c0e938cb8980cff94b134b8952d847f8d3f..8e7bc7f626abb3dfb11100c53ffbe1195a40b908 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/clamav/ClamAVTool.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/clamav/ClamAVTool.java @@ -52,11 +52,11 @@ public class ClamAVTool extends VirusCheckService { private final String virusCheckTool; private final ClamAVClient clamClt; - public ClamAVTool(DLCMProperties config, MessageService messageService) { - super(messageService, config); - this.virusCheckTool = config.getVirusCheck().getTool(); - final URI uri = URI.create(config.getVirusCheck().getTool()); - this.clamClt = new ClamAVClient(uri.getHost(), uri.getPort(), config.getVirusCheck().getTimeout()); + public ClamAVTool(DLCMProperties dlcmProperties, MessageService messageService) { + super(messageService, dlcmProperties); + this.virusCheckTool = dlcmProperties.getVirusCheck().getTool(); + final URI uri = URI.create(dlcmProperties.getVirusCheck().getTool()); + this.clamClt = new ClamAVClient(uri.getHost(), uri.getPort(), dlcmProperties.getVirusCheck().getTimeout()); } @Override diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/notool/NoVirusCheckTool.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/notool/NoVirusCheckTool.java index c6be19c212d7667eb15ad2f612e7af2aa342ec95..ebfd0ce7fc145e86e460dae04a604212e3ac7a88 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/notool/NoVirusCheckTool.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/viruscheck/notool/NoVirusCheckTool.java @@ -45,10 +45,10 @@ public class NoVirusCheckTool extends VirusCheckService { private final String applicationName; private final String applicationVersion; - public NoVirusCheckTool(DLCMProperties config, MessageService messageService) { - super(messageService, config); - this.applicationName = config.getAppConfig().getApplicationName(); - this.applicationVersion = config.getAppConfig().getApplicationVersion(); + public NoVirusCheckTool(DLCMProperties dlcmProperties, MessageService messageService) { + super(messageService, dlcmProperties); + this.applicationName = dlcmProperties.getAppConfig().getApplicationName(); + this.applicationVersion = dlcmProperties.getAppConfig().getApplicationVersion(); } @Override diff --git a/DLCM-ResourceServerSecurity/src/main/java/ch/dlcm/controller/ResourceSrvController.java b/DLCM-ResourceServerSecurity/src/main/java/ch/dlcm/controller/ResourceSrvController.java index 1752d2553f3e4c9d36dee24300815a7fa6d4320e..d53b3253599fceb1c61f853c864f323e77c457ce 100644 --- a/DLCM-ResourceServerSecurity/src/main/java/ch/dlcm/controller/ResourceSrvController.java +++ b/DLCM-ResourceServerSecurity/src/main/java/ch/dlcm/controller/ResourceSrvController.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -28,12 +28,13 @@ import org.springframework.web.bind.annotation.RestController; import ch.dlcm.rest.ModuleName; import ch.dlcm.rest.UrlPath; +import ch.dlcm.service.ToolList; @RestController @RequestMapping(UrlPath.RES_SRV) public class ResourceSrvController extends DLCMModuleController { - ResourceSrvController() { - super(ModuleName.RES_SRV); + public ResourceSrvController(ToolList toolList) { + super(ModuleName.RES_SRV, toolList); } } diff --git a/DLCM-ResourceServerSecurity/src/main/java/ch/dlcm/service/TrustedTokenChecker.java b/DLCM-ResourceServerSecurity/src/main/java/ch/dlcm/service/TrustedTokenChecker.java index b31db96985383c1648c7bc4c9a745727119a8559..ef2ee2b3ee4acbac0408331670f271203abaf431 100644 --- a/DLCM-ResourceServerSecurity/src/main/java/ch/dlcm/service/TrustedTokenChecker.java +++ b/DLCM-ResourceServerSecurity/src/main/java/ch/dlcm/service/TrustedTokenChecker.java @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. @@ -45,16 +45,16 @@ public class TrustedTokenChecker { private static final Logger log = LoggerFactory.getLogger(TrustedTokenChecker.class); private final AbstractRestClientTool restClientTool; - private final DLCMProperties config; + private final String adminModuleUrl; - public TrustedTokenChecker(AbstractRestClientTool restClientTool, DLCMProperties config) { + public TrustedTokenChecker(AbstractRestClientTool restClientTool, DLCMProperties dlcmProperties) { this.restClientTool = restClientTool; - this.config = config; + this.adminModuleUrl = dlcmProperties.getModule().getAdmin().getUrl(); } @Scheduled(fixedDelayString = "${dlcm.security.trustedTokenCheckerDelayMilliseconds:1000}") public void testTrustedToken() { - String url = this.config.getModule().getAdmin().getUrl() + "/" + ResourceName.USER; + String url = this.adminModuleUrl + "/" + ResourceName.USER; RestTemplate restTemplate = this.restClientTool.getClient(); try { ResponseEntity<?> responseEntity = restTemplate.exchange(url, HttpMethod.HEAD, HttpEntity.EMPTY, Void.class);