Merge branch 'RED-9255-bp' into 'release/2.465.x'
Resolve RED-9255 "Bp" See merge request redactmanager/persistence-service!612
This commit is contained in:
commit
29d2a911c6
@ -1,5 +1,6 @@
|
|||||||
package com.iqser.red.persistence.service.v1.external.api.impl.controller;
|
package com.iqser.red.persistence.service.v1.external.api.impl.controller;
|
||||||
|
|
||||||
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.IMPORT_FILES;
|
||||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.USE_SUPPORT_CONTROLLER;
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.USE_SUPPORT_CONTROLLER;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -23,6 +24,8 @@ import com.iqser.red.service.persistence.management.v1.processor.service.FileSta
|
|||||||
import com.iqser.red.service.persistence.management.v1.processor.service.FileStatusMapper;
|
import com.iqser.red.service.persistence.management.v1.processor.service.FileStatusMapper;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.ReanalysisService;
|
import com.iqser.red.service.persistence.management.v1.processor.service.ReanalysisService;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.dataexchange.service.FileExchangeExportService;
|
import com.iqser.red.service.persistence.management.v1.processor.dataexchange.service.FileExchangeExportService;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.DossierTemplateModel;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.ImportResponse;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.ReanalysisSettings;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.ReanalysisSettings;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.external.resource.SupportResource;
|
import com.iqser.red.service.persistence.service.v1.api.external.resource.SupportResource;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.DownloadResponse;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.DownloadResponse;
|
||||||
@ -132,7 +135,8 @@ public class SupportController implements SupportResource {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void importFiles(MultipartFile file) {
|
@PreAuthorize("hasAuthority('" + IMPORT_FILES + "')")
|
||||||
|
public ImportResponse importFiles(MultipartFile file) {
|
||||||
|
|
||||||
byte[] bytes;
|
byte[] bytes;
|
||||||
try {
|
try {
|
||||||
@ -140,7 +144,7 @@ public class SupportController implements SupportResource {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new BadRequestException("File could not be read and is likely corrupted.", e);
|
throw new BadRequestException("File could not be read and is likely corrupted.", e);
|
||||||
}
|
}
|
||||||
fileExchangeImportService.importFileExchangeArchive(KeycloakSecurity.getUserId(), bytes);
|
return fileExchangeImportService.importFileExchangeArchive(KeycloakSecurity.getUserId(), bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,11 +13,12 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.ReanalysisSettings;
|
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.DownloadResponse;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.DownloadResponse;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileExchangeExportRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileStatus;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileStatus;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileStatusFilter;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileStatusFilter;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileExchangeExportRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.ImportResponse;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.ReanalysisSettings;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -140,11 +141,11 @@ public interface SupportResource {
|
|||||||
DownloadResponse exportFiles(@PathVariable(DOSSIER_TEMPLATE_ID) String dossierTemplateId, @RequestBody FileExchangeExportRequest exportRequest);
|
DownloadResponse exportFiles(@PathVariable(DOSSIER_TEMPLATE_ID) String dossierTemplateId, @RequestBody FileExchangeExportRequest exportRequest);
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
@PostMapping(value = FILE_EXCHANGE_REST_PATH + IMPORT, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = FILE_EXCHANGE_REST_PATH + IMPORT, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Imports a file exchange export zip.", description = "Use this endpoint to import a full export of a given Dossier Template including all its configurations, dossiers, and files.")
|
@Operation(summary = "Imports a file exchange export zip.", description = "Use this endpoint to import a full export of a given Dossier Template including all its configurations, dossiers, and files. Returns the resulting dossierTemplateId.")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
||||||
void importFiles(@Schema(type = "string", format = "binary", name = "file") @RequestPart(name = "file") MultipartFile file);
|
ImportResponse importFiles(@Schema(type = "string", format = "binary", name = "file") @RequestPart(name = "file") MultipartFile file);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import java.util.stream.Collectors;
|
|||||||
import org.springframework.security.access.prepost.PostFilter;
|
import org.springframework.security.access.prepost.PostFilter;
|
||||||
import org.springframework.security.acls.domain.ObjectIdentityImpl;
|
import org.springframework.security.acls.domain.ObjectIdentityImpl;
|
||||||
import org.springframework.security.acls.domain.PrincipalSid;
|
import org.springframework.security.acls.domain.PrincipalSid;
|
||||||
|
import org.springframework.security.acls.model.MutableAcl;
|
||||||
import org.springframework.security.acls.model.MutableAclService;
|
import org.springframework.security.acls.model.MutableAclService;
|
||||||
import org.springframework.security.acls.model.NotFoundException;
|
import org.springframework.security.acls.model.NotFoundException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -110,7 +111,7 @@ public class DossierACLService extends AbstractACLService<String> {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public void updateDossierACL(Set<String> members, Set<String> approvers, String owner, String dossierId) {
|
public void updateDossierACL(Set<String> members, Set<String> approvers, String owner, String dossierId) {
|
||||||
|
|
||||||
var acl = getOrCreateACL(dossierId);
|
MutableAcl acl = getOrCreateACL(dossierId);
|
||||||
|
|
||||||
// naive clear all ace's first
|
// naive clear all ace's first
|
||||||
while (!acl.getEntries().isEmpty()) {
|
while (!acl.getEntries().isEmpty()) {
|
||||||
|
|||||||
@ -14,7 +14,6 @@ import com.iqser.red.service.persistence.management.v1.processor.service.Dossier
|
|||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.CreateOrUpdateDossierRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.CreateOrUpdateDossierRequest;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.Dossier;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.Dossier;
|
||||||
|
|
||||||
import io.micrometer.observation.ObservationRegistry;
|
|
||||||
import io.micrometer.observation.annotation.Observed;
|
import io.micrometer.observation.annotation.Observed;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -30,7 +29,6 @@ public class DossierImportService {
|
|||||||
DossierCreatorService dossierCreatorService;
|
DossierCreatorService dossierCreatorService;
|
||||||
FileImportService fileImportService;
|
FileImportService fileImportService;
|
||||||
EntityTypeImportService entityTypeImportService;
|
EntityTypeImportService entityTypeImportService;
|
||||||
ObservationRegistry registry;
|
|
||||||
|
|
||||||
|
|
||||||
@Observed(name = "DossierImportService", contextualName = "import-dossier")
|
@Observed(name = "DossierImportService", contextualName = "import-dossier")
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import com.iqser.red.service.persistence.management.v1.processor.dataexchange.mo
|
|||||||
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.ReportTemplateEntity;
|
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.ReportTemplateEntity;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.exception.BadRequestException;
|
import com.iqser.red.service.persistence.management.v1.processor.exception.BadRequestException;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.ReportTemplatePersistenceService;
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.ReportTemplatePersistenceService;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.ImportResponse;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.Dossier;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.Dossier;
|
||||||
|
|
||||||
import io.micrometer.observation.ObservationRegistry;
|
import io.micrometer.observation.ObservationRegistry;
|
||||||
@ -34,7 +35,7 @@ public class FileExchangeImportService {
|
|||||||
|
|
||||||
|
|
||||||
@Observed(name = "FileExchangeImportService", contextualName = "import-files")
|
@Observed(name = "FileExchangeImportService", contextualName = "import-files")
|
||||||
public String importFileExchangeArchive(String userId, byte[] archive) {
|
public ImportResponse importFileExchangeArchive(String userId, byte[] archive) {
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
log.info("Starting file import for user {}", userId);
|
log.info("Starting file import for user {}", userId);
|
||||||
@ -49,7 +50,7 @@ public class FileExchangeImportService {
|
|||||||
|
|
||||||
enrichObservation(userId, archive, fileExchangeImportModel);
|
enrichObservation(userId, archive, fileExchangeImportModel);
|
||||||
|
|
||||||
return dossierTemplateId;
|
return new ImportResponse(dossierTemplateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -24,18 +24,20 @@ import lombok.experimental.FieldDefaults;
|
|||||||
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
|
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
|
||||||
public class FileImportPersistenceService {
|
public class FileImportPersistenceService {
|
||||||
|
|
||||||
|
|
||||||
ManualChangesImportService manualChangesImportService;
|
ManualChangesImportService manualChangesImportService;
|
||||||
FileRepository fileRepository;
|
FileRepository fileRepository;
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Observed(name = "FileImportPersistenceService", contextualName = "import-file-to-db")
|
@Observed(name = "FileImportPersistenceService", contextualName = "import-file-to-db")
|
||||||
public synchronized String saveFileToDb(String userId, FileExchangeImportModel.FileImport file, String dossierId, TemplateImportInfo templateImportInfo) { // synchronized as this is being called in an async block. Might lock up DB otherwise.
|
public synchronized String saveFileToDb(String userId,
|
||||||
|
FileExchangeImportModel.FileImport file,
|
||||||
|
String dossierId,
|
||||||
|
TemplateImportInfo templateImportInfo) { // synchronized as this is being called in an async block. Might lock up DB otherwise.
|
||||||
|
|
||||||
String fileId = createFile(dossierId, userId, file, templateImportInfo.getIdMapping());
|
String fileId = createFile(dossierId, userId, file, templateImportInfo.getIdMapping());
|
||||||
|
|
||||||
manualChangesImportService.importManualChanges(file.getManualChanges(), fileId);
|
manualChangesImportService.importManualChanges(file.getManualChanges(), fileId, userId);
|
||||||
|
|
||||||
return fileId;
|
return fileId;
|
||||||
}
|
}
|
||||||
@ -49,6 +51,11 @@ public class FileImportPersistenceService {
|
|||||||
|
|
||||||
FileEntity fileEntity = MagicConverter.convert(fileModel, FileEntity.class, new FileEntityMapper(fileAttributeConfigMap));
|
FileEntity fileEntity = MagicConverter.convert(fileModel, FileEntity.class, new FileEntityMapper(fileAttributeConfigMap));
|
||||||
|
|
||||||
|
fileEntity.setAssignee(userid);
|
||||||
|
fileEntity.setLastReviewer(userid);
|
||||||
|
fileEntity.setLastApprover(userid);
|
||||||
|
fileEntity.setUploader(userid);
|
||||||
|
|
||||||
fileEntity.setDossierId(dossierId);
|
fileEntity.setDossierId(dossierId);
|
||||||
|
|
||||||
fileRepository.save(fileEntity);
|
fileRepository.save(fileEntity);
|
||||||
|
|||||||
@ -38,38 +38,38 @@ public class ManualChangesImportService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Observed(name = "ManualChangesImportService", contextualName = "import-manual-changes")
|
@Observed(name = "ManualChangesImportService", contextualName = "import-manual-changes")
|
||||||
public void importManualChanges(ManualChangesExportModel exportModel, String fileId) {
|
public void importManualChanges(ManualChangesExportModel exportModel, String fileId, String userId) {
|
||||||
|
|
||||||
FileEntity fileEntity = fileRepository.findById(fileId)
|
FileEntity fileEntity = fileRepository.findById(fileId)
|
||||||
.orElseThrow();
|
.orElseThrow();
|
||||||
exportModel.getManualAddExportModels()
|
exportModel.getManualAddExportModels()
|
||||||
.stream()
|
.stream()
|
||||||
.map(model -> mapper.toEntity(model, fileEntity))
|
.map(model -> mapper.toEntity(model, fileEntity, userId))
|
||||||
.forEach(manualRedactionRepository::saveAndFlush);
|
.forEach(manualRedactionRepository::saveAndFlush);
|
||||||
|
|
||||||
exportModel.getManualForceExportModels()
|
exportModel.getManualForceExportModels()
|
||||||
.stream()
|
.stream()
|
||||||
.map(model -> mapper.toEntity(model, fileEntity))
|
.map(model -> mapper.toEntity(model, fileEntity, userId))
|
||||||
.forEach(forceRedactionRepository::saveAndFlush);
|
.forEach(forceRedactionRepository::saveAndFlush);
|
||||||
|
|
||||||
exportModel.getManualRecategorizationExportModels()
|
exportModel.getManualRecategorizationExportModels()
|
||||||
.stream()
|
.stream()
|
||||||
.map(model -> mapper.toEntity(model, fileEntity))
|
.map(model -> mapper.toEntity(model, fileEntity, userId))
|
||||||
.forEach(recategorizationRepository::saveAndFlush);
|
.forEach(recategorizationRepository::saveAndFlush);
|
||||||
|
|
||||||
exportModel.getManualRemoveExportModels()
|
exportModel.getManualRemoveExportModels()
|
||||||
.stream()
|
.stream()
|
||||||
.map(model -> mapper.toEntity(model, fileEntity))
|
.map(model -> mapper.toEntity(model, fileEntity, userId))
|
||||||
.forEach(removeRedactionRepository::saveAndFlush);
|
.forEach(removeRedactionRepository::saveAndFlush);
|
||||||
|
|
||||||
exportModel.getManualResizeExportModels()
|
exportModel.getManualResizeExportModels()
|
||||||
.stream()
|
.stream()
|
||||||
.map(model -> mapper.toEntity(model, fileEntity))
|
.map(model -> mapper.toEntity(model, fileEntity, userId))
|
||||||
.forEach(resizeRedactionRepository::saveAndFlush);
|
.forEach(resizeRedactionRepository::saveAndFlush);
|
||||||
|
|
||||||
exportModel.getManualLegalBasisChangeExportModels()
|
exportModel.getManualLegalBasisChangeExportModels()
|
||||||
.stream()
|
.stream()
|
||||||
.map(model -> mapper.toEntity(model, fileEntity))
|
.map(model -> mapper.toEntity(model, fileEntity, userId))
|
||||||
.forEach(legalBasisChangeRepository::saveAndFlush);
|
.forEach(legalBasisChangeRepository::saveAndFlush);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,79 +53,85 @@ public interface ManualChangesExportMapper {
|
|||||||
ManualResizeExportModel toModel(ManualResizeRedactionEntity entity);
|
ManualResizeExportModel toModel(ManualResizeRedactionEntity entity);
|
||||||
|
|
||||||
|
|
||||||
ManualLegalBasisChangeEntity toEntity(ManualLegalBasisChangeExportModel model, @Context FileEntity file);
|
ManualLegalBasisChangeEntity toEntity(ManualLegalBasisChangeExportModel model, @Context FileEntity file, @Context String userId);
|
||||||
|
|
||||||
|
|
||||||
ManualForceRedactionEntity toEntity(ManualForceExportModel model, @Context FileEntity file);
|
ManualForceRedactionEntity toEntity(ManualForceExportModel model, @Context FileEntity file, @Context String userId);
|
||||||
|
|
||||||
|
|
||||||
ManualRedactionEntryEntity toEntity(ManualAddExportModel model, @Context FileEntity file);
|
ManualRedactionEntryEntity toEntity(ManualAddExportModel model, @Context FileEntity file, @Context String userId);
|
||||||
|
|
||||||
|
|
||||||
IdRemovalEntity toEntity(ManualRemoveExportModel model, @Context FileEntity file);
|
IdRemovalEntity toEntity(ManualRemoveExportModel model, @Context FileEntity file, @Context String userId);
|
||||||
|
|
||||||
|
|
||||||
ManualRecategorizationEntity toEntity(ManualRecategorizationExportModel model, @Context FileEntity file);
|
ManualRecategorizationEntity toEntity(ManualRecategorizationExportModel model, @Context FileEntity file, @Context String userId);
|
||||||
|
|
||||||
|
|
||||||
ManualResizeRedactionEntity toEntity(ManualResizeExportModel model, @Context FileEntity file);
|
ManualResizeRedactionEntity toEntity(ManualResizeExportModel model, @Context FileEntity file, @Context String userId);
|
||||||
|
|
||||||
|
|
||||||
@AfterMapping
|
@AfterMapping
|
||||||
default void setFileStatusAndId(ManualLegalBasisChangeExportModel model,
|
default void setFileStatusAndId(ManualLegalBasisChangeExportModel model,
|
||||||
@MappingTarget ManualLegalBasisChangeEntity.ManualLegalBasisChangeEntityBuilder entity,
|
@MappingTarget ManualLegalBasisChangeEntity.ManualLegalBasisChangeEntityBuilder entity,
|
||||||
@Context FileEntity file) {
|
@Context FileEntity file, @Context String userId) {
|
||||||
|
|
||||||
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
||||||
entity.id(annotationEntityId);
|
entity.id(annotationEntityId);
|
||||||
entity.fileStatus(file);
|
entity.fileStatus(file);
|
||||||
|
entity.user(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@AfterMapping
|
@AfterMapping
|
||||||
default void setFileStatusAndId(ManualRecategorizationExportModel model,
|
default void setFileStatusAndId(ManualRecategorizationExportModel model,
|
||||||
@MappingTarget ManualRecategorizationEntity.ManualRecategorizationEntityBuilder entity,
|
@MappingTarget ManualRecategorizationEntity.ManualRecategorizationEntityBuilder entity,
|
||||||
@Context FileEntity file) {
|
@Context FileEntity file, @Context String userId) {
|
||||||
|
|
||||||
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
||||||
entity.id(annotationEntityId);
|
entity.id(annotationEntityId);
|
||||||
entity.fileStatus(file);
|
entity.fileStatus(file);
|
||||||
|
entity.user(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@AfterMapping
|
@AfterMapping
|
||||||
default void setFileStatusAndId(ManualAddExportModel model, @MappingTarget ManualRedactionEntryEntity.ManualRedactionEntryEntityBuilder entity, @Context FileEntity file) {
|
default void setFileStatusAndId(ManualAddExportModel model, @MappingTarget ManualRedactionEntryEntity.ManualRedactionEntryEntityBuilder entity, @Context FileEntity file, @Context String userId) {
|
||||||
|
|
||||||
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
||||||
entity.id(annotationEntityId);
|
entity.id(annotationEntityId);
|
||||||
entity.fileStatus(file);
|
entity.fileStatus(file);
|
||||||
|
entity.user(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@AfterMapping
|
@AfterMapping
|
||||||
default void setFileStatusAndId(ManualResizeExportModel model, @MappingTarget ManualResizeRedactionEntity.ManualResizeRedactionEntityBuilder entity, @Context FileEntity file) {
|
default void setFileStatusAndId(ManualResizeExportModel model, @MappingTarget ManualResizeRedactionEntity.ManualResizeRedactionEntityBuilder entity, @Context FileEntity file, @Context String userId) {
|
||||||
|
|
||||||
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
||||||
entity.id(annotationEntityId);
|
entity.id(annotationEntityId);
|
||||||
entity.fileStatus(file);
|
entity.fileStatus(file);
|
||||||
|
entity.user(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@AfterMapping
|
@AfterMapping
|
||||||
default void setFileStatusAndId(ManualForceExportModel model, @MappingTarget ManualForceRedactionEntity.ManualForceRedactionEntityBuilder entity, @Context FileEntity file) {
|
default void setFileStatusAndId(ManualForceExportModel model, @MappingTarget ManualForceRedactionEntity.ManualForceRedactionEntityBuilder entity, @Context FileEntity file, @Context String userId) {
|
||||||
|
|
||||||
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
||||||
entity.id(annotationEntityId);
|
entity.id(annotationEntityId);
|
||||||
entity.fileStatus(file);
|
entity.fileStatus(file);
|
||||||
|
entity.user(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@AfterMapping
|
@AfterMapping
|
||||||
default void setFileStatusAndId(ManualRemoveExportModel model, @MappingTarget IdRemovalEntity.IdRemovalEntityBuilder entity, @Context FileEntity file) {
|
default void setFileStatusAndId(ManualRemoveExportModel model, @MappingTarget IdRemovalEntity.IdRemovalEntityBuilder entity, @Context FileEntity file, @Context String userId) {
|
||||||
|
|
||||||
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
AnnotationEntityId annotationEntityId = new AnnotationEntityId(model.getAnnotationId(), file.getId());
|
||||||
entity.id(annotationEntityId);
|
entity.id(annotationEntityId);
|
||||||
entity.fileStatus(file);
|
entity.fileStatus(file);
|
||||||
|
entity.user(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -174,8 +174,7 @@ public final class ActionRoles {
|
|||||||
public static final String DEPLOYMENT_INFO = "red-deployment-info";
|
public static final String DEPLOYMENT_INFO = "red-deployment-info";
|
||||||
|
|
||||||
public static final String USE_SUPPORT_CONTROLLER = "red-use-support-controller";
|
public static final String USE_SUPPORT_CONTROLLER = "red-use-support-controller";
|
||||||
|
public static final String IMPORT_FILES = "red-import-files";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ActionRoles() {}
|
private ActionRoles() {}
|
||||||
|
|||||||
@ -33,6 +33,7 @@ import static com.iqser.red.service.persistence.management.v1.processor.roles.Ac
|
|||||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.GET_REPORT_TEMPLATES;
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.GET_REPORT_TEMPLATES;
|
||||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.GET_RSS;
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.GET_RSS;
|
||||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.GET_TENANTS;
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.GET_TENANTS;
|
||||||
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.IMPORT_FILES;
|
||||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.MANAGE_ACL_PERMISSIONS;
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.MANAGE_ACL_PERMISSIONS;
|
||||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.MANAGE_USER_PREFERENCES;
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.MANAGE_USER_PREFERENCES;
|
||||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.MANAGE_VIEWED_PAGES;
|
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.MANAGE_VIEWED_PAGES;
|
||||||
@ -116,12 +117,19 @@ public final class ApplicationRoles {
|
|||||||
|
|
||||||
public static final Set<String> UNMAPPED_ACTION_ROLES = Sets.newHashSet(UNARCHIVE_DOSSIER, UPDATE_LICENSE, GET_RSS, USE_SUPPORT_CONTROLLER);
|
public static final Set<String> UNMAPPED_ACTION_ROLES = Sets.newHashSet(UNARCHIVE_DOSSIER, UPDATE_LICENSE, GET_RSS, USE_SUPPORT_CONTROLLER);
|
||||||
|
|
||||||
public static final Set<String> KNECON_ADMIN_ACTION_ROLES = Sets.newHashSet(READ_LICENSE, UPDATE_LICENSE, GET_TENANTS, CREATE_TENANT, READ_USERS, READ_ALL_USERS, WRITE_USERS,
|
public static final Set<String> KNECON_SUPPORT_ACTION_ROLES = Sets.newHashSet(READ_LICENSE,
|
||||||
READ_SMTP_CONFIGURATION,
|
UPDATE_LICENSE,
|
||||||
WRITE_SMTP_CONFIGURATION,
|
GET_TENANTS,
|
||||||
UNARCHIVE_DOSSIER,
|
CREATE_TENANT,
|
||||||
USE_SUPPORT_CONTROLLER);
|
READ_USERS,
|
||||||
public static final Set<String> KNECON_SUPPORT_ACTION_ROLES = Sets.newHashSet(KNECON_ADMIN_ACTION_ROLES);
|
READ_ALL_USERS,
|
||||||
|
WRITE_USERS,
|
||||||
|
READ_SMTP_CONFIGURATION,
|
||||||
|
WRITE_SMTP_CONFIGURATION,
|
||||||
|
UNARCHIVE_DOSSIER,
|
||||||
|
USE_SUPPORT_CONTROLLER);
|
||||||
|
|
||||||
|
public static final Set<String> KNECON_ADMIN_ACTION_ROLES = Sets.union(KNECON_SUPPORT_ACTION_ROLES, Sets.newHashSet(IMPORT_FILES));
|
||||||
|
|
||||||
public static final Set<String> RED_USER_ACTION_ROLES = Sets.newHashSet(ADD_COMMENT,
|
public static final Set<String> RED_USER_ACTION_ROLES = Sets.newHashSet(ADD_COMMENT,
|
||||||
READ_LICENSE,
|
READ_LICENSE,
|
||||||
|
|||||||
@ -91,7 +91,7 @@ public class FileExchangeImportExportTest extends AbstractPersistenceServerServi
|
|||||||
|
|
||||||
Path fileExchangeArchive = new ClassPathResource("files/fileexchange/EFSA sanitisation GFL v1_file-exchange.zip").getFile().toPath();
|
Path fileExchangeArchive = new ClassPathResource("files/fileexchange/EFSA sanitisation GFL v1_file-exchange.zip").getFile().toPath();
|
||||||
|
|
||||||
String importedDossierTemplateId = fileExchangeImportService.importFileExchangeArchive(USER_ID, Files.readAllBytes(fileExchangeArchive));
|
String importedDossierTemplateId = fileExchangeImportService.importFileExchangeArchive(USER_ID, Files.readAllBytes(fileExchangeArchive)).getDossierTemplateId();
|
||||||
|
|
||||||
fileExchangeExportService.createDownloadArchive(ExportDownloadMessage.builder()
|
fileExchangeExportService.createDownloadArchive(ExportDownloadMessage.builder()
|
||||||
.dossierTemplateId(importedDossierTemplateId)
|
.dossierTemplateId(importedDossierTemplateId)
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.iqser.red.service.persistence.service.v1.api.shared.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ImportResponse {
|
||||||
|
|
||||||
|
String dossierTemplateId;
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user