diff --git a/DLCM-Model/src/main/java/ch/dlcm/model/preservation/PreservationJob.java b/DLCM-Model/src/main/java/ch/dlcm/model/preservation/PreservationJob.java index be24ca19352a1aeb805a309361d35e16922ce8c7..178ce45f4231bbe5e5ebd9b97f2223773c7c144a 100644 --- a/DLCM-Model/src/main/java/ch/dlcm/model/preservation/PreservationJob.java +++ b/DLCM-Model/src/main/java/ch/dlcm/model/preservation/PreservationJob.java @@ -107,6 +107,24 @@ public class PreservationJob extends ResourceNormalized private JobScheduling scheduling; + @Schema(description = """ + The maximum items to process of the preservation job. + The 0 value means no limit => all items. + """) + private long maxItems = 0; + + @Schema(description = """ + The parameters of the preservation job. + The format is 'param1=value1¶m2=value2&...¶mN=valueN. + Parameters (not exhaustive list): + - filter on metadata version: info.metadataVersion=<value> + - filter on org. unit: info.organizationalUnitId=<value> + - filter on archive size: archiveSize=<value> + - filter on archive unit: archivalUnit=true + - sort in last modification: sort=lastUpdate.when,asc + """) + private String parameters; + @Override public <T> boolean addItem(T t) { if (t instanceof JobExecution je) { @@ -274,24 +292,43 @@ public class PreservationJob extends ResourceNormalized } @Override - public boolean equals(Object o) { - if (this == o) + public boolean equals(Object obj) { + if (this == obj) return true; - if (!(o instanceof PreservationJob)) + if (!super.equals(obj)) return false; - if (!super.equals(o)) + if (this.getClass() != obj.getClass()) return false; - PreservationJob that = (PreservationJob) o; - return Objects.equals(this.enable, that.enable) && - Objects.equals(this.executions, that.executions) && - this.jobRecurrence == that.jobRecurrence && - this.jobType == that.jobType && - Objects.equals(this.name, that.name) && - Objects.equals(this.scheduling, that.scheduling); + PreservationJob other = (PreservationJob) obj; + return Objects.equals(this.enable, other.enable) && Objects.equals(this.executions, other.executions) + && this.jobRecurrence == other.jobRecurrence + && this.jobType == other.jobType && this.maxItems == other.maxItems && Objects.equals(this.name, other.name) + && Objects.equals(this.parameters, other.parameters) && Objects.equals(this.scheduling, other.scheduling); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), this.enable, this.executions, this.jobRecurrence, this.jobType, this.name, this.scheduling); + final int prime = 31; + int result = super.hashCode(); + result = prime * result + Objects.hash(this.enable, this.executions, this.jobRecurrence, this.jobType, this.maxItems, this.name, + this.parameters, this.scheduling); + return result; + } + + public long getMaxItems() { + return this.maxItems; + } + + public void setMaxItems(long maxItems) { + this.maxItems = maxItems; } + + public String getParameters() { + return this.parameters; + } + + public void setParameters(String parameters) { + this.parameters = parameters; + } + } diff --git a/DLCM-Model/src/main/java/ch/dlcm/model/settings/Institution.java b/DLCM-Model/src/main/java/ch/dlcm/model/settings/Institution.java index 6096738677428e652bace205b6f15f0261436179..eb35f6d999c52fa4156ccf5427bc273f12de5778 100644 --- a/DLCM-Model/src/main/java/ch/dlcm/model/settings/Institution.java +++ b/DLCM-Model/src/main/java/ch/dlcm/model/settings/Institution.java @@ -82,12 +82,12 @@ public class Institution extends ResourceNormalized implements RemoteResourceCon @Size(min = 1) private String name; - @Schema(description = "The description of the institution.") + @Schema(description = "The org. unit list of the institution.") @ManyToMany(mappedBy = "institutions") @JsonIgnore private List<OrganizationalUnit> organizationalUnits; - @Schema(description = "The description of the institution.") + @Schema(description = "The members of the institution.") @JsonIgnore @OneToMany(mappedBy = InstitutionPersonRole.PATH_TO_INSTITUTION, cascade = CascadeType.ALL, orphanRemoval = true) private List<InstitutionPersonRole> personRoles = new ArrayList<>(); diff --git a/DLCM-Model/src/main/java/ch/dlcm/specification/PreservationJobSpecification.java b/DLCM-Model/src/main/java/ch/dlcm/specification/PreservationJobSpecification.java index 487924338974168c608023e0bb884296642bd1cd..e0bfeafa324193cce701a75630f813aa9ffb26ab 100644 --- a/DLCM-Model/src/main/java/ch/dlcm/specification/PreservationJobSpecification.java +++ b/DLCM-Model/src/main/java/ch/dlcm/specification/PreservationJobSpecification.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>. @@ -61,5 +61,14 @@ public class PreservationJobSpecification extends SolidifySpecification<Preserva if (this.criteria.getEnable() != null) { predicatesList.add(builder.equal(root.get("enable"), this.criteria.getEnable())); } + + if (this.criteria.getMaxItems() > 0) { + predicatesList.add(builder.greaterThanOrEqualTo(root.get("maxItems"), this.criteria.getMaxItems())); + } + + if (this.criteria.getParameters() != null) { + predicatesList.add(builder.like(root.get("parameters"), "%" + this.criteria.getParameters() + "%")); + } + } } diff --git a/DLCM-Model/src/main/resources/scripts/upgrade22to30.sql b/DLCM-Model/src/main/resources/scripts/upgrade22to30.sql index f154475129c6d7e7ed64f99c2d58758d07f95233..89dd0091ef89762af5678bb1ae155609aa7d96ce 100755 --- a/DLCM-Model/src/main/resources/scripts/upgrade22to30.sql +++ b/DLCM-Model/src/main/resources/scripts/upgrade22to30.sql @@ -165,6 +165,10 @@ ALTER TABLE `preservation_job` MODIFY COLUMN `job_recurrence` enum('DAILY','MONTHLY','ONCE','WEEKLY','YEARLY') NOT NULL; ALTER TABLE `preservation_job` MODIFY COLUMN `job_type` enum('ARCHIVE_CHECK','CLEAN_SUBMISSION','SIMPLE_CLEAN_SUBMISSION','DISPOSAL','FIXITY','MIGRATION','ARCHIVE_PRELOAD_SMALL','ARCHIVE_PRELOAD_BIG','PURGE_SUBMISSION_TEMP_FILES','PURGE_ORDER','REBUILD_REGISTRY','REINDEX','REINDEX_ALL','RELOAD','REPLICATION','REPLICATION_CHECK','CHECK_COMPLIANCE_LEVEL') NOT NULL; +ALTER TABLE `preservation_job` + ADD COLUMN `max_items` bigint(20) NOT NULL DEFAULT 0; +ALTER TABLE `preservation_job` + ADD COLUMN `parameters` varchar(255) DEFAULT NULL; -- preservation_job_execution ALTER TABLE `preservation_job_execution` 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 225c66394fea358c3470d5d8554c7eb80b042d8c..824d0aea05de3a269b70a61092184df824427ce7 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/AbstractJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/AbstractJob.java @@ -29,6 +29,7 @@ import org.springframework.data.domain.PageRequest; import org.springframework.util.unit.DataSize; import ch.unige.solidify.exception.SolidifyRuntimeException; +import ch.unige.solidify.rest.RestCollectionPage; import ch.unige.solidify.rest.Result; import ch.unige.solidify.service.MessageService; @@ -53,7 +54,7 @@ public abstract class AbstractJob { protected final DataSize fileSizeLimit; - private final int jobPageSize; + private final long jobPageSize; protected AbstractJob(DLCMProperties dlcmProperties, MessageService messageService, JobProcessingService jobProcessingService) { super(); @@ -104,8 +105,12 @@ public abstract class AbstractJob { protected abstract void execute(PreservationJob job, String executionId); - protected PageRequest getPageRequest() { - return PageRequest.of(0, this.jobPageSize); + protected PageRequest getPageRequest(long itemNumber) { + long pageSize = Math.min(this.jobPageSize, RestCollectionPage.MAX_SIZE_PAGE); + if (itemNumber > 0) { + pageSize = Math.min(itemNumber, pageSize); + } + return PageRequest.of(0, (int) pageSize); } protected PageRequest getPageRequestForTotal() { 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 49dac92a28147ec5a29aa23332f9b3682ba01fd5..5bffd79525bc159703f2375b813f307c27b79279 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ApplyAipActionJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ApplyAipActionJob.java @@ -29,6 +29,7 @@ import ch.unige.solidify.exception.SolidifyProcessingException; import ch.unige.solidify.rest.RestCollection; import ch.unige.solidify.rest.Result; import ch.unige.solidify.service.MessageService; +import ch.unige.solidify.util.StringTool; import ch.dlcm.config.DLCMProperties; import ch.dlcm.model.oais.ArchivalInfoPackage; @@ -62,11 +63,15 @@ public class ApplyAipActionJob extends AbstractJob { } private PreservationJob applyAction(PreservationJob job, String executionId, long total, String storageUrl) { - Pageable pageable = this.getPageRequest(); + Pageable pageable = this.getPageRequest(job.getMaxItems()); RestCollection<ArchivalInfoPackage> collection; do { // List AIPs - collection = this.aipRemoteResourceService.getAipList(storageUrl, pageable); + if (StringTool.isNullOrEmpty(job.getParameters())) { + collection = this.aipRemoteResourceService.getAipList(storageUrl, pageable); + } else { + collection = this.aipRemoteResourceService.getAipListWithParameters(storageUrl, job.getParameters(), pageable); + } pageable = pageable.next(); for (final ArchivalInfoPackage aip : collection.getData()) { try { @@ -81,13 +86,11 @@ public class ApplyAipActionJob extends AbstractJob { job = this.addInErrorItem(job, executionId, aip.getResId(), this.getAipPublicUrl(storageUrl, aip.getResId()), e.getMessage()); } // Save intermediate step by 10% - final long num = job.getLastExecution().getLastExecutionReport().getProcessedItems() - + job.getLastExecution().getLastExecutionReport().getIgnoredItems() - + job.getLastExecution().getLastExecutionReport().getInErrorItems(); - job = this.jobProcessingService.saveStep(job, executionId, num, total); + job = this.jobProcessingService.saveStep(job, executionId, total); } - } while (collection.getPage().hasNext()); + } while (collection.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); return job; + } private String[] defineStorageList(PreservationJob job) { 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 0d40305f8ee724354500dbc284bf14fb96248dd1..53117cb11387db9b97d656dc5e95e1bc92c61a71 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckComplianceLevelJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckComplianceLevelJob.java @@ -28,6 +28,7 @@ import org.springframework.data.domain.Pageable; import ch.unige.solidify.rest.RestCollection; import ch.unige.solidify.rest.Result; import ch.unige.solidify.service.MessageService; +import ch.unige.solidify.util.StringTool; import ch.dlcm.config.DLCMProperties; import ch.dlcm.model.preingest.Deposit; @@ -50,16 +51,18 @@ public class CheckComplianceLevelJob extends AbstractJob { @Override protected void execute(PreservationJob job, String executionId) { - Pageable pageable = this.getPageRequest(); + Pageable pageable = this.getPageRequest(job.getMaxItems()); RestCollection<Deposit> depositList; - long count = 0; do { // Find all Deposits - depositList = this.depositRemoteResourceService.getDepositList(pageable); + if (StringTool.isNullOrEmpty(job.getParameters())) { + depositList = this.depositRemoteResourceService.getDepositList(pageable); + } else { + depositList = this.depositRemoteResourceService.getDepositListWithParameters(job.getParameters(), pageable); + } // Go to next page pageable = pageable.next(); for (final Deposit deposit : depositList.getData()) { - count++; try { final Result result = this.depositRemoteResourceService.checkComplianceLevel(deposit); @@ -77,8 +80,8 @@ public class CheckComplianceLevelJob extends AbstractJob { } } - job = this.jobProcessingService.saveStep(job, executionId, count, depositList.getPage().getTotalItems()); + job = this.jobProcessingService.saveStep(job, executionId, depositList.getPage().getTotalItems()); - } while (depositList.getPage().hasNext()); + } while (depositList.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); } } 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 e3c1073dd287ad0b63d7a54bfcbf47334d379df9..c3f848460d4db9c53a1181ad088272f38f4c3d92 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckReplicationJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CheckReplicationJob.java @@ -71,15 +71,13 @@ public class CheckReplicationJob extends AbstractJob { } private PreservationJob runReplicationCheck(PreservationJob job, String executionId, long total) { - Pageable pageable = this.getPageRequest(); - long num = 0; + Pageable pageable = this.getPageRequest(job.getMaxItems()); RestCollection<ArchiveMetadata> collection; do { // List AIPs from index collection = this.archiveMetadataRemoteResourceService.getMetadataList(pageable); pageable = pageable.next(); for (final ArchiveMetadata md : collection.getData()) { - num++; try { this.replicationService.checkAIP(md.getResId()); job = this.addProcessedItem(job, executionId, md.getResId(), @@ -91,9 +89,9 @@ public class CheckReplicationJob extends AbstractJob { job = this.addInErrorItem(job, executionId, md.getResId(), this.getAipPublicUrl(this.defaultArchivalStoragePublicUrl, md.getResId()), e.getMessage()); } - job = this.jobProcessingService.saveStep(job, executionId, num, total); + job = this.jobProcessingService.saveStep(job, executionId, total); } - } while (collection.getPage().hasNext()); + } while (collection.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); return job; } 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 c071af907963618e111b8e3cf9e003a1ac250bf3..99ca1def89cbb6b21c010bb4984184f9b6ab2e62 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CleanSubmissionJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/CleanSubmissionJob.java @@ -32,6 +32,7 @@ import ch.unige.solidify.exception.SolidifyResourceNotFoundException; import ch.unige.solidify.exception.SolidifyRuntimeException; import ch.unige.solidify.rest.RestCollection; import ch.unige.solidify.service.MessageService; +import ch.unige.solidify.util.StringTool; import ch.dlcm.config.DLCMProperties; import ch.dlcm.exception.DLCMJobItemIgnoredException; @@ -75,18 +76,19 @@ public class CleanSubmissionJob extends AbstractJob { @Override public void execute(PreservationJob job, String executionId) { - int count = 0; // Loop on completed SIP to delete working SIP associated to deposit - Pageable sipPageable = this.getPageRequest(); + Pageable sipPageable = this.getPageRequest(job.getMaxItems()); RestCollection<SubmissionInfoPackage> sipList; do { // Find all completed SIP - sipList = this.sipRemoteResourceService.getSIPList(sipPageable); + if (StringTool.isNullOrEmpty(job.getParameters())) { + sipList = this.sipRemoteResourceService.getSIPList(sipPageable); + } else { + sipList = this.sipRemoteResourceService.getSIPListWithParameters(job.getParameters(), sipPageable); + } // Go to next page sipPageable = sipPageable.next(); for (final SubmissionInfoPackage sipPackage : sipList.getData()) { - count++; - try { // Check SIP this.checkIfSipReadyToClean(sipPackage); @@ -115,9 +117,9 @@ public class CleanSubmissionJob extends AbstractJob { } catch (final DLCMJobItemInErrorException e) { job = this.addInErrorItem(job, executionId, e.getPackageId(), e.getPackageUrl(), e.getMessage()); } - this.jobProcessingService.saveStep(job, executionId, count, sipList.getPage().getTotalItems()); + this.jobProcessingService.saveStep(job, executionId, sipList.getPage().getTotalItems()); } - } while (sipList.getPage().hasNext()); + } while (sipList.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); } private Deposit cleanDeposit(String depositId) throws DLCMJobItemIgnoredException, DLCMJobItemInErrorException { @@ -153,7 +155,7 @@ public class CleanSubmissionJob extends AbstractJob { .getWhen() .plusDays( this.submissionPolicyRemoteResourceService.getSubmissionPolicy( - sipPackage.getSubmissionPolicyId()) + sipPackage.getSubmissionPolicyId()) .getTimeToKeep()); if (endTimeToKeep.isAfter(OffsetDateTime.now(ZoneOffset.UTC))) { diff --git a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ComplianceLevelUpdateJob.java b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ComplianceLevelUpdateJob.java index f7bd530e69800e13c48f0eff81886854c95fa09b..f04ddee9546766f91d2d1ad7b8828838fa06ea74 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ComplianceLevelUpdateJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ComplianceLevelUpdateJob.java @@ -28,6 +28,7 @@ import org.springframework.data.domain.Pageable; import ch.unige.solidify.rest.RestCollection; import ch.unige.solidify.rest.Result; import ch.unige.solidify.service.MessageService; +import ch.unige.solidify.util.StringTool; import ch.dlcm.config.DLCMProperties; import ch.dlcm.model.PackageStatus; @@ -55,11 +56,15 @@ public class ComplianceLevelUpdateJob extends AbstractJob { @Override protected void execute(PreservationJob job, String executionId) { final long total = this.getTotal(this.defaultStorageUrl); - Pageable pageable = this.getPageRequest(); + Pageable pageable = this.getPageRequest(job.getMaxItems()); RestCollection<ArchivalInfoPackage> collection; do { // List AIPs - collection = this.aipRemoteResourceService.getAipList(this.defaultStorageUrl, pageable); + if (StringTool.isNullOrEmpty(job.getParameters())) { + collection = this.aipRemoteResourceService.getAipList(this.defaultStorageUrl, pageable); + } else { + collection = this.aipRemoteResourceService.getAipListWithParameters(this.defaultStorageUrl, job.getParameters(), pageable); + } pageable = pageable.next(); for (final ArchivalInfoPackage aip : collection.getData()) { try { @@ -77,12 +82,9 @@ public class ComplianceLevelUpdateJob extends AbstractJob { e.getMessage()); } // Save intermediate step by 10% - final long num = job.getLastExecution().getLastExecutionReport().getProcessedItems() - + job.getLastExecution().getLastExecutionReport().getIgnoredItems() - + job.getLastExecution().getLastExecutionReport().getInErrorItems(); - job = this.jobProcessingService.saveStep(job, executionId, num, total); + job = this.jobProcessingService.saveStep(job, executionId, total); } - } while (collection.getPage().hasNext()); + } while (collection.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); } private long getTotal(String storageUrl) { 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 4d5012a2745bea288b301c8a1b113fd38394f943..9e5246ac1e601e283a0a42747999ac6f8c345705 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/DisposalJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/DisposalJob.java @@ -68,7 +68,7 @@ public class DisposalJob extends AbstractJob { } private PreservationJob runDisposalProcess(PreservationJob job, String executionId, long total) { - Pageable pageable = this.getPageRequest(); + Pageable pageable = this.getPageRequest(job.getMaxItems()); RestCollection<ArchiveMetadata> collection; do { // List archives @@ -85,12 +85,9 @@ public class DisposalJob extends AbstractJob { // extract message from parent exception job = this.addInErrorItem(job, executionId, archive.getResId(), this.getArchivePublicUrl(archive.getResId()), e.getMessage()); } - final long num = job.getLastExecution().getLastExecutionReport().getProcessedItems() - + job.getLastExecution().getLastExecutionReport().getIgnoredItems() - + job.getLastExecution().getLastExecutionReport().getInErrorItems(); - job = this.jobProcessingService.saveStep(job, executionId, num, total); + job = this.jobProcessingService.saveStep(job, executionId, total); } - } while (collection.getPage().hasNext()); + } while (collection.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); return job; } } 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 dd25e0a98142191960b4d56858f4a8cadea36023..702b39d47c46880e6269901f40b9b91dac23a9ec 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/MetadataMigrationJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/MetadataMigrationJob.java @@ -31,6 +31,7 @@ import org.springframework.data.domain.Pageable; import ch.unige.solidify.rest.RestCollection; import ch.unige.solidify.rest.Result; import ch.unige.solidify.service.MessageService; +import ch.unige.solidify.util.StringTool; import ch.dlcm.DLCMMetadataVersion; import ch.dlcm.config.DLCMProperties; @@ -72,11 +73,15 @@ public class MetadataMigrationJob extends AbstractJob { @Override protected void execute(PreservationJob job, String executionId) { final long total = this.getTotal(this.defaultStorageUrl); - Pageable pageable = this.getPageRequest(); + Pageable pageable = this.getPageRequest(job.getMaxItems()); RestCollection<ArchivalInfoPackage> collection; do { // List AIPs - collection = this.aipRemoteResourceService.getAipList(this.defaultStorageUrl, pageable); + if (StringTool.isNullOrEmpty(job.getParameters())) { + collection = this.aipRemoteResourceService.getAipList(this.defaultStorageUrl, pageable); + } else { + collection = this.aipRemoteResourceService.getAipListWithParameters(this.defaultStorageUrl, job.getParameters(), pageable); + } pageable = pageable.next(); for (final ArchivalInfoPackage aip : collection.getData()) { final List<SubmissionInfoPackage> sipList = new ArrayList<>(); @@ -99,12 +104,9 @@ public class MetadataMigrationJob extends AbstractJob { e.getMessage()); } // Save intermediate step by 10% - final long num = job.getLastExecution().getLastExecutionReport().getProcessedItems() - + job.getLastExecution().getLastExecutionReport().getIgnoredItems() - + job.getLastExecution().getLastExecutionReport().getInErrorItems(); - job = this.jobProcessingService.saveStep(job, executionId, num, total); + job = this.jobProcessingService.saveStep(job, executionId, total); } - } while (collection.getPage().hasNext()); + } while (collection.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); } private PreservationJob ignoreArchive(PreservationJob job, String executionId, String storageUrl, ArchivalInfoPackage aip, 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 1cc12d02e60de27ac2635a6afea72f045a3ece8a..f796e4ab306a25845de0b52561c0ec58949d2a06 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PreloadAipJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PreloadAipJob.java @@ -57,15 +57,13 @@ public class PreloadAipJob extends AbstractJob { @Override public void execute(PreservationJob job, String executionId) { - Pageable pageable = this.getPageRequest(); - long num = 0; + Pageable pageable = this.getPageRequest(job.getMaxItems()); RestCollection<ArchiveMetadata> collection; do { // List existing archives collection = this.archiveMetadataRemoteResourceService.getIndexMetadataList(pageable); pageable = pageable.next(); for (final ArchiveMetadata archiveMetadata : collection.getData()) { - num++; try { Result res = switch (job.getJobType()) { case ARCHIVE_PRELOAD_SMALL -> this.preloadArchive(0L, this.fileSizeLimit.toBytes(), archiveMetadata); @@ -78,9 +76,9 @@ public class PreloadAipJob extends AbstractJob { e.getMessage()); } // Save intermediate step by 10% - job = this.jobProcessingService.saveStep(job, executionId, num, collection.getPage().getTotalItems()); + job = this.jobProcessingService.saveStep(job, executionId, collection.getPage().getTotalItems()); } - } while (collection.getPage().hasNext()); + } while (collection.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); } private Result preloadArchive(long minSize, long maxSize, ArchiveMetadata archiveMetadata) { 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 244d8fe91dd6c0e86875a405bb445c748f145a73..8a1a93fd738a789c23007cb753f26b85cf149fa7 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeOrderJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeOrderJob.java @@ -48,7 +48,6 @@ public class PurgeOrderJob extends AbstractJob { private final TrustedOrderRemoteResourceService orderRemoteResourceService; private final TrustedDisseminationInfoPackageRemoteResourceService disseminationInfoPackageRemoteResourceService; private final TrustedAIPDownloadRemoteResourceService aipDownloadRemoteResourceService; - private long count = 0; private ArrayList<String> dipIds; private ArrayList<String> aipDownloadIds; private final int timeToKeep; @@ -71,7 +70,6 @@ public class PurgeOrderJob extends AbstractJob { protected void execute(PreservationJob job, String executionId) { // Compute item total final long total = this.getTotal(); - this.count = 0; this.dipIds = new ArrayList<>(); this.aipDownloadIds = new ArrayList<>(); job = this.deleteCompletedOrder(job, executionId, total); @@ -79,14 +77,13 @@ public class PurgeOrderJob extends AbstractJob { } private PreservationJob deleteCompletedOrder(PreservationJob job, String executionId, long total) { - Pageable pageable = this.getPageRequest(); + Pageable pageable = this.getPageRequest(job.getMaxItems()); RestCollection<Order> collection; do { collection = this.orderRemoteResourceService.getCompletedOrder(pageable); // check time to keep pageable = pageable.next(); for (final Order order : collection.getData()) { - this.count++; // Check if order creation time if (order.getCreation().getWhen().plusDays(this.timeToKeep).isAfter(OffsetDateTime.now(ZoneOffset.UTC))) { job = this.addIgnoredItem(job, executionId, order.getResId(), this.getOrderPublicUrl(order.getResId()), @@ -94,7 +91,7 @@ public class PurgeOrderJob extends AbstractJob { continue; } // Get all dip and aip ids to preserve them since it is needed to delete first the order - Pageable dipPageable = this.getPageRequest(); + Pageable dipPageable = this.getPageRequest(job.getMaxItems()); RestCollection<DisseminationInfoPackage> dipList; do { dipList = this.disseminationInfoPackageRemoteResourceService.getDIPByOrder(order.getResId(), dipPageable); @@ -106,7 +103,7 @@ public class PurgeOrderJob extends AbstractJob { }); } while (dipList.getPage().hasNext()); - Pageable aipPageable = this.getPageRequest(); + Pageable aipPageable = this.getPageRequest(job.getMaxItems()); RestCollection<ArchivalInfoPackage> aipList; do { aipList = this.aipDownloadRemoteResourceService.getAipsByOrder(order.getResId(), aipPageable); @@ -125,9 +122,9 @@ public class PurgeOrderJob extends AbstractJob { } catch (final Exception e) { job = this.addInErrorItem(job, executionId, order.getResId(), this.getOrderPublicUrl(order.getResId()), e.getMessage()); } - this.jobProcessingService.saveStep(job, executionId, this.count, total); + this.jobProcessingService.saveStep(job, executionId, total); } - } while (collection.getPage().hasNext()); + } while (collection.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); return job; } @@ -135,19 +132,17 @@ public class PurgeOrderJob extends AbstractJob { private void deleteDIPAndAIPLinkedToOrders(PreservationJob job, String executionId, long total) { for (String dipId : this.dipIds) { try { - this.count++; this.disseminationInfoPackageRemoteResourceService.deleteDIP(dipId); job = this.addProcessedItem(job, executionId, dipId, null); } catch (final Exception e) { job = this.addInErrorItem(job, executionId, dipId, this.getDIPPublicUrl(dipId), e.getMessage()); } - this.jobProcessingService.saveStep(job, executionId, this.count, total); + this.jobProcessingService.saveStep(job, executionId, total); } // Once all the orders have been removed, we can delete all AIP Download for (String aipId : this.aipDownloadIds) { try { - this.count++; this.aipDownloadRemoteResourceService.deleteAIPDownload(aipId); job = this.addProcessedItem(job, executionId, aipId, null); } catch (final SolidifyRestException e) { @@ -158,7 +153,7 @@ public class PurgeOrderJob extends AbstractJob { } catch (final Exception e) { job = this.addInErrorItem(job, executionId, aipId, this.getAIPDownloadPublicUrl(aipId), e.getMessage()); } - this.jobProcessingService.saveStep(job, executionId, this.count, total); + this.jobProcessingService.saveStep(job, executionId, total); } } 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 da34d2644ed4dfd967d8770b5d1ccce47902b63e..03a14a886935e50ba1ae1537126ae40b93cf95fb 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeSubmissionTempFilesJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/PurgeSubmissionTempFilesJob.java @@ -50,7 +50,6 @@ public class PurgeSubmissionTempFilesJob extends AbstractJob { private final TrustedSubmissionInfoPackageRemoteResourceService sipRemoteResourceService; private final TrustedArchivalInfoPackageRemoteResourceService aipRemoteResourceService; private final TrustedArchivePublicMetadataRemoteResourceService archiveMetadataRemoteResourceService; - private long count = 0; public PurgeSubmissionTempFilesJob( DLCMProperties dlcmProperties, @@ -71,7 +70,6 @@ public class PurgeSubmissionTempFilesJob extends AbstractJob { public void execute(PreservationJob job, String executionId) { // Compute item total final long total = this.getTotal(); - this.count = 0; job = this.deleteWorkingSIP(job, executionId, total); this.deleteWorkingAIP(job, executionId, total); } @@ -84,7 +82,7 @@ public class PurgeSubmissionTempFilesJob extends AbstractJob { * @param total */ private PreservationJob deleteWorkingAIP(PreservationJob job, String executionId, long total) { - Pageable archivePageable = this.getPageRequest(); + Pageable archivePageable = this.getPageRequest(job.getMaxItems()); RestCollection<ArchiveMetadata> archiveList; do { // Find all completed AIP on default archival storage module @@ -96,7 +94,6 @@ public class PurgeSubmissionTempFilesJob extends AbstractJob { // For all SIP of the AIP: today always 1 only SIP final ArchivalInfoPackage aip = this.aipRemoteResourceService.findOne(archive.getResId()); for (final String sipId : aip.getSipIds()) { - this.count++; try { // Check if the working AIP associated with the SIP is already deleted final HttpStatusCode httpStatus = this.sipRemoteResourceService.checkSipWorkingAip(sipId); @@ -118,9 +115,9 @@ public class PurgeSubmissionTempFilesJob extends AbstractJob { log.error("Error in purging temporary AIP for SIP {} : {}", sipId, e.getMessage()); } } - job = this.jobProcessingService.saveStep(job, executionId, this.count, total); + job = this.jobProcessingService.saveStep(job, executionId, total); } - } while (archiveList.getPage().hasNext()); + } while (archiveList.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); return job; } @@ -134,7 +131,7 @@ public class PurgeSubmissionTempFilesJob extends AbstractJob { * @return */ private PreservationJob deleteWorkingSIP(PreservationJob job, String executionId, long total) { - Pageable sipPageable = this.getPageRequest(); + Pageable sipPageable = this.getPageRequest(job.getMaxItems()); RestCollection<SubmissionInfoPackage> sipList; do { // Find all completed SIP @@ -143,7 +140,6 @@ public class PurgeSubmissionTempFilesJob extends AbstractJob { sipPageable = sipPageable.next(); // For each SIP for (final SubmissionInfoPackage sipPackage : sipList.getData()) { - this.count++; final String depositId = sipPackage.getDepositId(); try { final HttpStatusCode httpStatus = this.depositRemoteResourceService.checkDepositWorkingSip(depositId); @@ -166,9 +162,9 @@ public class PurgeSubmissionTempFilesJob extends AbstractJob { job = this.addInErrorItem(job, executionId, sipPackage.getResId(), this.getDepositPublicUrl(depositId), e.getMessage()); log.error("Error in purging temporary SIP for deposit {} : {}", depositId, e.getMessage()); } - job = this.jobProcessingService.saveStep(job, executionId, this.count, total); + job = this.jobProcessingService.saveStep(job, executionId, total); } - } while (sipList.getPage().hasNext()); + } while (sipList.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); return job; } 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 24756abbcf7542f7034f2571cc616413b27f6536..60da524c73af7b2002e0bea890fdfb354de1d4af 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReloadAipJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReloadAipJob.java @@ -51,15 +51,13 @@ public class ReloadAipJob extends AbstractJob { @Override public void execute(PreservationJob job, String executionId) { - Pageable pageable = this.getPageRequest(); - long num = 0; + Pageable pageable = this.getPageRequest(job.getMaxItems()); RestCollection<StoredAIP> collection; do { // List existing AIPs (Stored AIP) collection = this.aipRemoteResourceService.getStoredAipList(pageable); pageable = pageable.next(); for (final StoredAIP storedAip : collection.getData()) { - num++; try { // Check if AIP already exists this.aipRemoteResourceService.getAIPOnDefaultStorage(storedAip.getAipId()); @@ -77,8 +75,8 @@ public class ReloadAipJob extends AbstractJob { } } // Save intermediate step by 10% - job = this.jobProcessingService.saveStep(job, executionId, num, collection.getPage().getTotalItems()); + job = this.jobProcessingService.saveStep(job, executionId, collection.getPage().getTotalItems()); } - } while (collection.getPage().hasNext()); + } while (collection.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); } } 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 506e438d03505e02582fe61182da459dae2e184f..60290ac5b6de40407a5c235255fe38a38e9de265 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReplicationJob.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/job/ReplicationJob.java @@ -74,7 +74,7 @@ public class ReplicationJob extends AbstractJob { } private PreservationJob runReplication(PreservationJob job, String executionId, long total, boolean archiveUnit) { - Pageable pageable = this.getPageRequest(); + Pageable pageable = this.getPageRequest(job.getMaxItems()); RestCollection<ArchiveMetadata> collection; do { // List AIPs from index @@ -94,12 +94,12 @@ public class ReplicationJob extends AbstractJob { job = this.addInErrorItem(job, executionId, md.getResId(), this.getAipPublicUrl(this.defaultArchivalStoragePublicUrl, md.getResId()), e.getMessage()); } - final long num = job.getLastExecution().getLastExecutionReport().getProcessedItems() - + job.getLastExecution().getLastExecutionReport().getIgnoredItems() - + job.getLastExecution().getLastExecutionReport().getInErrorItems(); - job = this.jobProcessingService.saveStep(job, executionId, num, total); + job.getLastExecution().getLastExecutionReport().getProcessedItems(); + job.getLastExecution().getLastExecutionReport().getIgnoredItems(); + job.getLastExecution().getLastExecutionReport().getInErrorItems(); + job = this.jobProcessingService.saveStep(job, executionId, total); } - } while (collection.getPage().hasNext()); + } while (collection.getPage().hasNext() && this.jobProcessingService.checkIfMaxItems(job, executionId)); return job; } } 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 488e4493154e9569a9913a8124bb91fcbb7f11ab..ab57ecaafee6a84b0fbfa149e3507785a2b24380 100644 --- a/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/JobProcessingService.java +++ b/DLCM-PreservationPlanning/src/main/java/ch/dlcm/service/JobProcessingService.java @@ -89,9 +89,7 @@ public class JobProcessingService extends DLCMService { public void completeInErrorJob(PreservationJob job, String executionId, Exception e) { final Optional<PreservationJob> jobValue = this.jobRepository.findById(job.getResId()); final PreservationJob jobReload = jobValue.orElseThrow(() -> new NoSuchElementException("Preservation Job " + job.getResId())); - final JobExecution execution = jobReload.getExecutions().stream().filter(item -> item.getResId().equals(executionId)).findFirst() - .orElseThrow(() -> new NoSuchElementException( - "Preservation Job " + jobReload.getResId() + " does not contain an execution with " + executionId)); + final JobExecution execution = this.getJobExecution(jobReload, executionId); execution.setStatus(JobStatus.IN_ERROR); execution.setStatusMessage(e.getMessage()); execution.setCompletionStatus(100); @@ -109,9 +107,7 @@ public class JobProcessingService extends DLCMService { public void completeJob(PreservationJob job, String executionId) { final Optional<PreservationJob> jobValue = this.jobRepository.findById(job.getResId()); final PreservationJob jobReload = jobValue.orElseThrow(() -> new NoSuchElementException("Preservation Job " + job.getResId())); - final JobExecution execution = jobReload.getExecutions().stream().filter(item -> item.getResId().equals(executionId)).findFirst() - .orElseThrow(() -> new NoSuchElementException( - "Preservation Job " + jobReload.getResId() + " does not contain an execution with " + executionId)); + final JobExecution execution = this.getJobExecution(jobReload, executionId); execution.setStatus(JobStatus.COMPLETED); execution.setCompletionStatus(100); execution.setEndDate(OffsetDateTime.now(ZoneOffset.UTC)); @@ -143,8 +139,7 @@ public class JobProcessingService extends DLCMService { public PreservationJob resumeExecution(String jobId, String executionId) { final PreservationJob job = this.jobRepository.findById(jobId) .orElseThrow(() -> new NoSuchElementException("Preservation Job " + jobId + " not found")); - final JobExecution execution = job.getExecutions().stream().filter(item -> item.getResId().equals(executionId)).findFirst() - .orElseThrow(() -> new NoSuchElementException("Preservation Job " + jobId + " does not contain an execution with " + executionId)); + final JobExecution execution = this.getJobExecution(job, executionId); log.info("Job {} {} starting execution {}", job.getResId(), job.getJobType().name(), execution.getResId()); execution.setStatus(JobStatus.IN_PROGRESS); job.getLastExecution().setStatusMessage(null); @@ -163,13 +158,12 @@ public class JobProcessingService extends DLCMService { * @param totalItems */ @Transactional - public PreservationJob saveStep(PreservationJob job, String executionId, long num, long totalItems) { - - final JobExecution execution = job.getExecutions().stream().filter(item -> item.getResId().equals(executionId)).findFirst() - .orElseThrow(() -> new NoSuchElementException( - "Preservation Job " + job.getResId() + " does not contain an execution with " + executionId)); + public PreservationJob saveStep(PreservationJob job, String executionId, long totalItems) { + // Get Job Execution + final JobExecution execution = this.getJobExecution(job, executionId); - final int percent = this.calculatePercentRoundTo10(num, totalItems); + final long currentNumber = execution.getProcessedItems() + execution.getIgnoredItems() + execution.getInErrorItems(); + final int percent = this.calculatePercentRoundTo10(currentNumber, totalItems); if (execution.getCompletionStatus() != percent) { execution.setCompletionStatus(percent); @@ -179,6 +173,14 @@ public class JobProcessingService extends DLCMService { return job; } + public boolean checkIfMaxItems(PreservationJob job, String executionId) { + if (job.getMaxItems() == 0) { + return true; + } + final JobExecution jobExecution = this.getJobExecution(job, executionId); + return jobExecution.getProcessedItems() < job.getMaxItems(); + } + /** * Save Job in database * diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivalInfoPackageRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivalInfoPackageRemoteResourceService.java index 014b0c164da1a13fbcf2207c2f01842c09da55e3..f41aa255fd8ef63f501afdb3f95e22a03367658c 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivalInfoPackageRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/ArchivalInfoPackageRemoteResourceService.java @@ -38,6 +38,7 @@ import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import ch.unige.solidify.SolidifyConstants; +import ch.unige.solidify.exception.SolidifyCheckingException; import ch.unige.solidify.exception.SolidifyProcessingException; import ch.unige.solidify.exception.SolidifyRuntimeException; import ch.unige.solidify.rest.ActionName; @@ -313,6 +314,15 @@ public abstract class ArchivalInfoPackageRemoteResourceService extends RemoteRes return new RestCollection<>(jsonString, ArchivalInfoPackage.class); } + public RestCollection<ArchivalInfoPackage> getAipListWithParameters(String storageUrl, String queryParameters, Pageable pageable) { + if (StringTool.isNullOrEmpty(queryParameters)) { + throw new SolidifyCheckingException("The parameter list is missing"); + + } + String jsonString = this.restClientService.getResource(storageUrl + "/" + ResourceName.AIP + "?" + queryParameters, pageable); + return new RestCollection<>(jsonString, ArchivalInfoPackage.class); + } + public RestCollection<AipDataFile> getAipDataFileList(String storageUrl, String aipId, Pageable pageable) { String jsonString = this.restClientService.getResource(this.getArchivalStorageUrlWithId(storageUrl, aipId) + "/" + ResourceName.DATAFILE, diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/DepositRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/DepositRemoteResourceService.java index 2a360f3e7bdf9cee803cbbd5537c739bcb6a978d..35320c67e86103f32d0f603ec607f8b1ea0e1225 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/DepositRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/DepositRemoteResourceService.java @@ -29,10 +29,12 @@ import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatusCode; import org.springframework.web.client.HttpClientErrorException; +import ch.unige.solidify.exception.SolidifyCheckingException; import ch.unige.solidify.rest.RestCollection; import ch.unige.solidify.rest.Result; import ch.unige.solidify.service.RemoteResourceService; import ch.unige.solidify.service.SolidifyRestClientService; +import ch.unige.solidify.util.StringTool; import ch.dlcm.config.DLCMProperties; import ch.dlcm.model.preingest.Deposit; @@ -55,6 +57,14 @@ public abstract class DepositRemoteResourceService extends RemoteResourceService return new RestCollection<>(jsonString, Deposit.class); } + public RestCollection<Deposit> getDepositListWithParameters(String queryParameters, Pageable pageable) { + if (StringTool.isNullOrEmpty(queryParameters)) { + throw new SolidifyCheckingException("The parameter list is missing"); + } + String jsonString = this.restClientService.getResource(this.preingestUrl + "/" + ResourceName.DEPOSIT + "?" + queryParameters, pageable); + return new RestCollection<>(jsonString, Deposit.class); + } + public RestCollection<DepositDataFile> getDepositDataFileList(String depositId, Pageable pageable) { String jsonString = this.restClientService.getResource(this.preingestUrl + "/" + ResourceName.DEPOSIT + "/" + depositId + "/" + ResourceName.DATAFILE, pageable); diff --git a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/SubmissionInfoPackageRemoteResourceService.java b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/SubmissionInfoPackageRemoteResourceService.java index 3eab58ea7528b52967cd444dbcd6d279979ade87..6ca7ac69ccfc0f54076ff0f55984f311668d6cce 100644 --- a/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/SubmissionInfoPackageRemoteResourceService.java +++ b/DLCM-ResourceServerCommon/src/main/java/ch/dlcm/service/rest/abstractservice/SubmissionInfoPackageRemoteResourceService.java @@ -84,6 +84,14 @@ public abstract class SubmissionInfoPackageRemoteResourceService extends RemoteR return new RestCollection<>(jsonString, SubmissionInfoPackage.class); } + public RestCollection<SubmissionInfoPackage> getSIPListWithParameters(String queryParameters, Pageable pageable) { + if (StringTool.isNullOrEmpty(queryParameters)) { + throw new SolidifyCheckingException("The parameter list is missing"); + } + String jsonString = this.restClientService.getResource(this.ingestUrl + "/" + ResourceName.SIP + "?" + queryParameters, pageable); + return new RestCollection<>(jsonString, SubmissionInfoPackage.class); + } + public RestCollection<SipDataFile> getSipDataFileList(String sipId, Pageable pageable) { String jsonString = this.restClientService.getResource(this.ingestUrl + "/" + ResourceName.SIP + "/" + sipId + "/" + ResourceName.DATAFILE, pageable);