diff --git a/pom.xml b/pom.xml
index b76b686f..fe5d9fe7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
fr.progilone.numahop
numahop
- 2.2.1
+ 2.3.0
war
NumaHOP
NumaHOP
diff --git a/src/main/java/fr/progilone/pgcn/config/SecurityConfiguration.java b/src/main/java/fr/progilone/pgcn/config/SecurityConfiguration.java
index 2e75552b..83c59fa0 100644
--- a/src/main/java/fr/progilone/pgcn/config/SecurityConfiguration.java
+++ b/src/main/java/fr/progilone/pgcn/config/SecurityConfiguration.java
@@ -70,7 +70,9 @@ public SecurityFilterChain filterChain(final HttpSecurity http) throws Exception
.passwordParameter("j_password")
.permitAll())
.logout(c -> c.logoutUrl("/api/logout").logoutSuccessHandler(ajaxLogoutSuccessHandler).deleteCookies("JSESSIONID", "hazelcast.sessionId").permitAll())
- .headers(c -> c.frameOptions().disable())
+ .headers(c -> c.frameOptions()
+ .disable()
+ .contentSecurityPolicy(contentSecurityPolicyConfig -> contentSecurityPolicyConfig.policyDirectives("default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline'; style-src 'self' 'unsafe-eval' 'unsafe-inline'; img-src 'self' data:;")))
.authorizeHttpRequests(authorize -> authorize.requestMatchers(new AntPathRequestMatcher("/api/authenticate"), new AntPathRequestMatcher("/api/rest/reset"))
.permitAll()
.requestMatchers(new AntPathRequestMatcher("/api/**"), new AntPathRequestMatcher("/protected/**"))
diff --git a/src/main/java/fr/progilone/pgcn/domain/administration/digitallibrary/DigitalLibraryConfiguration.java b/src/main/java/fr/progilone/pgcn/domain/administration/digitallibrary/DigitalLibraryConfiguration.java
index dcbb3d2b..7bf6cc72 100644
--- a/src/main/java/fr/progilone/pgcn/domain/administration/digitallibrary/DigitalLibraryConfiguration.java
+++ b/src/main/java/fr/progilone/pgcn/domain/administration/digitallibrary/DigitalLibraryConfiguration.java
@@ -103,6 +103,9 @@ public class DigitalLibraryConfiguration extends AbstractDomainObject {
@Column(name = "export_alto")
private boolean exportAlto;
+ @Column(name = "export_master")
+ private boolean exportMaster;
+
/**
* Valeur par défaut des champs vides
*/
@@ -237,6 +240,14 @@ public void setExportAlto(final boolean exportAlto) {
this.exportAlto = exportAlto;
}
+ public boolean isExportMaster() {
+ return exportMaster;
+ }
+
+ public void setExportMaster(final boolean exportMaster) {
+ this.exportMaster = exportMaster;
+ }
+
public String getDefaultValue() {
return defaultValue;
}
diff --git a/src/main/java/fr/progilone/pgcn/repository/document/DocUnitRepository.java b/src/main/java/fr/progilone/pgcn/repository/document/DocUnitRepository.java
index 2f38dadb..4ebd4f36 100644
--- a/src/main/java/fr/progilone/pgcn/repository/document/DocUnitRepository.java
+++ b/src/main/java/fr/progilone/pgcn/repository/document/DocUnitRepository.java
@@ -152,6 +152,8 @@ public interface DocUnitRepository extends JpaRepository, DocUn
DocUnit getOneByPgcnId(String pgcnId);
+ List findAllByPgcnId(String pgcnId);
+
DocUnit getOneByPgcnIdAndState(String pgcnId, DocUnit.State state);
Long countByPgcnIdAndState(String pgcnId, DocUnit.State state);
diff --git a/src/main/java/fr/progilone/pgcn/service/check/AutomaticCheckService.java b/src/main/java/fr/progilone/pgcn/service/check/AutomaticCheckService.java
index f0f7de4a..aaf2b25d 100644
--- a/src/main/java/fr/progilone/pgcn/service/check/AutomaticCheckService.java
+++ b/src/main/java/fr/progilone/pgcn/service/check/AutomaticCheckService.java
@@ -646,7 +646,10 @@ public List checkMetadataOfFiles(final Map values, final Metadatas metas) {
return StringUtils.isNotBlank(tag) && metas.getTags().containsKey(tag)
&& metas.getTags().get(tag).size() == values.size()
- && metas.getTags().get(tag).stream().allMatch(t -> values.stream().map(ImageMetadataValue::getValue).anyMatch(value -> value.equalsIgnoreCase(t)));
+ && metas.getTags()
+ .get(tag)
+ .stream()
+ .allMatch(t -> values.stream().map(ImageMetadataValue::getValue).anyMatch(value -> value.replaceAll(" ", "").equalsIgnoreCase(t.replaceAll(" ", ""))));
}
/**
diff --git a/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryProcessService.java b/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryProcessService.java
index 3c3c4471..3aefbe64 100644
--- a/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryProcessService.java
+++ b/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryProcessService.java
@@ -769,8 +769,8 @@ public Map getDiskInfos(final String libId) {
final File tmpdir = bm.getTmpDir(libId);
final Map infos = new HashMap<>();
if (tmpdir != null) {
- infos.put("occupe", tmpdir.getTotalSpace() - tmpdir.getUsableSpace());
- infos.put("disponible", tmpdir.getUsableSpace());
+ infos.put("occupe", tmpdir.getTotalSpace() - tmpdir.getFreeSpace());
+ infos.put("disponible", tmpdir.getFreeSpace());
LOG.debug("Espace disque - Occupé {} - Disponible {}", infos.get("occupe"), infos.get("disponible"));
}
return infos;
diff --git a/src/main/java/fr/progilone/pgcn/service/document/BibliographicRecordService.java b/src/main/java/fr/progilone/pgcn/service/document/BibliographicRecordService.java
index cbf3ab11..9030f47b 100644
--- a/src/main/java/fr/progilone/pgcn/service/document/BibliographicRecordService.java
+++ b/src/main/java/fr/progilone/pgcn/service/document/BibliographicRecordService.java
@@ -88,7 +88,8 @@ public BibliographicRecord getOne(final String identifier) {
@Transactional
public void delete(final String identifier) {
bibliographicRecordRepository.findById(identifier).ifPresent(r -> {
- esDocUnitService.delete(r.getDocUnit().getIdentifier());
+ if (r.getDocUnit() != null)
+ esDocUnitService.delete(r.getDocUnit().getIdentifier());
bibliographicRecordRepository.deleteById(identifier);
});
}
diff --git a/src/main/java/fr/progilone/pgcn/service/exchange/DeduplicationService.java b/src/main/java/fr/progilone/pgcn/service/exchange/DeduplicationService.java
index ee781304..7483ee5f 100644
--- a/src/main/java/fr/progilone/pgcn/service/exchange/DeduplicationService.java
+++ b/src/main/java/fr/progilone/pgcn/service/exchange/DeduplicationService.java
@@ -38,11 +38,15 @@ public Collection lookupDuplicates(final DocUnit docUnit) {
final Set duplicates = new HashSet<>();
// UD doublons sur le PGCN Id
if (docUnit.getPgcnId() != null) {
- final DocUnit duplPgcnId = docUnitRepository.getOneByPgcnIdAndState(docUnit.getPgcnId(), DocUnit.State.AVAILABLE);
- if (duplPgcnId != null) {
- duplicates.add(duplPgcnId);
- }
+ // Les doublons peuvent être clôturés ! Ne pas restreindre aux unités documentaires disponibles.
+ final List duplPgcnId = docUnitRepository.findAllByPgcnId(docUnit.getPgcnId());
+ duplPgcnId.stream().forEach(dupl -> {
+ // L'unité documentaire actuellement checkée se trouve aussi dans la liste retournée par la bdd
+ if (!dupl.getIdentifier().equals(docUnit.getIdentifier()))
+ duplicates.add(dupl);
+ });
+
}
// UD doublon sur l'identifiant de la notice
docUnit.getRecords().stream().map(bib -> lookupDuplicates(docUnit, bib)).flatMap(Collection::stream).forEach(duplicates::add);
@@ -62,7 +66,7 @@ private List lookupDuplicates(final DocUnit docUnit, final Bibliographi
.filter(prop -> StringUtils.equals(prop.getType().getIdentifier(), "identifier"))
.map(DocProperty::getValue)
.collect(Collectors.toList());
- // Recherche des doublons déjà importés
- return docUnitRepository.searchDuplicates(docUnit, identifiers, DocUnit.State.AVAILABLE);
+ // Les doublons peuvent être clôturés ! Ne pas restreindre aux unités documentaires disponibles.
+ return docUnitRepository.searchDuplicates(docUnit, identifiers);
}
}
diff --git a/src/main/java/fr/progilone/pgcn/service/exchange/ImportReportService.java b/src/main/java/fr/progilone/pgcn/service/exchange/ImportReportService.java
index c40885e6..13aa4db0 100644
--- a/src/main/java/fr/progilone/pgcn/service/exchange/ImportReportService.java
+++ b/src/main/java/fr/progilone/pgcn/service/exchange/ImportReportService.java
@@ -12,6 +12,7 @@
import fr.progilone.pgcn.repository.exchange.ImportedDocUnitRepository;
import fr.progilone.pgcn.repository.imagemetadata.ImageMetadataValuesRepository;
import fr.progilone.pgcn.security.SecurityUtils;
+import fr.progilone.pgcn.service.document.DocUnitService;
import fr.progilone.pgcn.service.storage.FileStorageManager;
import fr.progilone.pgcn.service.util.transaction.TransactionService;
import fr.progilone.pgcn.service.util.transaction.TransactionalJobRunner;
@@ -63,6 +64,7 @@ public class ImportReportService {
private final ImageMetadataValuesRepository imageMetadataValuesRepository;
private final TransactionService transactionService;
private final WebsocketService websocketService;
+ private final DocUnitService docUnitService;
// Stockage des fichiers importés
@Value("${uploadPath.import}")
@@ -76,7 +78,8 @@ public ImportReportService(final DocUnitRepository docUnitRepository,
final TransactionService transactionService,
final WebsocketService websocketService,
final ConditionReportRepository conditionReportRepository,
- final ImageMetadataValuesRepository imageMetadataValuesRepository) {
+ final ImageMetadataValuesRepository imageMetadataValuesRepository,
+ final DocUnitService docUnitService) {
this.docUnitRepository = docUnitRepository;
this.conditionReportRepository = conditionReportRepository;
this.fm = fm;
@@ -85,6 +88,7 @@ public ImportReportService(final DocUnitRepository docUnitRepository,
this.imageMetadataValuesRepository = imageMetadataValuesRepository;
this.transactionService = transactionService;
this.websocketService = websocketService;
+ this.docUnitService = docUnitService;
}
@PostConstruct
@@ -494,14 +498,10 @@ public void delete(final String identifier) {
importedDocUnitRepository.deleteByIds(ids);
return true;
}).process();
- LOG.debug("Suppression des unités documentaires liées au rapport d'import {}", identifier);
- new TransactionalJobRunner<>(docUnitIds, transactionService).setCommit(BATCH_SIZE).forEachGroup(BATCH_SIZE, ids -> {
- docUnitRepository.setParentNullByParentIdIn(ids);
- return true;
- }).process();
- new TransactionalJobRunner<>(docUnitIds, transactionService).setCommit(BATCH_SIZE).forEachGroup(BATCH_SIZE, ids -> {
- final List docUnits = docUnitRepository.findByIdentifierIn(ids);
- docUnitRepository.deleteAll(docUnits);
+
+ // Supression du docunit préchargé
+ new TransactionalJobRunner<>(docUnitIds, transactionService).setCommit(BATCH_SIZE).forEachGroup(BATCH_SIZE, id -> {
+ docUnitService.delete(id);
return true;
}).process();
@@ -510,15 +510,6 @@ public void delete(final String identifier) {
importReportRepository.deleteById(identifier);
}
- /**
- * Suppression de tous les imports d'une bibliothèque
- *
- * @param identifier
- */
- public void deleteByLibrary(final String identifier) {
- importReportRepository.findByLibraryIdentifier(identifier).forEach(report -> delete(report.getIdentifier()));
- }
-
@Transactional
public void setLotNull(final List lotIds) {
importReportRepository.setLotNullByLotIdIn(lotIds);
diff --git a/src/main/java/fr/progilone/pgcn/service/exchange/digitallibrary/DigitalLibraryDiffusionService.java b/src/main/java/fr/progilone/pgcn/service/exchange/digitallibrary/DigitalLibraryDiffusionService.java
index 3d0e2fef..dd83c50a 100644
--- a/src/main/java/fr/progilone/pgcn/service/exchange/digitallibrary/DigitalLibraryDiffusionService.java
+++ b/src/main/java/fr/progilone/pgcn/service/exchange/digitallibrary/DigitalLibraryDiffusionService.java
@@ -73,10 +73,11 @@ public class DigitalLibraryDiffusionService {
private static final String ALTO_DIR = "-alto";
private static final String JPG_DIR = "-jpg";
private static final String PDF_DIR = "-pdf";
+ private static final String MASTER_DIR = "-master";
private static final String MEDIA_HEADER = "media";
private static final String ALTO_HEADER = "alto";
private static final String PDF_HEADER = "pdf";
-
+ private static final String MASTER_HEADER = "master";
private final DocUnitService docUnitService;
private final DigitalLibraryConfigurationService digitalLibraryConfigurationService;
private final WorkflowService workflowService;
@@ -350,6 +351,9 @@ private File createDocUnitsDigitalLibraryDiffusionCsv(final DocUnit docUnit,
if (conf.isExportPdf()) {
writer.append(buildExportRelativePath(pgcnId, PDF_DIR, conf));
}
+ if (conf.isExportMaster()) {
+ writer.append(buildExportRelativePath(pgcnId, MASTER_DIR, conf));
+ }
final List entetesDC = docPropertyTypeService.findAllBySuperType(DocPropertyType.DocPropertySuperType.DC)
.stream()
@@ -452,6 +456,9 @@ private void initializeCsvFile(final File csvFile, final DigitalLibraryConfigura
if (conf.isExportPdf()) {
writer.append(MEDIA_HEADER).append(CSV_COL_SEP);
}
+ if (conf.isExportMaster()) {
+ writer.append(MASTER_HEADER).append(CSV_COL_SEP);
+ }
// Entête Dublin Core
final List entetesDC = docPropertyTypeService.findAllBySuperType(DocPropertyType.DocPropertySuperType.DC)
@@ -501,6 +508,9 @@ private Path createDirectories(final Path root, final String pgcnId, final Digit
if (conf.isExportAlto()) {
Files.createDirectory(depotPath.resolve(pgcnId.concat(ALTO_DIR)));
}
+ if (conf.isExportMaster()) {
+ Files.createDirectory(depotPath.resolve(pgcnId.concat(MASTER_DIR)));
+ }
}
return depotPath;
}
@@ -519,9 +529,12 @@ private boolean hasMultipleExports(final DigitalLibraryConfiguration conf) {
: 0;
int exportAlto = conf.isExportAlto() ? 1
: 0;
+ int exportMaster = conf.isExportMaster() ? 1
+ : 0;
return exportPrint + exportPdf
- + exportAlto > 1;
+ + exportAlto
+ + exportMaster > 1;
}
/**
@@ -579,28 +592,50 @@ private List addDepotFiles(final DocUnit docUnit, final P
final Path depotPrint = resolveExportDepotPath(depotPath, pgcnId.concat(JPG_DIR), conf);
final Path depotPdf = resolveExportDepotPath(depotPath, pgcnId.concat(PDF_DIR), conf);
+ final Path depotMaster = resolveExportDepotPath(depotPath, pgcnId.concat(MASTER_DIR), conf);
docUnit.getDigitalDocuments().forEach(digitalDoc -> digitalDoc.getOrderedPages().forEach(page -> {
// Si page standard (non pdfs)
if (page.getNumber() != null && page.getNumber() != 0) {
- // Par défaut, export du format PRINT
- final Optional print = page.getDerivedForFormat(ViewsFormatConfiguration.FileFormat.PRINT);
-
- if (print.isPresent()) {
- final StoredFile printStoredFile = print.get();
- final File sourceFile = bm.getFileForStoredFile(printStoredFile, libraryId);
- final Path sourcePath = Paths.get(sourceFile.getAbsolutePath());
- final String fileName = printStoredFile.getFilename().substring(0, printStoredFile.getFilename().lastIndexOf(".") + 1) + ImageUtils.FORMAT_JPG;
-
- if (conf.isExportPrint() && page.getNumber() != null) {
- try {
- final Path destPath = Files.createFile(depotPrint.resolve(fileName));
- Files.copy(sourcePath, destPath, StandardCopyOption.REPLACE_EXISTING);
+ if (conf.isExportPrint()) {
+ // Par défaut, export du format PRINT
+ final Optional print = page.getDerivedForFormat(ViewsFormatConfiguration.FileFormat.PRINT);
+
+ if (print.isPresent()) {
+ final StoredFile printStoredFile = print.get();
+ final File sourceFile = bm.getFileForStoredFile(printStoredFile, libraryId);
+ final Path sourcePath = Paths.get(sourceFile.getAbsolutePath());
+ final String fileName = printStoredFile.getFilename().substring(0, printStoredFile.getFilename().lastIndexOf(".") + 1) + ImageUtils.FORMAT_JPG;
+
+ if (conf.isExportPrint() && page.getNumber() != null) {
+ try {
+ final Path destPath = Files.createFile(depotPrint.resolve(fileName));
+ Files.copy(sourcePath, destPath, StandardCopyOption.REPLACE_EXISTING);
+ // On remplit la map pour optimiser le traitement ultérieur des métadonnées
+ checkSums.add(exportMetsService.getCheckSummedStoredFile(printStoredFile, sourceFile));
+ } catch (final IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+ }
+ }
+
+ if (conf.isExportMaster()) {
+ try {
+ // On récupère le master
+ final Optional master = page.getMaster();
+
+ if (master.isPresent()) {
+ final StoredFile masterStoredFile = master.get();
+ final File masterSourceFile = bm.getFileForStoredFile(masterStoredFile, libraryId);
+ final Path masterSourcePath = Paths.get(masterSourceFile.getAbsolutePath());
+ final Path destPath = Files.createFile(depotMaster.resolve(masterStoredFile.getFilename()));
+ Files.copy(masterSourcePath, destPath, StandardCopyOption.REPLACE_EXISTING);
// On remplit la map pour optimiser le traitement ultérieur des métadonnées
- checkSums.add(exportMetsService.getCheckSummedStoredFile(printStoredFile, sourceFile));
- } catch (final IOException e) {
- throw new UncheckedIOException(e);
+ checkSums.add(exportMetsService.getCheckSummedStoredFile(masterStoredFile, masterSourceFile));
}
+ } catch (final IOException e) {
+ throw new UncheckedIOException(e);
}
}
} else if (conf.isExportPdf()) {
@@ -638,6 +673,7 @@ private List addDepotFiles(final DocUnit docUnit, final P
throw new UncheckedIOException(e);
}
}
+
return checkSums;
}
diff --git a/src/main/java/fr/progilone/pgcn/service/library/LibraryService.java b/src/main/java/fr/progilone/pgcn/service/library/LibraryService.java
index 6e6713e7..302919c0 100644
--- a/src/main/java/fr/progilone/pgcn/service/library/LibraryService.java
+++ b/src/main/java/fr/progilone/pgcn/service/library/LibraryService.java
@@ -16,6 +16,7 @@
import fr.progilone.pgcn.repository.document.BibliographicRecordRepository;
import fr.progilone.pgcn.repository.document.DocUnitRepository;
import fr.progilone.pgcn.repository.document.conditionreport.PropertyConfigurationRepository;
+import fr.progilone.pgcn.repository.exchange.ImportReportRepository;
import fr.progilone.pgcn.repository.library.LibraryParameterRepository;
import fr.progilone.pgcn.repository.library.LibraryRepository;
import fr.progilone.pgcn.repository.project.ProjectRepository;
@@ -23,7 +24,6 @@
import fr.progilone.pgcn.repository.workflow.WorkflowGroupRepository;
import fr.progilone.pgcn.repository.workflow.WorkflowModelRepository;
import fr.progilone.pgcn.service.exchange.CSVMappingService;
-import fr.progilone.pgcn.service.exchange.ImportReportService;
import fr.progilone.pgcn.service.exchange.MappingService;
import fr.progilone.pgcn.service.exchange.template.TemplateService;
import fr.progilone.pgcn.service.ocrlangconfiguration.mapper.OcrLanguageMapper;
@@ -58,7 +58,7 @@ public class LibraryService {
private final CSVMappingService csvMappingService;
private final DocUnitRepository docUnitRepository;
private final FileStorageManager fm;
- private final ImportReportService importReportService;
+ private final ImportReportRepository importReportRepository;
private final LibraryRepository libraryRepository;
private final LibraryParameterRepository libraryParameterRepository;
private final MailboxConfigurationRepository mailboxConfigurationRepository;
@@ -80,7 +80,7 @@ public LibraryService(final BibliographicRecordRepository bibliographicRecordRep
final CSVMappingService csvMappingService,
final DocUnitRepository docUnitRepository,
final FileStorageManager fm,
- final ImportReportService importReportService,
+ final ImportReportRepository importReportRepository,
final LibraryRepository libraryRepository,
final LibraryParameterRepository libraryParameterRepository,
final MailboxConfigurationRepository mailboxConfigurationRepository,
@@ -97,7 +97,7 @@ public LibraryService(final BibliographicRecordRepository bibliographicRecordRep
this.csvMappingService = csvMappingService;
this.docUnitRepository = docUnitRepository;
this.fm = fm;
- this.importReportService = importReportService;
+ this.importReportRepository = importReportRepository;
this.libraryRepository = libraryRepository;
this.libraryParameterRepository = libraryParameterRepository;
this.mailboxConfigurationRepository = mailboxConfigurationRepository;
@@ -160,7 +160,7 @@ public void delete(final String identifier) throws PgcnValidationException {
projectRepository.save(project);
}
// Imports
- importReportService.deleteByLibrary(identifier);
+ importReportRepository.findByLibraryIdentifier(identifier).forEach(report -> delete(report.getIdentifier()));
// Templates
templateService.deleteByLibrary(library);
// Pptés des constats d'état
diff --git a/src/main/resources/config/liquibase/changelog/db-changelog-conf-digital-library-04.xml b/src/main/resources/config/liquibase/changelog/db-changelog-conf-digital-library-04.xml
new file mode 100644
index 00000000..798f15c4
--- /dev/null
+++ b/src/main/resources/config/liquibase/changelog/db-changelog-conf-digital-library-04.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml
index c5b054bf..108d0141 100644
--- a/src/main/resources/config/liquibase/master.xml
+++ b/src/main/resources/config/liquibase/master.xml
@@ -262,6 +262,7 @@
+
diff --git a/src/main/webapp/scripts/app/document/allOperations/workflowAllOperationsCtrl.js b/src/main/webapp/scripts/app/document/allOperations/workflowAllOperationsCtrl.js
index d3b73480..c76c8bd4 100644
--- a/src/main/webapp/scripts/app/document/allOperations/workflowAllOperationsCtrl.js
+++ b/src/main/webapp/scripts/app/document/allOperations/workflowAllOperationsCtrl.js
@@ -98,7 +98,7 @@
lot: workflowCtrl.lot.identifier,
};
$location.path('/delivery/delivery').search(params);
- } else if (state.key === 'CONTROLE_QUALITE_EN_COURS') {
+ } else if (state.key === 'CONTROLE_QUALITE_EN_COURS' || state.key === 'VALIDATION_DOCUMENT') {
params = {
radical: workflowCtrl.radical,
};
diff --git a/src/main/webapp/scripts/app/platformconfiguration/digitallibraryconfiguration/digitalLibraryConfigurationEdit.html b/src/main/webapp/scripts/app/platformconfiguration/digitallibraryconfiguration/digitalLibraryConfigurationEdit.html
index 41f7bd92..aae15f94 100644
--- a/src/main/webapp/scripts/app/platformconfiguration/digitallibraryconfiguration/digitalLibraryConfigurationEdit.html
+++ b/src/main/webapp/scripts/app/platformconfiguration/digitallibraryconfiguration/digitalLibraryConfigurationEdit.html
@@ -158,7 +158,9 @@ Fiche
-
+
+
+
diff --git a/src/test/java/fr/progilone/pgcn/service/exchange/DeduplicationServiceTest.java b/src/test/java/fr/progilone/pgcn/service/exchange/DeduplicationServiceTest.java
index 316bb821..cc8fa461 100644
--- a/src/test/java/fr/progilone/pgcn/service/exchange/DeduplicationServiceTest.java
+++ b/src/test/java/fr/progilone/pgcn/service/exchange/DeduplicationServiceTest.java
@@ -9,9 +9,7 @@
import fr.progilone.pgcn.domain.document.DocPropertyType;
import fr.progilone.pgcn.domain.document.DocUnit;
import fr.progilone.pgcn.repository.document.DocUnitRepository;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
+import java.util.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -52,8 +50,11 @@ public void testLookupDuplicates() {
final DocUnit duplDocUnit2 = new DocUnit();
duplDocUnit2.setIdentifier("30e62d6b-cfd2-4c02-80e6-879a2aa1ad31");
- when(docUnitRepository.getOneByPgcnIdAndState(docUnit.getPgcnId(), DocUnit.State.AVAILABLE)).thenReturn(duplDocUnit);
- when(docUnitRepository.searchDuplicates(eq(docUnit), any(), eq(DocUnit.State.AVAILABLE))).thenReturn(Collections.singletonList(duplDocUnit2));
+ final List duplicates = new ArrayList<>();
+ duplicates.add(duplDocUnit);
+
+ when(docUnitRepository.findAllByPgcnId(docUnit.getPgcnId())).thenReturn(duplicates);
+ when(docUnitRepository.searchDuplicates(eq(docUnit), any())).thenReturn(Collections.singletonList(duplDocUnit2));
final Collection actual = service.lookupDuplicates(docUnit);
diff --git a/src/test/java/fr/progilone/pgcn/service/exchange/ImportReportServiceTest.java b/src/test/java/fr/progilone/pgcn/service/exchange/ImportReportServiceTest.java
index cde16b56..504eb9a0 100644
--- a/src/test/java/fr/progilone/pgcn/service/exchange/ImportReportServiceTest.java
+++ b/src/test/java/fr/progilone/pgcn/service/exchange/ImportReportServiceTest.java
@@ -17,6 +17,7 @@
import fr.progilone.pgcn.repository.exchange.ImportReportRepository;
import fr.progilone.pgcn.repository.exchange.ImportedDocUnitRepository;
import fr.progilone.pgcn.repository.imagemetadata.ImageMetadataValuesRepository;
+import fr.progilone.pgcn.service.document.DocUnitService;
import fr.progilone.pgcn.service.storage.FileStorageManager;
import fr.progilone.pgcn.service.util.transaction.TransactionService;
import fr.progilone.pgcn.web.websocket.WebsocketService;
@@ -52,6 +53,9 @@ public class ImportReportServiceTest {
@Mock
private ImageMetadataValuesRepository imageMetadataValuesRepository;
+ @Mock
+ private DocUnitService docUnitService;
+
private ImportReportService service;
@BeforeEach
@@ -63,7 +67,8 @@ public void setUp() {
transactionService,
websocketService,
conditionReportRepository,
- imageMetadataValuesRepository);
+ imageMetadataValuesRepository,
+ docUnitService);
final CustomUserDetails customUserDetails = new CustomUserDetails(null, "tortor", null, null, null, null, false, User.Category.OTHER);
final TestingAuthenticationToken authenticationToken = new TestingAuthenticationToken(customUserDetails,