reformat #369
@ -3,7 +3,6 @@ package com.iqser.red.persistence.service.v1.external.api.impl;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
public class PersistenceServiceExternalApiConfiguration {
|
||||
|
||||
@ -3,7 +3,6 @@ package com.iqser.red.persistence.service.v1.external.api.impl.controller;
|
||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.READ_APP_CONFIG;
|
||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.WRITE_APP_CONFIG;
|
||||
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -31,7 +30,7 @@ public class ApplicationConfigurationController implements ApplicationConfigurat
|
||||
public ApplicationConfig createOrUpdateAppConfig(@Valid @RequestBody ApplicationConfig appConfig) {
|
||||
|
||||
return MagicConverter.convert(applicationConfigService.saveApplicationConfiguration(MagicConverter.convert(appConfig, ApplicationConfigurationEntity.class)),
|
||||
ApplicationConfig.class);
|
||||
ApplicationConfig.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -36,11 +36,11 @@ public class AuditController implements AuditResource {
|
||||
|
||||
var auditModels = convert(auditPersistenceService.search(auditSearchRequest), AuditModel.class);
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(auditSearchRequest.getObjectId())
|
||||
.category(AuditCategory.AUDIT.name())
|
||||
.message("Audit Log has been viewed.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(auditSearchRequest.getObjectId())
|
||||
.category(AuditCategory.AUDIT.name())
|
||||
.message("Audit Log has been viewed.")
|
||||
.build());
|
||||
|
||||
return new AuditResponse(auditModels.getElements(), auditModels.getTotalHits(), auditModels.getPage(), auditModels.getPageSize());
|
||||
}
|
||||
|
||||
@ -68,7 +68,8 @@ public class ComponentLogController implements ComponentLogResource {
|
||||
|
||||
componentOverrideService.addOverrides(dossierId, fileId, componentsOverrides);
|
||||
|
||||
componentsOverrides.getComponentOverrides().forEach((componentName, overrideValue) -> auditOverride(dossierId, fileId, componentName, overrideValue, allComponents));
|
||||
componentsOverrides.getComponentOverrides()
|
||||
.forEach((componentName, overrideValue) -> auditOverride(dossierId, fileId, componentName, overrideValue, allComponents));
|
||||
}
|
||||
|
||||
|
||||
@ -95,63 +96,68 @@ public class ComponentLogController implements ComponentLogResource {
|
||||
|
||||
componentOverrideService.revertOverrides(dossierId, fileId, revertOverrideRequest);
|
||||
|
||||
revertOverrideRequest.getComponents().forEach(componentNameToRevert -> auditOverrideRevert(dossierId, fileId, componentNameToRevert, allComponents));
|
||||
revertOverrideRequest.getComponents()
|
||||
.forEach(componentNameToRevert -> auditOverrideRevert(dossierId, fileId, componentNameToRevert, allComponents));
|
||||
}
|
||||
|
||||
|
||||
private void auditOverride(String dossierId, String fileId, String componentName, String overrideValue, List<ComponentLogEntry> allComponentLogEntries) {
|
||||
|
||||
Optional<ComponentLogEntry> component = allComponentLogEntries.stream().filter(c -> c.getName().equals(componentName)).findFirst();
|
||||
Optional<ComponentLogEntry> component = allComponentLogEntries.stream()
|
||||
.filter(c -> c.getName().equals(componentName))
|
||||
.findFirst();
|
||||
String originalValue = getOriginalValue(component);
|
||||
String value = getValue(component);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component is overwritten with value")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
componentName,
|
||||
"Action",
|
||||
"MODIFY",
|
||||
"OriginalValue",
|
||||
originalValue,
|
||||
"OldValue",
|
||||
value,
|
||||
"NewValue",
|
||||
overrideValue))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component is overwritten with value")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
componentName,
|
||||
"Action",
|
||||
"MODIFY",
|
||||
"OriginalValue",
|
||||
originalValue,
|
||||
"OldValue",
|
||||
value,
|
||||
"NewValue",
|
||||
overrideValue))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
private void auditOverrideRevert(String dossierId, String fileId, String componentNameToRevert, List<ComponentLogEntry> allComponentLogEntries) {
|
||||
|
||||
Optional<ComponentLogEntry> component = allComponentLogEntries.stream().filter(c -> c.getName().equals(componentNameToRevert)).findFirst();
|
||||
Optional<ComponentLogEntry> component = allComponentLogEntries.stream()
|
||||
.filter(c -> c.getName().equals(componentNameToRevert))
|
||||
.findFirst();
|
||||
String originalValue = getOriginalValue(component);
|
||||
String value = getValue(component);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component override for was reverted")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
componentNameToRevert,
|
||||
"Action",
|
||||
"REVERT",
|
||||
"OriginalValue",
|
||||
originalValue,
|
||||
"OldValue",
|
||||
value,
|
||||
"NewValue",
|
||||
originalValue))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component override for was reverted")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
componentNameToRevert,
|
||||
"Action",
|
||||
"REVERT",
|
||||
"OriginalValue",
|
||||
originalValue,
|
||||
"OldValue",
|
||||
value,
|
||||
"NewValue",
|
||||
originalValue))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +165,9 @@ public class ComponentLogController implements ComponentLogResource {
|
||||
|
||||
return component.map(ComponentLogEntry::getComponentValues)
|
||||
.stream()
|
||||
.map(a -> a.stream().map(ComponentLogEntryValue::getValue).collect(Collectors.joining(", ")))
|
||||
.map(a -> a.stream()
|
||||
.map(ComponentLogEntryValue::getValue)
|
||||
.collect(Collectors.joining(", ")))
|
||||
.findFirst()
|
||||
.orElse("");
|
||||
}
|
||||
@ -169,7 +177,9 @@ public class ComponentLogController implements ComponentLogResource {
|
||||
|
||||
return component.map(ComponentLogEntry::getComponentValues)
|
||||
.stream()
|
||||
.map(a -> a.stream().map(ComponentLogEntryValue::getOriginalValue).collect(Collectors.joining(", ")))
|
||||
.map(a -> a.stream()
|
||||
.map(ComponentLogEntryValue::getOriginalValue)
|
||||
.collect(Collectors.joining(", ")))
|
||||
.findFirst()
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.iqser.red.persistence.service.v1.external.api.impl.controller;
|
||||
package com.iqser.red.persistence.service.v1.external.api.impl.controller;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
@ -10,7 +10,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@ -68,12 +67,12 @@ public class DictionaryController implements DictionaryResource {
|
||||
|
||||
addEntries(type, dossierTemplateId, entries, removeCurrent, dossierId, dictionaryEntryType);
|
||||
auditClient.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary entries were added.")
|
||||
.details(Map.of("Type", type, "Number", entries.size()))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary entries were added.")
|
||||
.details(Map.of("Type", type, "Number", entries.size()))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -98,12 +97,12 @@ public class DictionaryController implements DictionaryResource {
|
||||
|
||||
deleteEntries(type, dossierTemplateId, Arrays.asList(entry), dossierId, dictionaryEntryType);
|
||||
auditClient.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary entry was deleted.")
|
||||
.details(Map.of("Type", type, "Value", entry))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary entry was deleted.")
|
||||
.details(Map.of("Type", type, "Value", entry))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -122,12 +121,12 @@ public class DictionaryController implements DictionaryResource {
|
||||
}
|
||||
|
||||
auditClient.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary entries were deleted.")
|
||||
.details(Map.of("Type", type, "Number", entries.size()))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary entries were deleted.")
|
||||
.details(Map.of("Type", type, "Number", entries.size()))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -139,12 +138,12 @@ public class DictionaryController implements DictionaryResource {
|
||||
dictionaryService.updateGlobalType(type, dossierTemplateId, typeValue);
|
||||
|
||||
auditClient.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary type was updated.")
|
||||
.details(Map.of("Type", type))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary type was updated.")
|
||||
.details(Map.of("Type", type))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -154,36 +153,34 @@ public class DictionaryController implements DictionaryResource {
|
||||
Type result = dictionaryService.addGlobalType(typeValue);
|
||||
|
||||
auditClient.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(typeValue.getDossierTemplateId())
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary type was added.")
|
||||
.details(Map.of("Type", typeValue.getType()))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(typeValue.getDossierTemplateId())
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary type was added.")
|
||||
.details(Map.of("Type", typeValue.getType()))
|
||||
.build());
|
||||
|
||||
return MagicConverter.convert(result, TypeValue.class, new TypeValueMapper());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteType(@PathVariable(TYPE_PARAMETER_NAME) String type,
|
||||
@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId) {
|
||||
public void deleteType(@PathVariable(TYPE_PARAMETER_NAME) String type, @PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId) {
|
||||
|
||||
dictionaryService.deleteGlobalType(type, dossierTemplateId);
|
||||
|
||||
auditClient.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary type was deleted.")
|
||||
.details(Map.of("Type", type))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary type was deleted.")
|
||||
.details(Map.of("Type", type))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteTypes(@RequestBody List<String> types,
|
||||
@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId) {
|
||||
public void deleteTypes(@RequestBody List<String> types, @PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId) {
|
||||
|
||||
List<String> errorIds = new ArrayList<>();
|
||||
|
||||
@ -192,12 +189,12 @@ public class DictionaryController implements DictionaryResource {
|
||||
dictionaryService.deleteGlobalType(type, dossierTemplateId);
|
||||
|
||||
auditClient.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary type was deleted.")
|
||||
.details(Map.of("Type", type))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary type was deleted.")
|
||||
.details(Map.of("Type", type))
|
||||
.build());
|
||||
} catch (FeignException e) {
|
||||
errorIds.add(type);
|
||||
}
|
||||
@ -235,19 +232,25 @@ public class DictionaryController implements DictionaryResource {
|
||||
validateFile(file);
|
||||
|
||||
try {
|
||||
addEntries(type, dossierTemplateId, new String(file.getBytes(), StandardCharsets.UTF_8).lines().collect(Collectors.toList()), true, dossierId, dictionaryEntryType);
|
||||
addEntries(type,
|
||||
dossierTemplateId,
|
||||
new String(file.getBytes(), StandardCharsets.UTF_8).lines()
|
||||
.collect(Collectors.toList()),
|
||||
true,
|
||||
dossierId,
|
||||
dictionaryEntryType);
|
||||
} catch (IOException e) {
|
||||
log.debug(e.getMessage(), e);
|
||||
throw new BadRequestException("Could not upload file.", e);
|
||||
}
|
||||
|
||||
auditClient.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary has been uploaded.")
|
||||
.details(Map.of("Type", type))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DICTIONARY.name())
|
||||
.message("Dictionary has been uploaded.")
|
||||
.details(Map.of("Type", type))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -296,26 +299,27 @@ public class DictionaryController implements DictionaryResource {
|
||||
return dictionaryService.getDictionaryForType(type, dossierTemplateId, dossierId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Dictionary getMergedDictionaries(@PathVariable(TYPE_PARAMETER_NAME) String type,
|
||||
@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId,
|
||||
@RequestParam(value = DOSSIER_ID_PARAMETER_NAME) String dossierId) {
|
||||
@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId,
|
||||
@RequestParam(value = DOSSIER_ID_PARAMETER_NAME) String dossierId) {
|
||||
|
||||
return dictionaryService.getMergedDictionaryForType(type, dossierTemplateId, dossierId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setColors(@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId, @RequestBody Colors colors) {
|
||||
|
||||
dictionaryService.setColors(dossierTemplateId, colors);
|
||||
|
||||
auditClient.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Colors have been changed.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Colors have been changed.")
|
||||
.build());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -52,11 +52,11 @@ public class DigitalSignatureController implements DigitalSignatureResource {
|
||||
|
||||
digitalSignatureTypeService.setActiveDigitalSignatureType(digitalSignatureType);
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital signature type has been updated.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital signature type has been updated.")
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -66,11 +66,11 @@ public class DigitalSignatureController implements DigitalSignatureResource {
|
||||
|
||||
DigitalSignatureViewModel digitalSignatureViewModel = convertToView(digitalSignatureService.saveDigitalSignature(convert(digitalSignatureModel)));
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital signature has been saved.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital signature has been saved.")
|
||||
.build());
|
||||
return digitalSignatureViewModel;
|
||||
|
||||
}
|
||||
@ -82,11 +82,11 @@ public class DigitalSignatureController implements DigitalSignatureResource {
|
||||
|
||||
digitalSignatureService.updateDigitalSignature(convert(digitalSignatureModel));
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital signature has been updated.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital signature has been updated.")
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -104,11 +104,11 @@ public class DigitalSignatureController implements DigitalSignatureResource {
|
||||
|
||||
digitalSignatureService.deleteDigitalSignature();
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital signature has been deleted.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital signature has been deleted.")
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -118,11 +118,11 @@ public class DigitalSignatureController implements DigitalSignatureResource {
|
||||
|
||||
DigitalSignatureKmsViewModel result = convert(digitalSignatureKmsService.saveDigitalSignature(digitalSignature));
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital KMS signature has been saved.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital KMS signature has been saved.")
|
||||
.build());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -141,11 +141,11 @@ public class DigitalSignatureController implements DigitalSignatureResource {
|
||||
|
||||
digitalSignatureKmsService.deleteDigitalSignature();
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital KMS signature has been deleted.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(DIGITAL_SIGNATURE_AUDIT_ID)
|
||||
.category(AuditCategory.SETTINGS.name())
|
||||
.message("Digital KMS signature has been deleted.")
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -50,13 +50,15 @@ public class DossierAttributesController implements DossierAttributesResource {
|
||||
public DossierAttributesConfig setDossierAttributesConfig(String dossierTemplateId, DossierAttributesConfig dossierAttributesConfig) {
|
||||
|
||||
var result = MagicConverter.convert(dossierAttributeConfigPersistenceService.setDossierAttributesConfig(dossierTemplateId,
|
||||
MagicConverter.convert(dossierAttributesConfig.getDossierAttributeConfigs(), DossierAttributeConfigEntity.class)), DossierAttributeConfig.class);
|
||||
MagicConverter.convert(dossierAttributesConfig.getDossierAttributeConfigs(),
|
||||
DossierAttributeConfigEntity.class)),
|
||||
DossierAttributeConfig.class);
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Changed dossier attributes base configuration.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Changed dossier attributes base configuration.")
|
||||
.build());
|
||||
return new DossierAttributesConfig(result);
|
||||
|
||||
}
|
||||
@ -68,13 +70,15 @@ public class DossierAttributesController implements DossierAttributesResource {
|
||||
@RequestBody DossierAttributeConfig dossierAttribute) {
|
||||
|
||||
var result = MagicConverter.convert(dossierAttributeConfigPersistenceService.addOrUpdateDossierAttribute(dossierTemplateId,
|
||||
MagicConverter.convert(dossierAttribute, DossierAttributeConfigEntity.class)), DossierAttributeConfig.class);
|
||||
MagicConverter.convert(dossierAttribute,
|
||||
DossierAttributeConfigEntity.class)),
|
||||
DossierAttributeConfig.class);
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier attributes added/updated")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier attributes added/updated")
|
||||
.build());
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -86,12 +90,12 @@ public class DossierAttributesController implements DossierAttributesResource {
|
||||
|
||||
dossierAttributeConfigPersistenceService.deleteDossierAttribute(dossierAttributeId);
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier attributes removed")
|
||||
.details(Map.of("DossierAttributeId", dossierAttributeId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier attributes removed")
|
||||
.details(Map.of("DossierAttributeId", dossierAttributeId))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -101,12 +105,12 @@ public class DossierAttributesController implements DossierAttributesResource {
|
||||
|
||||
dossierAttributeConfigPersistenceService.deleteDossierAttributes(dossierAttributeIds);
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier attributes removed")
|
||||
.details(Map.of("DossierAttributeId", dossierAttributeIds))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier attributes removed")
|
||||
.details(Map.of("DossierAttributeId", dossierAttributeIds))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -125,11 +129,11 @@ public class DossierAttributesController implements DossierAttributesResource {
|
||||
accessControlService.verifyUserIsDossierOwner(dossierId);
|
||||
var result = dossierAttributesManagementService.setDossierAttributes(dossierId, dossierAttributes.getDossierAttributeList());
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Changed dossier attributes.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Changed dossier attributes.")
|
||||
.build());
|
||||
return new DossierAttributes(result);
|
||||
|
||||
}
|
||||
@ -142,11 +146,11 @@ public class DossierAttributesController implements DossierAttributesResource {
|
||||
accessControlService.verifyUserIsDossierOwner(dossierId);
|
||||
DossierAttribute result = dossierAttributesManagementService.addOrUpdateDossierAttribute(dossierId, dossierAttribute);
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Added or updated dossier attributes.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Added or updated dossier attributes.")
|
||||
.build());
|
||||
return new DossierAttributes(List.of(result)); // TODO should be single Object???
|
||||
}
|
||||
|
||||
@ -162,11 +166,11 @@ public class DossierAttributesController implements DossierAttributesResource {
|
||||
result = dossierAttributesManagementService.getDossierAttributes(dossierId);
|
||||
}
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Got dossier attributes.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Got dossier attributes.")
|
||||
.build());
|
||||
return new DossierAttributes(result);
|
||||
|
||||
}
|
||||
@ -179,11 +183,11 @@ public class DossierAttributesController implements DossierAttributesResource {
|
||||
accessControlService.verifyUserIsDossierOwner(dossierId);
|
||||
dossierAttributesManagementService.deleteDossierAttribute(dossierId, dossierAttributeId);
|
||||
auditPersistenceService.insertRecord(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Changed dossier attributes.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Changed dossier attributes.")
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -112,8 +112,8 @@ public class DossierController implements DossierResource {
|
||||
Set<String> approvers = getAndValidateMembers(ownerId, dossierRequest.getApproverIds());
|
||||
members.addAll(approvers);
|
||||
|
||||
if ((dossierRequest.getDownloadFileTypes() == null || dossierRequest.getDownloadFileTypes()
|
||||
.isEmpty()) && (dossierRequest.getReportTemplateIds() == null || dossierRequest.getReportTemplateIds().isEmpty())) {
|
||||
if ((dossierRequest.getDownloadFileTypes() == null || dossierRequest.getDownloadFileTypes().isEmpty()) && (dossierRequest.getReportTemplateIds() == null
|
||||
|| dossierRequest.getReportTemplateIds().isEmpty())) {
|
||||
throw new BadRequestException("Download and report types cannot both be empty");
|
||||
}
|
||||
|
||||
@ -128,16 +128,16 @@ public class DossierController implements DossierResource {
|
||||
|
||||
// update using data from request and computed owner/members/approvers
|
||||
Dossier updatedDossier = dossierManagementService.updateDossier(CreateOrUpdateDossierRequest.builder()
|
||||
.dossierName(dossierRequest.getDossierName())
|
||||
.description(dossierRequest.getDescription())
|
||||
.dossierTemplateId(dossierRequest.getDossierTemplateId())
|
||||
.downloadFileTypes(dossierRequest.getDownloadFileTypes())
|
||||
.dueDate(dossierRequest.getDueDate())
|
||||
.reportTemplateIds(new ArrayList<>(dossierRequest.getReportTemplateIds()))
|
||||
.watermarkId(dossierRequest.getWatermarkId())
|
||||
.previewWatermarkId(dossierRequest.getPreviewWatermarkId())
|
||||
.dossierStatusId(dossierRequest.getDossierStatusId())
|
||||
.build(), existingDossier.getId());
|
||||
.dossierName(dossierRequest.getDossierName())
|
||||
.description(dossierRequest.getDescription())
|
||||
.dossierTemplateId(dossierRequest.getDossierTemplateId())
|
||||
.downloadFileTypes(dossierRequest.getDownloadFileTypes())
|
||||
.dueDate(dossierRequest.getDueDate())
|
||||
.reportTemplateIds(new ArrayList<>(dossierRequest.getReportTemplateIds()))
|
||||
.watermarkId(dossierRequest.getWatermarkId())
|
||||
.previewWatermarkId(dossierRequest.getPreviewWatermarkId())
|
||||
.dossierStatusId(dossierRequest.getDossierStatusId())
|
||||
.build(), existingDossier.getId());
|
||||
|
||||
dossierACLService.updateDossierACL(members, approvers, ownerId, updatedDossier.getId());
|
||||
dossierACLService.enhanceDossierWithACLData(updatedDossier);
|
||||
@ -145,28 +145,28 @@ public class DossierController implements DossierResource {
|
||||
updateFileStatusForDossierFiles(updatedDossier.getId(), members);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(updatedDossier.getId())
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier has been updated.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(updatedDossier.getId())
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier has been updated.")
|
||||
.build());
|
||||
|
||||
if (existingDossier.getOwnerId() == null || !existingDossier.getOwnerId().equals(ownerId)) {
|
||||
if (ownerId != null && !ownerId.equals(KeycloakSecurity.getUserId())) {
|
||||
notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(ownerId)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.DOSSIER_OWNER_SET.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build());
|
||||
.userId(ownerId)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.DOSSIER_OWNER_SET.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build());
|
||||
}
|
||||
if (existingDossier.getOwnerId() != null && !existingDossier.getOwnerId().equals(KeycloakSecurity.getUserId())) {
|
||||
notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(existingDossier.getOwnerId())
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.DOSSIER_OWNER_REMOVED.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build());
|
||||
.userId(existingDossier.getOwnerId())
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.DOSSIER_OWNER_REMOVED.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,46 +174,48 @@ public class DossierController implements DossierResource {
|
||||
uniqueMembers.addAll(approvers);
|
||||
|
||||
uniqueMembers.stream()
|
||||
.filter(member -> !member.equals(ownerId) && !member.equals(KeycloakSecurity.getUserId()) && (existingDossier.getMemberIds() == null || !existingDossier.getMemberIds()
|
||||
.contains(member)))
|
||||
.filter(member -> !member.equals(ownerId) && !member.equals(KeycloakSecurity.getUserId()) && (existingDossier.getMemberIds() == null
|
||||
|| !existingDossier.getMemberIds().contains(member)))
|
||||
.forEach(member -> notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(member)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.USER_BECOMES_DOSSIER_MEMBER.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build()));
|
||||
.userId(member)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.USER_BECOMES_DOSSIER_MEMBER.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build()));
|
||||
|
||||
if (existingDossier.getMemberIds() != null) {
|
||||
existingDossier.getMemberIds()
|
||||
.stream()
|
||||
.filter(member -> !members.contains(member) && !approvers.contains(member) && !member.equals(KeycloakSecurity.getUserId()))
|
||||
.forEach(member -> notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(member)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.USER_REMOVED_AS_DOSSIER_MEMBER.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build()));
|
||||
.userId(member)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.USER_REMOVED_AS_DOSSIER_MEMBER.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build()));
|
||||
}
|
||||
|
||||
approvers.stream()
|
||||
.filter(approver -> !KeycloakSecurity.getUserId().equals(approver) && existingDossier.getMemberIds() != null && existingDossier.getMemberIds()
|
||||
.contains(approver) && (existingDossier.getApproverIds() == null || !existingDossier.getApproverIds().contains(approver)))
|
||||
.forEach(approver -> notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(approver)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.USER_PROMOTED_TO_APPROVER.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build()));
|
||||
.userId(approver)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.USER_PROMOTED_TO_APPROVER.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build()));
|
||||
|
||||
members.stream()
|
||||
.filter(member -> !member.equals(KeycloakSecurity.getUserId()) && existingDossier.getApproverIds() != null && existingDossier.getApproverIds()
|
||||
.contains(member) && !approvers.contains(member))
|
||||
.filter(member -> !member.equals(KeycloakSecurity.getUserId())
|
||||
&& existingDossier.getApproverIds() != null
|
||||
&& existingDossier.getApproverIds().contains(member)
|
||||
&& !approvers.contains(member))
|
||||
.forEach(member -> notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(member)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.USER_DEGRADED_TO_REVIEWER.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build()));
|
||||
.userId(member)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.USER_DEGRADED_TO_REVIEWER.name())
|
||||
.target(Map.of("dossierId", dossierRequest.getDossierId()))
|
||||
.build()));
|
||||
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
@ -223,11 +225,11 @@ public class DossierController implements DossierResource {
|
||||
Dossier created = createNewDossier(dossierRequest, ownerId, members, approvers);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(created.getId())
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier has been created.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(created.getId())
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier has been created.")
|
||||
.build());
|
||||
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
@ -254,7 +256,9 @@ public class DossierController implements DossierResource {
|
||||
}
|
||||
|
||||
// check he has a manager role, thus he can be the owner
|
||||
if (user.isPresent() && user.get().getRoles().stream().noneMatch(ApplicationRoles.RED_MANAGER_ROLE::equals)) {
|
||||
if (user.isPresent() && user.get().getRoles()
|
||||
.stream()
|
||||
.noneMatch(ApplicationRoles.RED_MANAGER_ROLE::equals)) {
|
||||
throw new BadRequestException("Make sure provided user id has the manager role.");
|
||||
}
|
||||
|
||||
@ -266,7 +270,8 @@ public class DossierController implements DossierResource {
|
||||
private Set<String> getAndValidateMembers(String ownerId, Set<String> memberIds) {
|
||||
|
||||
Set<String> actualMemberIds = memberIds == null ? new TreeSet<>() : memberIds;
|
||||
if (actualMemberIds.stream().anyMatch(Objects::isNull)) {
|
||||
if (actualMemberIds.stream()
|
||||
.anyMatch(Objects::isNull)) {
|
||||
throw new BadRequestException("Member IDs cannot be null");
|
||||
}
|
||||
|
||||
@ -280,7 +285,10 @@ public class DossierController implements DossierResource {
|
||||
Set<String> deletedUserIds = userService.removeDeletedUsers(actualMemberIds);
|
||||
actualMemberIds.removeAll(deletedUserIds);
|
||||
}
|
||||
if (users.stream().anyMatch(u -> u.getRoles().stream().noneMatch(VALID_MEMBER_ROLES::contains))) {
|
||||
if (users.stream()
|
||||
.anyMatch(u -> u.getRoles()
|
||||
.stream()
|
||||
.noneMatch(VALID_MEMBER_ROLES::contains))) {
|
||||
throw new BadRequestException("Make sure each provided member id has the permission to be a member of a dossier.");
|
||||
}
|
||||
return actualMemberIds;
|
||||
@ -299,12 +307,15 @@ public class DossierController implements DossierResource {
|
||||
|
||||
private void updateFileStatusForDossierFiles(String dossierId, Collection<String> members) {
|
||||
|
||||
fileStatusManagementService.getDossierStatus(dossierId).stream().filter(fileStatus -> !fileStatus.isSoftOrHardDeleted()).forEach(f -> {
|
||||
fileStatusManagementService.getDossierStatus(dossierId)
|
||||
.stream()
|
||||
.filter(fileStatus -> !fileStatus.isSoftOrHardDeleted())
|
||||
.forEach(f -> {
|
||||
|
||||
if (f.getAssignee() != null && !members.contains(f.getAssignee())) {
|
||||
fileStatusManagementService.setCurrentFileAssignee(dossierId, f.getId(), null);
|
||||
}
|
||||
});
|
||||
if (f.getAssignee() != null && !members.contains(f.getAssignee())) {
|
||||
fileStatusManagementService.setCurrentFileAssignee(dossierId, f.getId(), null);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -312,16 +323,17 @@ public class DossierController implements DossierResource {
|
||||
private Dossier createNewDossier(DossierRequest dossier, String ownerId, Set<String> members, Set<String> approvers) {
|
||||
|
||||
Dossier newDossier = dossierCreatorService.addDossier(CreateOrUpdateDossierRequest.builder()
|
||||
.dossierName(dossier.getDossierName().trim())
|
||||
.description(dossier.getDescription())
|
||||
.dossierTemplateId(dossier.getDossierTemplateId())
|
||||
.downloadFileTypes(dossier.getDownloadFileTypes())
|
||||
.dueDate(dossier.getDueDate())
|
||||
.reportTemplateIds(dossier.getReportTemplateIds() != null ? new ArrayList<>(dossier.getReportTemplateIds()) : Lists.newArrayList())
|
||||
.watermarkId(dossier.getWatermarkId())
|
||||
.previewWatermarkId(dossier.getPreviewWatermarkId())
|
||||
.dossierStatusId(dossier.getDossierStatusId())
|
||||
.build(), members, approvers, ownerId);
|
||||
.dossierName(dossier.getDossierName().trim())
|
||||
.description(dossier.getDescription())
|
||||
.dossierTemplateId(dossier.getDossierTemplateId())
|
||||
.downloadFileTypes(dossier.getDownloadFileTypes())
|
||||
.dueDate(dossier.getDueDate())
|
||||
.reportTemplateIds(dossier.getReportTemplateIds()
|
||||
!= null ? new ArrayList<>(dossier.getReportTemplateIds()) : Lists.newArrayList())
|
||||
.watermarkId(dossier.getWatermarkId())
|
||||
.previewWatermarkId(dossier.getPreviewWatermarkId())
|
||||
.dossierStatusId(dossier.getDossierStatusId())
|
||||
.build(), members, approvers, ownerId);
|
||||
|
||||
dossierACLService.enhanceDossierWithACLData(newDossier);
|
||||
|
||||
@ -358,21 +370,21 @@ public class DossierController implements DossierResource {
|
||||
dossierManagementService.delete(dossierId);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier moved to trash.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier moved to trash.")
|
||||
.build());
|
||||
|
||||
dossier.getMemberIds()
|
||||
.stream()
|
||||
.filter(m -> !KeycloakSecurity.getUserId().equals(m))
|
||||
.forEach(member -> notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(member)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.DOSSIER_DELETED.name())
|
||||
.target(Map.of("dossierId", dossierId, "dossierName", dossier.getDossierName()))
|
||||
.build()));
|
||||
.userId(member)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.DOSSIER_DELETED.name())
|
||||
.target(Map.of("dossierId", dossierId, "dossierName", dossier.getDossierName()))
|
||||
.build()));
|
||||
|
||||
}
|
||||
|
||||
@ -393,7 +405,10 @@ public class DossierController implements DossierResource {
|
||||
public List<Dossier> getDossiers(@RequestParam(name = INCLUDE_ARCHIVED_PARAM, defaultValue = "false", required = false) boolean includeArchived,
|
||||
@RequestParam(name = INCLUDE_DELETED_PARAM, defaultValue = "false", required = false) boolean includeDeleted) {
|
||||
|
||||
return dossierManagementService.getAllDossiers(includeArchived, includeDeleted).stream().map(dossierACLService::enhanceDossierWithACLData).collect(Collectors.toList());
|
||||
return dossierManagementService.getAllDossiers(includeArchived, includeDeleted)
|
||||
.stream()
|
||||
.map(dossierACLService::enhanceDossierWithACLData)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@ -414,7 +429,10 @@ public class DossierController implements DossierResource {
|
||||
@PostFilter("hasPermission(filterObject.id, 'Dossier', 'VIEW_OBJECT')")
|
||||
public List<Dossier> getSoftDeletedDossiers() {
|
||||
|
||||
return dossierManagementService.getSoftDeletedDossiers().stream().map(dossierACLService::enhanceDossierWithACLData).collect(Collectors.toList());
|
||||
return dossierManagementService.getSoftDeletedDossiers()
|
||||
.stream()
|
||||
.map(dossierACLService::enhanceDossierWithACLData)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
@ -423,7 +441,10 @@ public class DossierController implements DossierResource {
|
||||
@PostFilter("hasPermission(filterObject.id, 'Dossier', 'VIEW_OBJECT')")
|
||||
public List<Dossier> getArchivedDossiers() {
|
||||
|
||||
return dossierManagementService.getArchivedDossiers().stream().map(dossierACLService::enhanceDossierWithACLData).collect(Collectors.toList());
|
||||
return dossierManagementService.getArchivedDossiers()
|
||||
.stream()
|
||||
.map(dossierACLService::enhanceDossierWithACLData)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@ -449,11 +470,11 @@ public class DossierController implements DossierResource {
|
||||
|
||||
for (String dossierId : dossierIds) {
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier archived.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier archived.")
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
@ -466,11 +487,11 @@ public class DossierController implements DossierResource {
|
||||
|
||||
for (String dossierId : dossierIds) {
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier restored from archive.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier restored from archive.")
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,11 +507,11 @@ public class DossierController implements DossierResource {
|
||||
for (String dossierId : filteredDossierIds) {
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier permanently deleted.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier permanently deleted.")
|
||||
.build());
|
||||
|
||||
}
|
||||
}
|
||||
@ -506,11 +527,11 @@ public class DossierController implements DossierResource {
|
||||
|
||||
for (String dossierId : filteredDossierIds) {
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier restored from trash.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Dossier restored from trash.")
|
||||
.build());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,9 @@ public class DossierStatsController implements DossierStatsResource {
|
||||
@PreFilter("hasPermission(filterObject, 'Dossier', 'VIEW_OBJECT')")
|
||||
public List<DossierStats> getDossierStats(@RequestBody Set<String> dossierIds) {
|
||||
|
||||
return dossierIds.stream().map(dossierStatsService::getDossierStats).collect(Collectors.toList());
|
||||
return dossierIds.stream()
|
||||
.map(dossierStatsService::getDossierStats)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -50,13 +50,13 @@ public class DossierStatusController implements DossierStatusResource {
|
||||
throw new BadRequestException("The rank must not be negative");
|
||||
}
|
||||
var response = dossierStatusPersistenceService.createOrUpdateDossierStatus(CreateOrUpdateDossierStatusRequest.builder()
|
||||
.dossierStatusId(dossierStatusRequest.getDossierStatusId())
|
||||
.name(dossierStatusRequest.getName())
|
||||
.description(dossierStatusRequest.getDescription())
|
||||
.dossierTemplateId(dossierStatusRequest.getDossierTemplateId())
|
||||
.rank(dossierStatusRequest.getRank())
|
||||
.color(dossierStatusRequest.getColor())
|
||||
.build());
|
||||
.dossierStatusId(dossierStatusRequest.getDossierStatusId())
|
||||
.name(dossierStatusRequest.getName())
|
||||
.description(dossierStatusRequest.getDescription())
|
||||
.dossierTemplateId(dossierStatusRequest.getDossierTemplateId())
|
||||
.rank(dossierStatusRequest.getRank())
|
||||
.color(dossierStatusRequest.getColor())
|
||||
.build());
|
||||
return MagicConverter.convert(response, DossierStatusInfo.class);
|
||||
}
|
||||
|
||||
@ -94,8 +94,4 @@ public class DossierStatusController implements DossierStatusResource {
|
||||
dossierStatusPersistenceService.deleteDossierStatus(dossierStatusId, replaceDossierStatusId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -77,11 +77,11 @@ public class DossierTemplateController implements DossierTemplateResource {
|
||||
DossierTemplateModel response = convert(dossierTemplateManagementService.createOrUpdateDossierTemplate(dossierTemplate));
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(response.getDossierTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier Template has been added or updated")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(response.getDossierTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier Template has been added or updated")
|
||||
.build());
|
||||
return response;
|
||||
} catch (FeignException e) {
|
||||
throw processFeignException(e);
|
||||
@ -94,7 +94,10 @@ public class DossierTemplateController implements DossierTemplateResource {
|
||||
@PreAuthorize("hasAuthority('" + READ_DOSSIER_TEMPLATES + "')")
|
||||
public List<DossierTemplateModel> getAllDossierTemplates() {
|
||||
|
||||
return dossierTemplateManagementService.getAllDossierTemplates().stream().map(this::convert).collect(Collectors.toList());
|
||||
return dossierTemplateManagementService.getAllDossierTemplates()
|
||||
.stream()
|
||||
.map(this::convert)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@ -117,17 +120,18 @@ public class DossierTemplateController implements DossierTemplateResource {
|
||||
String userId = KeycloakSecurity.getUserId();
|
||||
|
||||
List<Dossier> dossiers = dossierManagementService.getAllDossiers(true, false);
|
||||
if (dossiers != null && dossiers.stream().anyMatch(dossier -> dossier.getDossierTemplateId().equals(dossierTemplateId))) {
|
||||
if (dossiers != null && dossiers.stream()
|
||||
.anyMatch(dossier -> dossier.getDossierTemplateId().equals(dossierTemplateId))) {
|
||||
throw new ConflictException("Can not delete dossier template because there are dossiers based on it");
|
||||
}
|
||||
|
||||
dossierTemplateManagementService.deleteDossierTemplate(dossierTemplateId, userId);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier Template has been deleted")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier Template has been deleted")
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -141,17 +145,18 @@ public class DossierTemplateController implements DossierTemplateResource {
|
||||
for (String dossierTemplateId : dossierTemplateIds) {
|
||||
try {
|
||||
List<Dossier> dossiers = dossierManagementService.getAllDossiers(true, false);
|
||||
if (dossiers != null && dossiers.stream().anyMatch(dossier -> dossier.getDossierTemplateId().equals(dossierTemplateId))) {
|
||||
if (dossiers != null && dossiers.stream()
|
||||
.anyMatch(dossier -> dossier.getDossierTemplateId().equals(dossierTemplateId))) {
|
||||
throw new ConflictException("Can not delete dossier template because there are dossiers based on it");
|
||||
}
|
||||
|
||||
dossierTemplateManagementService.deleteDossierTemplate(dossierTemplateId, userId);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier template has been deleted")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier template has been deleted")
|
||||
.build());
|
||||
} catch (FeignException e) {
|
||||
errorIds.add(dossierTemplateId);
|
||||
}
|
||||
@ -174,11 +179,11 @@ public class DossierTemplateController implements DossierTemplateResource {
|
||||
|
||||
DossierTemplateModel response = convert(dossierTemplateManagementService.cloneDossierTemplate(dossierTemplateId, cloneDossierTemplateRequest));
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(userId)
|
||||
.objectId(response.getDossierTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier Template has been cloned")
|
||||
.build());
|
||||
.userId(userId)
|
||||
.objectId(response.getDossierTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier Template has been cloned")
|
||||
.build());
|
||||
return response;
|
||||
} catch (FeignException e) {
|
||||
throw processFeignException(e);
|
||||
@ -221,12 +226,12 @@ public class DossierTemplateController implements DossierTemplateResource {
|
||||
ExportDownloadRequest request = ExportDownloadRequest.builder().dossierTemplateId(dossierTemplateId).userId(KeycloakSecurity.getUserId()).build();
|
||||
var response = dossierTemplateManagementService.prepareExportDownload(request);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(response.getValue())
|
||||
.category(AuditCategory.DOWNLOAD.name())
|
||||
.message("Export Download was prepared")
|
||||
.details(Map.of("dossierTemplateId", request.getDossierTemplateId()))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(response.getValue())
|
||||
.category(AuditCategory.DOWNLOAD.name())
|
||||
.message("Export Download was prepared")
|
||||
.details(Map.of("dossierTemplateId", request.getDossierTemplateId()))
|
||||
.build());
|
||||
return new DownloadResponse(response.getValue());
|
||||
} catch (FeignException e) {
|
||||
throw processFeignException(e);
|
||||
@ -262,12 +267,12 @@ public class DossierTemplateController implements DossierTemplateResource {
|
||||
.build();
|
||||
DossierTemplate loadedDossierTemplate = dossierTemplateManagementService.importDossierTemplate(request);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(loadedDossierTemplate.getId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier template was imported")
|
||||
.details(Map.of("dossierTemplateId", loadedDossierTemplate.getId()))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(loadedDossierTemplate.getId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Dossier template was imported")
|
||||
.details(Map.of("dossierTemplateId", loadedDossierTemplate.getId()))
|
||||
.build());
|
||||
return convert(loadedDossierTemplate);
|
||||
} catch (IOException e) {
|
||||
throw new BadRequestException(e.getMessage(), e);
|
||||
@ -283,7 +288,8 @@ public class DossierTemplateController implements DossierTemplateResource {
|
||||
private void enhanceDossierTemplateStatsWithACLMemberDetails(DossierTemplateStats stats) {
|
||||
|
||||
Set<String> members = new HashSet<>();
|
||||
stats.getDossiersInTemplate().forEach(d -> members.addAll(dossierACLService.getMembers(d)));
|
||||
stats.getDossiersInTemplate()
|
||||
.forEach(d -> members.addAll(dossierACLService.getMembers(d)));
|
||||
stats.setNumberOfPeople(members.size());
|
||||
}
|
||||
|
||||
|
||||
@ -127,12 +127,12 @@ public class DownloadController implements DownloadResource {
|
||||
|
||||
var response = downloadService.prepareDownload(convert(request));
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(response.getValue())
|
||||
.category(AuditCategory.DOWNLOAD.name())
|
||||
.message("Download was prepared")
|
||||
.details(Map.of("dossierId", request.getDossierId()))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(response.getValue())
|
||||
.category(AuditCategory.DOWNLOAD.name())
|
||||
.message("Download was prepared")
|
||||
.details(Map.of("dossierId", request.getDossierId()))
|
||||
.build());
|
||||
return new DownloadResponse(response.getValue());
|
||||
}
|
||||
|
||||
@ -152,23 +152,33 @@ public class DownloadController implements DownloadResource {
|
||||
List<FileModel> validFiles = fileStatusService.getDossierStatus(request.getDossierId());
|
||||
var fileIds = request.getFileIds();
|
||||
if (fileIds != null && !fileIds.isEmpty()) { // validate the ids provided
|
||||
validFiles = validFiles.stream().filter(f -> fileIds.contains(f.getId())).collect(Collectors.toList());
|
||||
validFiles = validFiles.stream()
|
||||
.filter(f -> fileIds.contains(f.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if (validFiles.isEmpty()) {
|
||||
throw new NotFoundException("No file id provided is found");
|
||||
}
|
||||
} // otherwise consider the files from dossier
|
||||
|
||||
var validFilesAndNotProcessed = validFiles.stream().filter(f -> !(f.getAnalysisVersion() > 0 && f.getNumberOfAnalyses() > 0)).collect(Collectors.toList());
|
||||
var validFilesAndNotProcessed = validFiles.stream()
|
||||
.filter(f -> !(f.getAnalysisVersion() > 0 && f.getNumberOfAnalyses() > 0))
|
||||
.collect(Collectors.toList());
|
||||
if (!validFilesAndNotProcessed.isEmpty()) {
|
||||
throw new BadRequestException("At least a file is in its initial analysis process");
|
||||
}
|
||||
|
||||
request.setFileIds(validFiles.stream().map(FileModel::getId).collect(Collectors.toList()));
|
||||
var approvedFiles = validFiles.stream().filter(f -> f.getWorkflowStatus().equals(WorkflowStatus.APPROVED)).toList();
|
||||
request.setFileIds(validFiles.stream()
|
||||
.map(FileModel::getId)
|
||||
.collect(Collectors.toList()));
|
||||
var approvedFiles = validFiles.stream()
|
||||
.filter(f -> f.getWorkflowStatus().equals(WorkflowStatus.APPROVED))
|
||||
.toList();
|
||||
// special corner case: unapproved files, no reports and only REDACTED type selected
|
||||
if (approvedFiles.isEmpty() && (request.getReportTemplateIds() == null || request.getReportTemplateIds()
|
||||
.isEmpty()) && request.getDownloadFileTypes() != null && request.getDownloadFileTypes().size() == 1 && request.getDownloadFileTypes()
|
||||
.contains(DownloadFileType.REDACTED)) {
|
||||
if (approvedFiles.isEmpty()
|
||||
&& (request.getReportTemplateIds() == null || request.getReportTemplateIds().isEmpty())
|
||||
&& request.getDownloadFileTypes() != null
|
||||
&& request.getDownloadFileTypes().size() == 1
|
||||
&& request.getDownloadFileTypes().contains(DownloadFileType.REDACTED)) {
|
||||
throw new BadRequestException("Unapproved files in redacted state with no reports cannot be included");
|
||||
}
|
||||
}
|
||||
@ -192,28 +202,29 @@ public class DownloadController implements DownloadResource {
|
||||
@PreAuthorize("hasAuthority('" + PROCESS_DOWNLOAD + "')")
|
||||
public void deleteDownloadStatus(@RequestBody RemoveDownloadRequest removeDownloadRequest) {
|
||||
|
||||
removeDownloadRequest.getStorageIds().forEach(storageId -> {
|
||||
downloadService.deleteDownloadStatus(JSONPrimitive.of(storageId));
|
||||
removeDownloadRequest.getStorageIds()
|
||||
.forEach(storageId -> {
|
||||
downloadService.deleteDownloadStatus(JSONPrimitive.of(storageId));
|
||||
|
||||
fileManagementStorageService.deleteObject(storageId);
|
||||
fileManagementStorageService.deleteObject(storageId);
|
||||
|
||||
if (storageBackend.equals("s3")) {
|
||||
var storageIdForS3 = generateReportJsonStorageIdForS3(storageId);
|
||||
log.info("Deleting Report Json from S3 Storage {}", storageIdForS3);
|
||||
fileManagementStorageService.deleteObject(storageIdForS3);
|
||||
} else {
|
||||
var storageIdForAzure = generateReportJsonStorageIdForAzure(storageId);
|
||||
log.info("Deleting Report Json from Azure Storage {}", storageIdForAzure);
|
||||
fileManagementStorageService.deleteObject(storageIdForAzure);
|
||||
}
|
||||
if (storageBackend.equals("s3")) {
|
||||
var storageIdForS3 = generateReportJsonStorageIdForS3(storageId);
|
||||
log.info("Deleting Report Json from S3 Storage {}", storageIdForS3);
|
||||
fileManagementStorageService.deleteObject(storageIdForS3);
|
||||
} else {
|
||||
var storageIdForAzure = generateReportJsonStorageIdForAzure(storageId);
|
||||
log.info("Deleting Report Json from Azure Storage {}", storageIdForAzure);
|
||||
fileManagementStorageService.deleteObject(storageIdForAzure);
|
||||
}
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(storageId)
|
||||
.category(AuditCategory.DOWNLOAD.name())
|
||||
.message("Remove Prepared Download")
|
||||
.build());
|
||||
});
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(storageId)
|
||||
.category(AuditCategory.DOWNLOAD.name())
|
||||
.message("Remove Prepared Download")
|
||||
.build());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -249,7 +260,9 @@ public class DownloadController implements DownloadResource {
|
||||
private DownloadStatus getDownloadStatus(String storageId, String userId) {
|
||||
// TODO Add endpoint to get single download status for userId and storageId.
|
||||
var downloadStatusResponse = downloadService.getDownloadStatus(userId);
|
||||
Optional<DownloadStatus> downloadStatusOptional = downloadStatusResponse.stream().filter(ds -> ds.getStorageId().equals(storageId)).findFirst();
|
||||
Optional<DownloadStatus> downloadStatusOptional = downloadStatusResponse.stream()
|
||||
.filter(ds -> ds.getStorageId().equals(storageId))
|
||||
.findFirst();
|
||||
|
||||
return downloadStatusOptional.orElseThrow(() -> new NotFoundException("Download status not found for this user"));
|
||||
}
|
||||
@ -261,11 +274,11 @@ public class DownloadController implements DownloadResource {
|
||||
var response = storageService.getObject(TenantContext.getTenantId(), storageId);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(userId)
|
||||
.objectId(storageId)
|
||||
.category(AuditCategory.DOWNLOAD.name())
|
||||
.message("File was downloaded.")
|
||||
.build());
|
||||
.userId(userId)
|
||||
.objectId(storageId)
|
||||
.category(AuditCategory.DOWNLOAD.name())
|
||||
.message("File was downloaded.")
|
||||
.build());
|
||||
downloadService.setDownloaded(JSONPrimitive.of(storageId));
|
||||
|
||||
return new InputStreamResource(new BufferedInputStream(response.getInputStream()));
|
||||
@ -286,8 +299,7 @@ public class DownloadController implements DownloadResource {
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public void downloadFileUsingOTT(@PathVariable(OTT) String oneTimeToken,
|
||||
@RequestParam(value = "tenantId") String tenantId) {
|
||||
public void downloadFileUsingOTT(@PathVariable(OTT) String oneTimeToken, @RequestParam(value = "tenantId") String tenantId) {
|
||||
|
||||
TenantContext.setTenantId(tenantId);
|
||||
var token = oneTimeTokenDownloadService.getToken(oneTimeToken);
|
||||
|
||||
@ -8,9 +8,11 @@ import com.iqser.red.service.persistence.management.v1.processor.exception.NotAl
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
|
||||
import com.knecon.fforesight.tenantcommons.TenantContext;
|
||||
import com.mchange.rmi.NotAuthorizedException;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.Scheduler;
|
||||
@ -50,6 +52,7 @@ public class ExternalControllerAdvice {
|
||||
|
||||
/* error handling */
|
||||
|
||||
|
||||
@Hidden
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
|
||||
@ -59,6 +62,7 @@ public class ExternalControllerAdvice {
|
||||
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@Hidden
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.CONFLICT)
|
||||
@ -68,6 +72,7 @@ public class ExternalControllerAdvice {
|
||||
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.FORBIDDEN)
|
||||
@ExceptionHandler({AccessDeniedException.class})
|
||||
@ -76,10 +81,12 @@ public class ExternalControllerAdvice {
|
||||
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.UNAUTHORIZED)
|
||||
@ExceptionHandler({NotAuthorizedException.class})
|
||||
public ErrorMessage handleNotAuthorizedException(NotAuthorizedException e) {
|
||||
|
||||
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
|
||||
}
|
||||
|
||||
@ -92,6 +99,7 @@ public class ExternalControllerAdvice {
|
||||
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@Hidden
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ -108,6 +116,7 @@ public class ExternalControllerAdvice {
|
||||
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@Hidden
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
|
||||
@ -115,10 +124,13 @@ public class ExternalControllerAdvice {
|
||||
public ErrorMessage handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
|
||||
|
||||
var errorList = e.getFieldErrors();
|
||||
String errorListAsString = errorList.stream().map(fieldError -> fieldError.getField() + ": " + fieldError.getDefaultMessage()).collect(Collectors.joining(", "));
|
||||
String errorListAsString = errorList.stream()
|
||||
.map(fieldError -> fieldError.getField() + ": " + fieldError.getDefaultMessage())
|
||||
.collect(Collectors.joining(", "));
|
||||
return new ErrorMessage(OffsetDateTime.now(), String.format("You have empty/wrong formatted parameters: %s", errorListAsString));
|
||||
}
|
||||
|
||||
|
||||
@Hidden
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
|
||||
@ -128,6 +140,7 @@ public class ExternalControllerAdvice {
|
||||
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@Hidden
|
||||
@ResponseBody
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
|
||||
@ -57,15 +57,16 @@ public class FileAttributesController implements FileAttributesResource {
|
||||
throw new BadRequestException("Invalid encoding setting");
|
||||
}
|
||||
fileAttributeConfigPersistenceService.setFileAttributesGeneralConfig(dossierTemplateId,
|
||||
MagicConverter.convert(fileAttributesConfig, FileAttributesGeneralConfigurationEntity.class));
|
||||
MagicConverter.convert(fileAttributesConfig, FileAttributesGeneralConfigurationEntity.class));
|
||||
var result = fileAttributeConfigPersistenceService.setFileAttributesConfig(dossierTemplateId,
|
||||
MagicConverter.convert(fileAttributesConfig.getFileAttributeConfigs(), FileAttributeConfigEntity.class));
|
||||
MagicConverter.convert(fileAttributesConfig.getFileAttributeConfigs(),
|
||||
FileAttributeConfigEntity.class));
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Changed file attributes base configuration & attribute configuration ( CSV Import )")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Changed file attributes base configuration & attribute configuration ( CSV Import )")
|
||||
.build());
|
||||
return FileAttributesConfig.builder()
|
||||
.filenameMappingColumnHeaderName(fileAttributesConfig.getFilenameMappingColumnHeaderName())
|
||||
.delimiter(fileAttributesConfig.getDelimiter())
|
||||
@ -82,12 +83,15 @@ public class FileAttributesController implements FileAttributesResource {
|
||||
|
||||
var result = fileAttributeConfigPersistenceService.addOrUpdateFileAttribute(dossierTemplateId, MagicConverter.convert(fileAttribute, FileAttributeConfigEntity.class));
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("File attributes added/updated")
|
||||
.details(Map.of("FileAttributeName", fileAttribute.getLabel() != null ? fileAttribute.getLabel() : "", "dossierTemplateId", dossierTemplateId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("File attributes added/updated")
|
||||
.details(Map.of("FileAttributeName",
|
||||
fileAttribute.getLabel() != null ? fileAttribute.getLabel() : "",
|
||||
"dossierTemplateId",
|
||||
dossierTemplateId))
|
||||
.build());
|
||||
|
||||
return MagicConverter.convert(result, FileAttributeConfig.class);
|
||||
}
|
||||
@ -99,12 +103,12 @@ public class FileAttributesController implements FileAttributesResource {
|
||||
|
||||
fileAttributeConfigPersistenceService.deleteFileAttribute(fileAttributeId);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("File attributes removed")
|
||||
.details(Map.of("FileAttributeId", fileAttributeId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("File attributes removed")
|
||||
.details(Map.of("FileAttributeId", fileAttributeId))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -114,12 +118,12 @@ public class FileAttributesController implements FileAttributesResource {
|
||||
|
||||
fileAttributeConfigPersistenceService.deleteFileAttributes(fileAttributeIds);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("File attributes removed")
|
||||
.details(Map.of("FileAttributeId", fileAttributeIds))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("File attributes removed")
|
||||
.details(Map.of("FileAttributeId", fileAttributeIds))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -130,7 +134,7 @@ public class FileAttributesController implements FileAttributesResource {
|
||||
FileAttributesGeneralConfiguration generalConfig = new FileAttributesGeneralConfiguration();
|
||||
try {
|
||||
generalConfig = MagicConverter.convert(fileAttributeConfigPersistenceService.getFileAttributesGeneralConfiguration(dossierTemplateId),
|
||||
FileAttributesGeneralConfiguration.class);
|
||||
FileAttributesGeneralConfiguration.class);
|
||||
} catch (Exception e) {
|
||||
log.debug("No general config defined", e);
|
||||
}
|
||||
@ -158,11 +162,11 @@ public class FileAttributesController implements FileAttributesResource {
|
||||
accessControlService.verifyUserIsMemberOrApprover(dossierId);
|
||||
fileAttributesManagementService.setFileAttributes(dossierId, fileId, fileAttributes.getAttributeIdToValue());
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("File attributes has been edited for a document.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("File attributes has been edited for a document.")
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ public class HighlightsController implements HighlightsResource {
|
||||
fileStatusService.getStatus(fileId);
|
||||
|
||||
if (storageService.objectExists(TenantContext.getTenantId(), getStorageId(dossierId, fileId, FileType.TEXT_HIGHLIGHTS))) {
|
||||
try(InputStream stream = fileManagementStorageService.getObject(TenantContext.getTenantId(), getStorageId(dossierId, fileId, FileType.TEXT_HIGHLIGHTS))) {
|
||||
try (InputStream stream = fileManagementStorageService.getObject(TenantContext.getTenantId(), getStorageId(dossierId, fileId, FileType.TEXT_HIGHLIGHTS))) {
|
||||
Highlights highlights = objectMapper.readValue(stream, Highlights.class);
|
||||
stream.close();
|
||||
return highlights;
|
||||
|
||||
@ -37,11 +37,11 @@ public class LegalBasisMappingController implements LegalBasisMappingResource {
|
||||
|
||||
legalBasisMappingPersistenceService.deleteLegalBasis(dossierTemplateId, legalBasisNames);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Legal basis mapping has been changed.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Legal basis mapping has been changed.")
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -51,11 +51,11 @@ public class LegalBasisMappingController implements LegalBasisMappingResource {
|
||||
|
||||
legalBasisMappingPersistenceService.addOrUpdateLegalBasis(dossierTemplateId, legalBasis);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Legal basis mapping has been changed.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Legal basis mapping has been changed.")
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -64,13 +64,14 @@ public class LegalBasisMappingController implements LegalBasisMappingResource {
|
||||
|
||||
legalBasisMappingPersistenceService.setLegalBasisMapping(dossierTemplateId, legalBasisMapping);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Legal basis mapping has been changed.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Legal basis mapping has been changed.")
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@PreAuthorize("hasAuthority('" + READ_LEGAL_BASIS + "')")
|
||||
public List<LegalBasis> getLegalBasisMapping(@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId) {
|
||||
|
||||
@ -33,11 +33,11 @@ public class LicenseReportController implements LicenseReportResource {
|
||||
|
||||
LicenseReport licenseReport = licenseReportService.getLicenseReport(reportRequest);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(LICENSE_AUDIT_KEY)
|
||||
.category(AuditCategory.LICENSE.name())
|
||||
.message("License report has been viewed.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(LICENSE_AUDIT_KEY)
|
||||
.category(AuditCategory.LICENSE.name())
|
||||
.message("License report has been viewed.")
|
||||
.build());
|
||||
return licenseReport;
|
||||
}
|
||||
|
||||
|
||||
@ -120,7 +120,8 @@ public class ManualRedactionController implements ManualRedactionResource {
|
||||
|
||||
accessControlService.checkDossierExistenceAndViewPermissionsToDossier(dossierId);
|
||||
accessControlService.validateFileResourceExistence(fileId);
|
||||
return manualRedactionService.getManualRedactions(fileId, ManualChangesQueryOptions.builder().includeOnlyUnprocessed(unprocessed).includeDictChanges(includeDictChanges).build());
|
||||
return manualRedactionService.getManualRedactions(fileId,
|
||||
ManualChangesQueryOptions.builder().includeOnlyUnprocessed(unprocessed).includeDictChanges(includeDictChanges).build());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -68,6 +68,7 @@ public class MigrationStatusController implements MigrationStatusResource {
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<?> revertMigrationForFile(String dossierId, String fileId) {
|
||||
|
||||
@ -101,7 +102,10 @@ public class MigrationStatusController implements MigrationStatusResource {
|
||||
|
||||
private static boolean migrationIsFinished(MigrationStatusResponse migrationStatus) {
|
||||
|
||||
return migrationStatus.getFilesInStatus().entrySet().stream().filter(e -> e.getValue() > 0).allMatch(e -> e.getKey().equals(FINISHED) || e.getKey().equals(ERROR));
|
||||
return migrationStatus.getFilesInStatus().entrySet()
|
||||
.stream()
|
||||
.filter(e -> e.getValue() > 0)
|
||||
.allMatch(e -> e.getKey().equals(FINISHED) || e.getKey().equals(ERROR));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -35,38 +35,48 @@ public class NotificationController implements NotificationResource {
|
||||
return JSONPrimitive.of(notificationPersistenceService.hasNewNotificationsSince(KeycloakSecurity.getUserId(), since.getValue()));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('" + UPDATE_NOTIFICATIONS + "')")
|
||||
public void toggleNotificationSeen(@RequestBody List<String> notificationIds, @RequestParam(SET_SEEN_PARAM) boolean setSeen) {
|
||||
|
||||
notificationIds.stream().map(Long::valueOf).forEach(notificationId -> {
|
||||
if (setSeen) {
|
||||
notificationPersistenceService.setSeenDate(KeycloakSecurity.getUserId(), notificationId, OffsetDateTime.now());
|
||||
} else {
|
||||
notificationPersistenceService.setSeenDate(KeycloakSecurity.getUserId(), notificationId, null);
|
||||
}
|
||||
});
|
||||
notificationIds.stream()
|
||||
.map(Long::valueOf)
|
||||
.forEach(notificationId -> {
|
||||
if (setSeen) {
|
||||
notificationPersistenceService.setSeenDate(KeycloakSecurity.getUserId(), notificationId, OffsetDateTime.now());
|
||||
} else {
|
||||
notificationPersistenceService.setSeenDate(KeycloakSecurity.getUserId(), notificationId, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('" + UPDATE_NOTIFICATIONS + "')")
|
||||
public void toggleNotificationRead(@RequestBody List<String> notificationIds, @RequestParam(SET_READ_PARAM) boolean setRead) {
|
||||
|
||||
notificationIds.stream().map(Long::valueOf).forEach(notificationId -> {
|
||||
if (setRead) {
|
||||
notificationPersistenceService.setReadDate(KeycloakSecurity.getUserId(), notificationId, OffsetDateTime.now());
|
||||
} else {
|
||||
notificationPersistenceService.setReadDate(KeycloakSecurity.getUserId(), notificationId, null);
|
||||
}
|
||||
});
|
||||
notificationIds.stream()
|
||||
.map(Long::valueOf)
|
||||
.forEach(notificationId -> {
|
||||
if (setRead) {
|
||||
notificationPersistenceService.setReadDate(KeycloakSecurity.getUserId(), notificationId, OffsetDateTime.now());
|
||||
} else {
|
||||
notificationPersistenceService.setReadDate(KeycloakSecurity.getUserId(), notificationId, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('" + UPDATE_NOTIFICATIONS + "')")
|
||||
public void delete(@RequestBody List<String> notificationIds) {
|
||||
|
||||
notificationIds.stream().map(Long::valueOf).forEach(notificationId -> {
|
||||
notificationPersistenceService.softDelete(KeycloakSecurity.getUserId(), notificationId);
|
||||
});
|
||||
notificationIds.stream()
|
||||
.map(Long::valueOf)
|
||||
.forEach(notificationId -> {
|
||||
notificationPersistenceService.softDelete(KeycloakSecurity.getUserId(), notificationId);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('" + READ_NOTIFICATIONS + "')")
|
||||
public NotificationResponse getNotifications(@RequestParam(INCLUDE_SEEN_PARAM) boolean includeSeen) {
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@ package com.iqser.red.persistence.service.v1.external.api.impl.controller;
|
||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.READ_NOTIFICATIONS;
|
||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.UPDATE_NOTIFICATIONS;
|
||||
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -29,6 +28,7 @@ public class NotificationPreferencesController implements NotificationPreference
|
||||
@Override
|
||||
@PreAuthorize("hasAuthority('" + READ_NOTIFICATIONS + "')")
|
||||
public NotificationPreferences getNotificationPreferences() {
|
||||
|
||||
return notificationPreferencesService.getOrCreateNotificationPreferences(KeycloakSecurity.getUserId());
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,9 @@ public class RSSComponentLogController implements RSSResource {
|
||||
dossierFiles = List.of(statusController.getFileStatus(dossierId, fileId));
|
||||
}
|
||||
|
||||
List<RSSFileResponse> fileResponses = dossierFiles.stream().map(this::getRssResponse).toList();
|
||||
List<RSSFileResponse> fileResponses = dossierFiles.stream()
|
||||
.map(this::getRssResponse)
|
||||
.toList();
|
||||
|
||||
return new RSSResponse(fileResponses);
|
||||
|
||||
@ -75,18 +77,21 @@ public class RSSComponentLogController implements RSSResource {
|
||||
|
||||
Map<String, String> results = new LinkedHashMap<>();
|
||||
|
||||
componentLog.getComponentLogEntries().forEach(entry -> {
|
||||
if (entry.getComponentValues().size() <= 1) {
|
||||
results.put(entry.getName(), entry.getComponentValues().get(0).getValue());
|
||||
return;
|
||||
}
|
||||
componentLog.getComponentLogEntries()
|
||||
.forEach(entry -> {
|
||||
if (entry.getComponentValues().size() <= 1) {
|
||||
results.put(entry.getName(),
|
||||
entry.getComponentValues()
|
||||
.get(0).getValue());
|
||||
return;
|
||||
}
|
||||
|
||||
List<ComponentLogEntryValue> componentValues = entry.getComponentValues();
|
||||
for (int i = 0, componentValuesSize = componentValues.size(); i < componentValuesSize; i++) {
|
||||
ComponentLogEntryValue v = componentValues.get(i);
|
||||
results.put(entry.getName() + "_" + (i + 1), v.getValue());
|
||||
}
|
||||
});
|
||||
List<ComponentLogEntryValue> componentValues = entry.getComponentValues();
|
||||
for (int i = 0, componentValuesSize = componentValues.size(); i < componentValuesSize; i++) {
|
||||
ComponentLogEntryValue v = componentValues.get(i);
|
||||
results.put(entry.getName() + "_" + (i + 1), v.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
return RSSFileResponse.builder().filename(file.getFilename()).result(results).build();
|
||||
|
||||
@ -103,7 +108,9 @@ public class RSSComponentLogController implements RSSResource {
|
||||
dossierFiles = List.of(statusController.getFileStatus(dossierId, fileId));
|
||||
}
|
||||
|
||||
List<DetailedRSSFileResponse> fileResponses = dossierFiles.stream().map(this::getDetailedRssResponse).toList();
|
||||
List<DetailedRSSFileResponse> fileResponses = dossierFiles.stream()
|
||||
.map(this::getDetailedRssResponse)
|
||||
.toList();
|
||||
|
||||
return new DetailedRSSResponse(fileResponses);
|
||||
}
|
||||
@ -115,18 +122,21 @@ public class RSSComponentLogController implements RSSResource {
|
||||
|
||||
Map<String, SCMComponent> results = new LinkedHashMap<>();
|
||||
|
||||
componentLog.getComponentLogEntries().forEach(entry -> {
|
||||
if (entry.getComponentValues().size() <= 1) {
|
||||
results.put(entry.getName(), toSCMComponent(entry.getComponentValues().get(0)));
|
||||
return;
|
||||
}
|
||||
componentLog.getComponentLogEntries()
|
||||
.forEach(entry -> {
|
||||
if (entry.getComponentValues().size() <= 1) {
|
||||
results.put(entry.getName(),
|
||||
toSCMComponent(entry.getComponentValues()
|
||||
.get(0)));
|
||||
return;
|
||||
}
|
||||
|
||||
List<ComponentLogEntryValue> componentValues = entry.getComponentValues();
|
||||
for (int i = 0, componentValuesSize = componentValues.size(); i < componentValuesSize; i++) {
|
||||
ComponentLogEntryValue v = componentValues.get(i);
|
||||
results.put(entry.getName() + "_" + (i + 1), toSCMComponent(v));
|
||||
}
|
||||
});
|
||||
List<ComponentLogEntryValue> componentValues = entry.getComponentValues();
|
||||
for (int i = 0, componentValuesSize = componentValues.size(); i < componentValuesSize; i++) {
|
||||
ComponentLogEntryValue v = componentValues.get(i);
|
||||
results.put(entry.getName() + "_" + (i + 1), toSCMComponent(v));
|
||||
}
|
||||
});
|
||||
|
||||
return DetailedRSSFileResponse.builder().filename(file.getFilename()).result(results).build();
|
||||
}
|
||||
@ -138,7 +148,10 @@ public class RSSComponentLogController implements RSSResource {
|
||||
.value(v.getValue().equals(v.getOriginalValue()) ? null : v.getValue())
|
||||
.originalValue(v.getOriginalValue())
|
||||
.transformation(v.getValueDescription())
|
||||
.scmAnnotations(v.getComponentLogEntityReferences().stream().map(this::toScmAnnotation).toList())
|
||||
.scmAnnotations(v.getComponentLogEntityReferences()
|
||||
.stream()
|
||||
.map(this::toScmAnnotation)
|
||||
.toList())
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -163,7 +176,8 @@ public class RSSComponentLogController implements RSSResource {
|
||||
|
||||
componentOverrideService.addOverrides(dossierId, fileId, componentsOverrides);
|
||||
|
||||
componentsOverrides.getComponentOverrides().forEach((componentName, overrideValue) -> auditOverride(dossierId, fileId, componentName, overrideValue, allComponents));
|
||||
componentsOverrides.getComponentOverrides()
|
||||
.forEach((componentName, overrideValue) -> auditOverride(dossierId, fileId, componentName, overrideValue, allComponents));
|
||||
}
|
||||
|
||||
|
||||
@ -182,63 +196,68 @@ public class RSSComponentLogController implements RSSResource {
|
||||
|
||||
componentOverrideService.revertOverrides(dossierId, fileId, revertOverrideRequest);
|
||||
|
||||
revertOverrideRequest.getComponents().forEach(componentNameToRevert -> auditOverrideRevert(dossierId, fileId, componentNameToRevert, allComponents));
|
||||
revertOverrideRequest.getComponents()
|
||||
.forEach(componentNameToRevert -> auditOverrideRevert(dossierId, fileId, componentNameToRevert, allComponents));
|
||||
}
|
||||
|
||||
|
||||
private void auditOverride(String dossierId, String fileId, String componentName, String overrideValue, List<ComponentLogEntry> allComponentLogEntries) {
|
||||
|
||||
Optional<ComponentLogEntry> component = allComponentLogEntries.stream().filter(c -> c.getName().equals(componentName)).findFirst();
|
||||
Optional<ComponentLogEntry> component = allComponentLogEntries.stream()
|
||||
.filter(c -> c.getName().equals(componentName))
|
||||
.findFirst();
|
||||
String originalValue = getOriginalValue(component);
|
||||
String value = getValue(component);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component is overwritten with value")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
componentName,
|
||||
"Action",
|
||||
"MODIFY",
|
||||
"OriginalValue",
|
||||
originalValue,
|
||||
"OldValue",
|
||||
value,
|
||||
"NewValue",
|
||||
overrideValue))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component is overwritten with value")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
componentName,
|
||||
"Action",
|
||||
"MODIFY",
|
||||
"OriginalValue",
|
||||
originalValue,
|
||||
"OldValue",
|
||||
value,
|
||||
"NewValue",
|
||||
overrideValue))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
private void auditOverrideRevert(String dossierId, String fileId, String componentNameToRevert, List<ComponentLogEntry> allComponentLogEntries) {
|
||||
|
||||
Optional<ComponentLogEntry> component = allComponentLogEntries.stream().filter(c -> c.getName().equals(componentNameToRevert)).findFirst();
|
||||
Optional<ComponentLogEntry> component = allComponentLogEntries.stream()
|
||||
.filter(c -> c.getName().equals(componentNameToRevert))
|
||||
.findFirst();
|
||||
String originalValue = getOriginalValue(component);
|
||||
String value = getValue(component);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component override for was reverted")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
componentNameToRevert,
|
||||
"Action",
|
||||
"REVERT",
|
||||
"OriginalValue",
|
||||
originalValue,
|
||||
"OldValue",
|
||||
value,
|
||||
"NewValue",
|
||||
originalValue))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component override for was reverted")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
componentNameToRevert,
|
||||
"Action",
|
||||
"REVERT",
|
||||
"OriginalValue",
|
||||
originalValue,
|
||||
"OldValue",
|
||||
value,
|
||||
"NewValue",
|
||||
originalValue))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -246,7 +265,9 @@ public class RSSComponentLogController implements RSSResource {
|
||||
|
||||
return component.map(ComponentLogEntry::getComponentValues)
|
||||
.stream()
|
||||
.map(a -> a.stream().map(ComponentLogEntryValue::getValue).collect(Collectors.joining(", ")))
|
||||
.map(a -> a.stream()
|
||||
.map(ComponentLogEntryValue::getValue)
|
||||
.collect(Collectors.joining(", ")))
|
||||
.findFirst()
|
||||
.orElse("");
|
||||
}
|
||||
@ -256,7 +277,9 @@ public class RSSComponentLogController implements RSSResource {
|
||||
|
||||
return component.map(ComponentLogEntry::getComponentValues)
|
||||
.stream()
|
||||
.map(a -> a.stream().map(ComponentLogEntryValue::getOriginalValue).collect(Collectors.joining(", ")))
|
||||
.map(a -> a.stream()
|
||||
.map(ComponentLogEntryValue::getOriginalValue)
|
||||
.collect(Collectors.joining(", ")))
|
||||
.findFirst()
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
@ -49,7 +49,10 @@ public class RSSController implements RSSResource {
|
||||
@PreAuthorize("hasAuthority('" + GET_RSS + "')")
|
||||
private RSSResponse convert(com.iqser.red.service.redaction.report.v1.api.model.rss.RSSResponse rssResponse) {
|
||||
|
||||
return new RSSResponse(rssResponse.getFiles().stream().map(this::convert).collect(Collectors.toList()));
|
||||
return new RSSResponse(rssResponse.getFiles()
|
||||
.stream()
|
||||
.map(this::convert)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
@ -72,31 +75,33 @@ public class RSSController implements RSSResource {
|
||||
public void addOverrides(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody ComponentsOverrides componentsOverrides) {
|
||||
|
||||
var rssReport = rssReportClient.getDetailedRSS(dossierId, fileId);
|
||||
var components = rssReport.getFiles().get(0).getResult();
|
||||
var components = rssReport.getFiles()
|
||||
.get(0).getResult();
|
||||
|
||||
componentOverrideService.addOverrides(dossierId, fileId, componentsOverrides);
|
||||
|
||||
componentsOverrides.getComponentOverrides()
|
||||
.forEach((key, value) -> auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component is overwritten with value")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
key,
|
||||
"Action",
|
||||
"MODIFY",
|
||||
"OriginalValue",
|
||||
components.get(key).getOriginalValue(),
|
||||
"OldValue",
|
||||
components.get(key).getValue() != null ? components.get(key).getValue() : components.get(key).getOriginalValue(),
|
||||
"NewValue",
|
||||
value))
|
||||
.build()));
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component is overwritten with value")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
key,
|
||||
"Action",
|
||||
"MODIFY",
|
||||
"OriginalValue",
|
||||
components.get(key).getOriginalValue(),
|
||||
"OldValue",
|
||||
components.get(key).getValue() != null ? components.get(key)
|
||||
.getValue() : components.get(key).getOriginalValue(),
|
||||
"NewValue",
|
||||
value))
|
||||
.build()));
|
||||
}
|
||||
|
||||
|
||||
@ -111,31 +116,33 @@ public class RSSController implements RSSResource {
|
||||
public void revertOverrides(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody RevertOverrideRequest revertOverrideRequest) {
|
||||
|
||||
var rssReport = rssReportClient.getDetailedRSS(dossierId, fileId);
|
||||
var components = rssReport.getFiles().get(0).getResult();
|
||||
var components = rssReport.getFiles()
|
||||
.get(0).getResult();
|
||||
|
||||
componentOverrideService.revertOverrides(dossierId, fileId, revertOverrideRequest);
|
||||
|
||||
revertOverrideRequest.getComponents()
|
||||
.forEach(component -> auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component override for was reverted")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
component,
|
||||
"Action",
|
||||
"REVERT",
|
||||
"OriginalValue",
|
||||
components.get(component).getOriginalValue(),
|
||||
"OldValue",
|
||||
components.get(component).getValue() != null ? components.get(component).getValue() : components.get(component).getOriginalValue(),
|
||||
"NewValue",
|
||||
components.get(component).getOriginalValue()))
|
||||
.build()));
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("The component override for was reverted")
|
||||
.details(Map.of(DOSSIER_ID,
|
||||
dossierId,
|
||||
FILE_ID,
|
||||
fileId,
|
||||
"ComponentName",
|
||||
component,
|
||||
"Action",
|
||||
"REVERT",
|
||||
"OriginalValue",
|
||||
components.get(component).getOriginalValue(),
|
||||
"OldValue",
|
||||
components.get(component).getValue() != null ? components.get(component)
|
||||
.getValue() : components.get(component).getOriginalValue(),
|
||||
"NewValue",
|
||||
components.get(component).getOriginalValue()))
|
||||
.build()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
private final AuditPersistenceService auditPersistenceService;
|
||||
private final AccessControlService accessControlService;
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('" + REANALYZE_DOSSIER + "')")
|
||||
public void reanalyzeDossier(@PathVariable(DOSSIER_ID) String dossierId, @RequestParam(value = FORCE_PARAM, required = false, defaultValue = FALSE) boolean force) {
|
||||
|
||||
@ -48,14 +49,15 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
reanalysisService.reanalyzeDossier(dossierId, force);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Reanalyse dossier was triggered")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("Reanalyse dossier was triggered")
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('" + REANALYZE_FILE + "')")
|
||||
public void reanalyzeFile(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@ -64,12 +66,12 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
accessControlService.checkDossierExistenceAndAccessPermissionsToDossier(dossierId);
|
||||
reanalysisService.reanalyzeFiles(dossierId, Sets.newHashSet(fileId), force);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Reanalyse file was triggered")
|
||||
.details(Map.of(DOSSIER_ID, dossierId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Reanalyse file was triggered")
|
||||
.details(Map.of(DOSSIER_ID, dossierId))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -83,12 +85,12 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
reanalysisService.reanalyzeFiles(dossierId, new HashSet<>(fileIds), force);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Reanalyse files was triggered")
|
||||
.details(Map.of(DOSSIER_ID, dossierId, "number", fileIds.size()))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Reanalyse files was triggered")
|
||||
.details(Map.of(DOSSIER_ID, dossierId, "number", fileIds.size()))
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
@ -102,11 +104,11 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
reanalysisService.ocrDossier(dossierId);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("OCR and reanalyse dossier was triggered")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOSSIER.name())
|
||||
.message("OCR and reanalyse dossier was triggered")
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
@ -121,12 +123,12 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
validateOCR(dossierId, fileId);
|
||||
reanalysisService.ocrFile(dossierId, fileId, force);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("OCR and reanalyse file was triggered")
|
||||
.details(Map.of(DOSSIER_ID, dossierId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("OCR and reanalyse file was triggered")
|
||||
.details(Map.of(DOSSIER_ID, dossierId))
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
@ -139,15 +141,16 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
fileIds.forEach(fileId -> validateOCR(dossierId, fileId));
|
||||
reanalysisService.ocrFiles(dossierId, fileIds);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("OCR and reanalyse was triggered")
|
||||
.details(Map.of(DOSSIER_ID, dossierId, "number", fileIds.size()))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("OCR and reanalyse was triggered")
|
||||
.details(Map.of(DOSSIER_ID, dossierId, "number", fileIds.size()))
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('" + EXCLUDE_INCLUDE_FILE + "')")
|
||||
public void toggleAutomaticAnalysis(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@ -158,11 +161,11 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
fileStatusManagementService.toggleAutomaticAnalysis(dossierId, fileId, excludedFromAutomaticAnalysis);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Toggle Exclusion status: File excluded from automatic analysis: " + excludedFromAutomaticAnalysis)
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Toggle Exclusion status: File excluded from automatic analysis: " + excludedFromAutomaticAnalysis)
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
@ -181,14 +184,15 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
fileStatusManagementService.toggleExclusion(dossierId, fileId, excluded);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Toggle Exclusion status: File excluded from analysis: " + excluded)
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Toggle Exclusion status: File excluded from analysis: " + excluded)
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('" + EXCLUDE_INCLUDE_FILE + "')")
|
||||
public void toggleAutomaticAnalysisForList(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@RequestBody Set<String> fileIds,
|
||||
@ -207,6 +211,7 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('" + EXCLUDE_INCLUDE_FILE + "')")
|
||||
public void toggleExclusionForList(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@RequestBody Set<String> fileIds,
|
||||
@ -241,11 +246,11 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
fileStatusManagementService.excludePages(dossierId, fileId, excludedPages);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Page exclusions added for file")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Page exclusions added for file")
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
@ -265,11 +270,11 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
fileStatusManagementService.includePages(dossierId, fileId, includePages);
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Page inclusions added for file")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Page inclusions added for file")
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -282,11 +287,11 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
reanalysisService.reindex(dossierId, dropIndex, new HashSet<>(fileIds));
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId("redaction")
|
||||
.category(AuditCategory.INDEX.name())
|
||||
.message("Reindexing has been triggered" + (dropIndex ? " (with drop index)." : "."))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId("redaction")
|
||||
.category(AuditCategory.INDEX.name())
|
||||
.message("Reindexing has been triggered" + (dropIndex ? " (with drop index)." : "."))
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
@ -294,7 +299,7 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
private void validateOCR(String dossierId, String fileId) {
|
||||
|
||||
var status = fileStatusManagementService.getFileStatus(fileId);
|
||||
if(status.isSoftOrHardDeleted()) {
|
||||
if (status.isSoftOrHardDeleted()) {
|
||||
throw new NotFoundException("File does not exist");
|
||||
}
|
||||
if (status.getWorkflowStatus() == WorkflowStatus.APPROVED) {
|
||||
|
||||
@ -14,6 +14,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.DossierTemplatePersistenceService;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
@ -76,7 +77,6 @@ public class ReportTemplateController implements ReportTemplateResource {
|
||||
private final FileManagementStorageService fileManagementStorageService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@PreAuthorize("hasAuthority('" + GET_REPORT_TEMPLATES + "')")
|
||||
public List<ReportTemplate> getReportTemplatesByPlaceholder(@PathVariable(DOSSIER_TEMPLATE_ID) String dossierTemplateId, @RequestBody JSONPrimitive<String> placeholder) {
|
||||
@ -111,12 +111,12 @@ public class ReportTemplateController implements ReportTemplateResource {
|
||||
.build();
|
||||
var reportTemplate = reportTemplateService.uploadTemplate(reportTemplateUploadRequest);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(reportTemplate.getTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Report template was uploaded.")
|
||||
.details(Map.of("DossierTemplateId", dossierTemplateId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(reportTemplate.getTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Report template was uploaded.")
|
||||
.details(Map.of("DossierTemplateId", dossierTemplateId))
|
||||
.build());
|
||||
return reportTemplate;
|
||||
} else {
|
||||
throw new BadRequestException("Could not upload file, no filename provided.");
|
||||
@ -175,12 +175,12 @@ public class ReportTemplateController implements ReportTemplateResource {
|
||||
storageService.deleteObject(TenantContext.getTenantId(), storageId);
|
||||
reportTemplatePersistenceService.delete(templateId);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(templateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Report template was deleted.")
|
||||
.details(Map.of("DossierTemplateId", dossierTemplateId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(templateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Report template was deleted.")
|
||||
.details(Map.of("DossierTemplateId", dossierTemplateId))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -99,11 +99,11 @@ public class RulesController implements RulesResource {
|
||||
rulesPersistenceService.setRules(rulesUploadRequest.getRules(), rulesUploadRequest.getDossierTemplateId(), rulesUploadRequest.getRuleFileType());
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(rulesUploadRequest.getDossierTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message(String.format("%s Rules have been updated", rulesUploadRequest.getRuleFileType()))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(rulesUploadRequest.getDossierTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message(String.format("%s Rules have been updated", rulesUploadRequest.getRuleFileType()))
|
||||
.build());
|
||||
|
||||
return ResponseEntity.ok(droolsSyntaxValidationResponse);
|
||||
}
|
||||
|
||||
@ -174,39 +174,39 @@ public class StatusController implements StatusResource {
|
||||
fileStatusManagementService.setCurrentFileAssignee(dossierId, fileId, assigneeId);
|
||||
if (assigneeId == null) {
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Reviewer was unassigned from document")
|
||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Reviewer was unassigned from document")
|
||||
.details(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
} else {
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Reviewer was assigned to document")
|
||||
.details(Map.of(DOSSIER_ID, dossierId, "reviewer", assigneeId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Reviewer was assigned to document")
|
||||
.details(Map.of(DOSSIER_ID, dossierId, "reviewer", assigneeId))
|
||||
.build());
|
||||
}
|
||||
|
||||
if (assigneeId != null && !assigneeId.equals(KeycloakSecurity.getUserId())) {
|
||||
notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(assigneeId)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(WorkflowStatus.APPROVED.equals(fileStatus.getWorkflowStatus()) ? NotificationType.ASSIGN_APPROVER.name() : NotificationType.ASSIGN_REVIEWER.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
.userId(assigneeId)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(WorkflowStatus.APPROVED.equals(fileStatus.getWorkflowStatus()) ? NotificationType.ASSIGN_APPROVER.name() : NotificationType.ASSIGN_REVIEWER.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
}
|
||||
|
||||
if (assigneeId == null || fileStatus.getAssignee() != null && !fileStatus.getAssignee().equals(assigneeId) && !KeycloakSecurity.getUserId()
|
||||
.equals(fileStatus.getAssignee())) {
|
||||
notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(fileStatus.getAssignee())
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.UNASSIGNED_FROM_FILE.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
.userId(fileStatus.getAssignee())
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.UNASSIGNED_FROM_FILE.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
}
|
||||
|
||||
}
|
||||
@ -221,7 +221,9 @@ public class StatusController implements StatusResource {
|
||||
throw new BadRequestException("Unknown user=" + assigneeId);
|
||||
}
|
||||
// check he has a manager role, thus he can be the owner
|
||||
if (user.get().getRoles().stream().noneMatch(VALID_MEMBER_ROLES::contains)) {
|
||||
if (user.get().getRoles()
|
||||
.stream()
|
||||
.noneMatch(VALID_MEMBER_ROLES::contains)) {
|
||||
throw new BadRequestException("Make sure each provided member id has the permission to be a member of a dossier.");
|
||||
}
|
||||
// check assignee is a member
|
||||
@ -245,20 +247,20 @@ public class StatusController implements StatusResource {
|
||||
|
||||
setStatusUnderReviewForFile(dossierId, fileId, assigneeId);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Document status was changed to Under Review")
|
||||
.details(Map.of(DOSSIER_ID, dossierId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Document status was changed to Under Review")
|
||||
.details(Map.of(DOSSIER_ID, dossierId))
|
||||
.build());
|
||||
|
||||
if (assigneeId != null && !assigneeId.equals(KeycloakSecurity.getUserId())) {
|
||||
notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(assigneeId)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.ASSIGN_REVIEWER.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
.userId(assigneeId)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.ASSIGN_REVIEWER.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
}
|
||||
|
||||
generatePossibleUnassignedFromFileNotification(dossierId, fileId, fileStatus, assigneeId);
|
||||
@ -275,21 +277,21 @@ public class StatusController implements StatusResource {
|
||||
|
||||
setStatusUnderApprovalForFile(dossierId, fileId, assigneeId);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Document status was changed to Under Approval")
|
||||
.details(Map.of(DOSSIER_ID, dossierId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Document status was changed to Under Approval")
|
||||
.details(Map.of(DOSSIER_ID, dossierId))
|
||||
.build());
|
||||
|
||||
if (assigneeId != null && !assigneeId.equals(KeycloakSecurity.getUserId())) {
|
||||
|
||||
notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(assigneeId)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.ASSIGN_APPROVER.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
.userId(assigneeId)
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.ASSIGN_APPROVER.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
}
|
||||
|
||||
generatePossibleUnassignedFromFileNotification(dossierId, fileId, fileStatus, assigneeId);
|
||||
@ -303,12 +305,12 @@ public class StatusController implements StatusResource {
|
||||
accessControlService.verifyUserIsApprover(dossierId);
|
||||
setStatusApprovedForFile(dossierId, fileId);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Document status was changed to Approved")
|
||||
.details(Map.of(DOSSIER_ID, dossierId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Document status was changed to Approved")
|
||||
.details(Map.of(DOSSIER_ID, dossierId))
|
||||
.build());
|
||||
|
||||
var dossier = dossierACLService.enhanceDossierWithACLData(dossierManagementService.getDossierById(dossierId, false, false));
|
||||
if (!dossier.getOwnerId().equals(KeycloakSecurity.getUserId())) {
|
||||
@ -316,11 +318,11 @@ public class StatusController implements StatusResource {
|
||||
var fileStatus = fileStatusManagementService.getFileStatus(fileId);
|
||||
|
||||
notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(dossier.getOwnerId())
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.DOCUMENT_APPROVED.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
.userId(dossier.getOwnerId())
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.DOCUMENT_APPROVED.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, fileStatus.getFilename()))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,16 +357,17 @@ public class StatusController implements StatusResource {
|
||||
|
||||
private void generatePossibleUnassignedFromFileNotification(String dossierId, String fileId, FileModel oldFileStatus, String newAssigneeId) {
|
||||
|
||||
if (oldFileStatus.getAssignee() == null || newAssigneeId == null || oldFileStatus.getAssignee().equals(newAssigneeId) || KeycloakSecurity.getUserId().equals(oldFileStatus.getAssignee())) {
|
||||
if (oldFileStatus.getAssignee() == null || newAssigneeId == null || oldFileStatus.getAssignee().equals(newAssigneeId) || KeycloakSecurity.getUserId()
|
||||
.equals(oldFileStatus.getAssignee())) {
|
||||
return;
|
||||
}
|
||||
|
||||
notificationPersistenceService.insertNotification(AddNotificationRequest.builder()
|
||||
.userId(oldFileStatus.getAssignee())
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.UNASSIGNED_FROM_FILE.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, oldFileStatus.getFilename()))
|
||||
.build());
|
||||
.userId(oldFileStatus.getAssignee())
|
||||
.issuerId(KeycloakSecurity.getUserId())
|
||||
.notificationType(NotificationType.UNASSIGNED_FROM_FILE.name())
|
||||
.target(Map.of(DOSSIER_ID, dossierId, FILE_ID, fileId, FILE_NAME, oldFileStatus.getFilename()))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -431,7 +434,10 @@ public class StatusController implements StatusResource {
|
||||
|
||||
try {
|
||||
accessControlService.verifyUserHasViewPermissions(dossierId);
|
||||
return fileStatusManagementService.getSoftDeletedDossierStatus(dossierId).stream().map(FileStatusMapper::toFileStatus).collect(Collectors.toList());
|
||||
return fileStatusManagementService.getSoftDeletedDossierStatus(dossierId)
|
||||
.stream()
|
||||
.map(FileStatusMapper::toFileStatus)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
} catch (AccessDeniedException e) {
|
||||
return new ArrayList<>();
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.iqser.red.persistence.service.v1.external.api.impl.controller;
|
||||
|
||||
|
||||
import static com.iqser.red.service.persistence.management.v1.processor.roles.ActionRoles.READ_DOSSIER;
|
||||
import static com.iqser.red.service.persistence.management.v1.processor.service.FeignExceptionHandler.processFeignException;
|
||||
|
||||
|
||||
@ -113,12 +113,12 @@ public class UploadController implements UploadResource {
|
||||
reanalysisService.importRedactions(ByteContentDocument.builder().dossierId(dossierId).fileId(fileId).document(file.getBytes()).pages(pageInclusionRequest).build());
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Redactions were imported")
|
||||
.details(Map.of("dossierId", dossierId))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(fileId)
|
||||
.category(AuditCategory.DOCUMENT.name())
|
||||
.message("Redactions were imported")
|
||||
.details(Map.of("dossierId", dossierId))
|
||||
.build());
|
||||
} catch (IOException e) {
|
||||
throw new BadRequestException(e.getMessage(), e);
|
||||
} catch (FeignException e) {
|
||||
|
||||
@ -40,11 +40,11 @@ public class WatermarkController implements WatermarkResource {
|
||||
watermark.setCreatedBy(userId);
|
||||
WatermarkModel result = MagicConverter.convert(watermarkService.createOrUpdateWatermark(watermark), WatermarkModel.class);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(userId)
|
||||
.objectId(result.getDossierTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Watermark has been changed.")
|
||||
.build());
|
||||
.userId(userId)
|
||||
.objectId(result.getDossierTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Watermark has been changed.")
|
||||
.build());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -72,11 +72,11 @@ public class WatermarkController implements WatermarkResource {
|
||||
String dossierTemplateId = watermarkService.getWatermark(watermarkId).getDossierTemplateId();
|
||||
watermarkService.deleteWatermark(watermarkId);
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Watermark has been deleted.")
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(dossierTemplateId)
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message("Watermark has been deleted.")
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,6 @@ import com.iqser.red.persistence.service.v1.external.api.impl.model.OneTimeToken
|
||||
@Service
|
||||
public class OneTimeTokenCacheService {
|
||||
|
||||
|
||||
@Cacheable(value = OTT_CACHE, key = "#tokenId")
|
||||
public OneTimeToken cacheOTT(String tokenId, OneTimeToken token) {
|
||||
// empty
|
||||
|
||||
@ -3,7 +3,6 @@ package com.iqser.red.persistence.service.v2.external.api.impl;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
public class PersistenceServiceExternalApiConfigurationV2 {
|
||||
|
||||
@ -54,7 +54,11 @@ public class ComponentControllerV2 implements ComponentResource {
|
||||
|
||||
Map<String, List<String>> basicComponent = new LinkedHashMap<>();
|
||||
for (ComponentLogEntry componentLogEntry : componentLog.getComponentLogEntries()) {
|
||||
basicComponent.put(componentLogEntry.getName(), componentLogEntry.getComponentValues().stream().map(ComponentLogEntryValue::getValue).toList());
|
||||
basicComponent.put(componentLogEntry.getName(),
|
||||
componentLogEntry.getComponentValues()
|
||||
.stream()
|
||||
.map(ComponentLogEntryValue::getValue)
|
||||
.toList());
|
||||
}
|
||||
|
||||
Map<String, Component> componentsDetails = new LinkedHashMap<>();
|
||||
@ -77,7 +81,10 @@ public class ComponentControllerV2 implements ComponentResource {
|
||||
|
||||
private List<ComponentValue> toComponentList(ComponentLogEntry componentLogEntry) {
|
||||
|
||||
return componentLogEntry.getComponentValues().stream().map(this::convert).toList();
|
||||
return componentLogEntry.getComponentValues()
|
||||
.stream()
|
||||
.map(this::convert)
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
@ -86,7 +93,10 @@ public class ComponentControllerV2 implements ComponentResource {
|
||||
return ComponentValue.builder()
|
||||
.valueDescription(componentValue.getValueDescription())
|
||||
.componentRuleId(componentValue.getComponentRuleId())
|
||||
.entityReferences(componentValue.getComponentLogEntityReferences().stream().map(this::convertComponentEntityReference).toList())
|
||||
.entityReferences(componentValue.getComponentLogEntityReferences()
|
||||
.stream()
|
||||
.map(this::convertComponentEntityReference)
|
||||
.toList())
|
||||
.originalValue(componentValue.getOriginalValue())
|
||||
.value(componentValue.getValue())
|
||||
.build();
|
||||
@ -111,7 +121,9 @@ public class ComponentControllerV2 implements ComponentResource {
|
||||
|
||||
dossierTemplateController.getDossierTemplate(dossierTemplateId);
|
||||
var dossierFiles = statusController.getDossierStatus(dossierId);
|
||||
return new FileComponentsList(dossierFiles.stream().map(file -> getComponents(dossierTemplateId, dossierId, file.getFileId(), includeDetails)).toList());
|
||||
return new FileComponentsList(dossierFiles.stream()
|
||||
.map(file -> getComponents(dossierTemplateId, dossierId, file.getFileId(), includeDetails))
|
||||
.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -42,7 +42,9 @@ public class DossierControllerV2 implements DossierResource {
|
||||
var dossiers = dossierController.getDossiersForDossierTemplate(dossierTemplateId, includeArchived, includeSoftDeleted);
|
||||
|
||||
if (!includeActive) {
|
||||
return new DossierList(dossiers.stream().filter(dossier -> dossier.getSoftDeletedTime() != null || dossier.getArchivedTime() != null).toList());
|
||||
return new DossierList(dossiers.stream()
|
||||
.filter(dossier -> dossier.getSoftDeletedTime() != null || dossier.getArchivedTime() != null)
|
||||
.toList());
|
||||
}
|
||||
|
||||
return new DossierList(dossiers);
|
||||
|
||||
@ -134,7 +134,8 @@ public class DossierTemplateControllerV2 implements DossierTemplateResource {
|
||||
.filenameMappingCsvColumnHeader(fileAttributeConfigs.getFilenameMappingColumnHeaderName())
|
||||
.build();
|
||||
|
||||
var fileAttributeDefinitions = fileAttributeConfigs.getFileAttributeConfigs().stream()
|
||||
var fileAttributeDefinitions = fileAttributeConfigs.getFileAttributeConfigs()
|
||||
.stream()
|
||||
.map(fileAttributeConfig -> FileAttributeDefinition.builder()
|
||||
.id(fileAttributeConfig.getId())
|
||||
.name(fileAttributeConfig.getLabel())
|
||||
@ -142,11 +143,11 @@ public class DossierTemplateControllerV2 implements DossierTemplateResource {
|
||||
.mappedCsvColumnHeader(fileAttributeConfig.getCsvColumnHeader())
|
||||
.reportingPlaceholder(fileAttributeConfig.getPlaceholder())
|
||||
.displaySettings(FileAttributeDefinition.DisplaySettings.builder()
|
||||
.primaryAttribute(fileAttributeConfig.isPrimaryAttribute())
|
||||
.editable(fileAttributeConfig.isEditable())
|
||||
.filterable(fileAttributeConfig.isFilterable())
|
||||
.displayedInFileList(fileAttributeConfig.isDisplayedInFileList())
|
||||
.build())
|
||||
.primaryAttribute(fileAttributeConfig.isPrimaryAttribute())
|
||||
.editable(fileAttributeConfig.isEditable())
|
||||
.filterable(fileAttributeConfig.isFilterable())
|
||||
.displayedInFileList(fileAttributeConfig.isDisplayedInFileList())
|
||||
.build())
|
||||
.build())
|
||||
.toList();
|
||||
|
||||
@ -188,11 +189,11 @@ public class DossierTemplateControllerV2 implements DossierTemplateResource {
|
||||
}
|
||||
|
||||
auditPersistenceService.audit(AuditRequest.builder()
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(rulesUploadRequest.getDossierTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message(String.format("%s rules have been %s", rulesUploadRequest.getRuleFileType(), dryRun ? "validated" : "updated"))
|
||||
.build());
|
||||
.userId(KeycloakSecurity.getUserId())
|
||||
.objectId(rulesUploadRequest.getDossierTemplateId())
|
||||
.category(AuditCategory.DOSSIER_TEMPLATE.name())
|
||||
.message(String.format("%s rules have been %s", rulesUploadRequest.getRuleFileType(), dryRun ? "validated" : "updated"))
|
||||
.build());
|
||||
|
||||
// TODO Add warning and deprecations to response
|
||||
return new ResponseEntity<>(RulesValidationResponse.builder().build(), HttpStatus.OK);
|
||||
@ -208,7 +209,8 @@ public class DossierTemplateControllerV2 implements DossierTemplateResource {
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
httpHeaders.setContentType(MediaType.TEXT_PLAIN);
|
||||
|
||||
httpHeaders.add("Content-Disposition", "attachment" + "; filename*=utf-8''" + StringEncodingUtils.urlEncode(ruleFileType.name().toLowerCase(Locale.ROOT) + RULES_DOWNLOAD_FILE_NAME_SUFFIX));
|
||||
httpHeaders.add("Content-Disposition",
|
||||
"attachment" + "; filename*=utf-8''" + StringEncodingUtils.urlEncode(ruleFileType.name().toLowerCase(Locale.ROOT) + RULES_DOWNLOAD_FILE_NAME_SUFFIX));
|
||||
|
||||
InputStream is = new ByteArrayInputStream(data);
|
||||
|
||||
|
||||
@ -4,8 +4,10 @@ import com.iqser.red.persistence.service.v1.external.api.impl.controller.License
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.license.LicenseReport;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.license.LicenseReportRequest;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.resource.LicenseResource;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -16,7 +18,9 @@ public class LicenseControllerV2 implements LicenseResource {
|
||||
|
||||
private final LicenseReportController licenseReportController;
|
||||
|
||||
|
||||
public LicenseReport getReport(@RequestBody LicenseReportRequest reportRequest) {
|
||||
|
||||
return licenseReportController.getReport(reportRequest);
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.external.resource;
|
||||
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@ -107,7 +107,8 @@ public interface DictionaryResource {
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@PostMapping(value = TYPE_PATH, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Creates entry type with colors, hint and caseInsensitive", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "Successfully created the entry type with colors, hint " + "and caseInsensitive"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "409", description = "The entry type already exists, could not be added again.")})
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "Successfully created the entry type with colors, hint "
|
||||
+ "and caseInsensitive"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "409", description = "The entry type already exists, could not be added again.")})
|
||||
TypeValue addType(@RequestBody CreateTypeValue typeValue);
|
||||
|
||||
|
||||
@ -115,16 +116,14 @@ public interface DictionaryResource {
|
||||
@DeleteMapping(value = TYPE_PATH + TYPE_PATH_VARIABLE + DOSSIER_TEMPLATE_PATH_VARIABLE)
|
||||
@Operation(summary = "Deletes entry type", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "Successfully deleted the entry type with value and all its entries"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The entry type is not found.")})
|
||||
void deleteType(@PathVariable(TYPE_PARAMETER_NAME) String type,
|
||||
@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId);
|
||||
void deleteType(@PathVariable(TYPE_PARAMETER_NAME) String type, @PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId);
|
||||
|
||||
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
@PostMapping(value = TYPE_PATH + DOSSIER_TEMPLATE_PATH_VARIABLE + DELETE)
|
||||
@Operation(summary = "Deletes entry types", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "Successfully deleted the entry types with value and all their entries"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The entry type is not found.")})
|
||||
void deleteTypes(@RequestBody List<String> types,
|
||||
@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId);
|
||||
void deleteTypes(@RequestBody List<String> types, @PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId);
|
||||
|
||||
|
||||
@GetMapping(value = TYPE_PATH + DOSSIER_TEMPLATE_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ -137,7 +136,8 @@ public interface DictionaryResource {
|
||||
|
||||
@GetMapping(value = DICTIONARY_REST_PATH + TYPE_PATH_VARIABLE + DOSSIER_TEMPLATE_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Retrieves all dictionary entries of an entry type", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Successfully retrieved all the dictionary entries of " + "the entry type."), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The dossier or the entry type is not found.")})
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Successfully retrieved all the dictionary entries of "
|
||||
+ "the entry type."), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The dossier or the entry type is not found.")})
|
||||
Dictionary getDictionaryForType(@PathVariable(TYPE_PARAMETER_NAME) String type,
|
||||
@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId,
|
||||
@RequestParam(value = DOSSIER_ID_PARAMETER_NAME, required = false) String dossierId);
|
||||
@ -174,12 +174,14 @@ public interface DictionaryResource {
|
||||
@RequestParam(value = DOSSIER_ID_PARAMETER_NAME, required = false) String dossierId,
|
||||
@RequestParam(value = DICTIONARY_ENTRY_TYPE_PARAM, required = false, defaultValue = DEFAULT_DICTIONARY_ENTRY_TYPE) DictionaryEntryType dictionaryEntryType);
|
||||
|
||||
@GetMapping(value = DICTIONARY_REST_PATH + MERGED + TYPE_PATH_VARIABLE+ DOSSIER_TEMPLATE_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@GetMapping(value = DICTIONARY_REST_PATH + MERGED + TYPE_PATH_VARIABLE + DOSSIER_TEMPLATE_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Retrieves the merged dictionary for the given type, dossier template and dossier", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Successfully retrieved all the dictionary entries"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The dossier or the entry type is not found.")})
|
||||
Dictionary getMergedDictionaries(@PathVariable(TYPE_PARAMETER_NAME) String type,
|
||||
@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId,
|
||||
@RequestParam(value = DOSSIER_ID_PARAMETER_NAME) String dossierId);
|
||||
@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId,
|
||||
@RequestParam(value = DOSSIER_ID_PARAMETER_NAME) String dossierId);
|
||||
|
||||
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
@Operation(summary = "Set system colors for redaction")
|
||||
|
||||
@ -48,7 +48,9 @@ public interface DossierAttributesResource {
|
||||
@Operation(summary = "Set dossier attributes base configuration.", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
||||
|
||||
@PutMapping(value = DOSSIER_ATTRIBUTES_PATH + CONFIG_PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PutMapping(value = DOSSIER_ATTRIBUTES_PATH
|
||||
+ CONFIG_PATH
|
||||
+ DOSSIER_TEMPLATE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
DossierAttributesConfig setDossierAttributesConfig(@PathVariable(DOSSIER_TEMPLATE_ID) String dossierTemplateId, @RequestBody DossierAttributesConfig dossierAttributesConfig);
|
||||
|
||||
|
||||
@ -56,7 +58,9 @@ public interface DossierAttributesResource {
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@Operation(summary = "Add or update a dossier attribute in base configuration.", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
||||
@PostMapping(value = DOSSIER_ATTRIBUTES_PATH + CONFIG_PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = DOSSIER_ATTRIBUTES_PATH
|
||||
+ CONFIG_PATH
|
||||
+ DOSSIER_TEMPLATE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
DossierAttributeConfig addOrUpdateDossierAttributeConfig(@PathVariable(DOSSIER_TEMPLATE_ID) String dossierTemplateId, @RequestBody DossierAttributeConfig dossierAttributes);
|
||||
|
||||
|
||||
|
||||
@ -70,7 +70,8 @@ public interface DownloadResource {
|
||||
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@Operation(summary = "Returns a oneTimeToken for a requested download", description = "Use the optional \"inline\" request parameter " + "to select, if this report will be opened in the browser.")
|
||||
@Operation(summary = "Returns a oneTimeToken for a requested download", description = "Use the optional \"inline\" request parameter "
|
||||
+ "to select, if this report will be opened in the browser.")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
||||
@PostMapping(value = REST_PATH + GENERATE_OTT_PATH)
|
||||
JSONPrimitive<String> generateOneTimeToken(@RequestBody JSONPrimitive<String> storageIdWrapper);
|
||||
|
||||
@ -31,9 +31,11 @@ public interface EntityLogResource {
|
||||
|
||||
String FALSE = "false";
|
||||
|
||||
|
||||
@GetMapping(value = ENTITY_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Gets the entity log for a fileId", description = "Gets the entity log for a given file. The flag includeUnprocessed will merge into the entity log all the unprocessed changes if it's set to true." +
|
||||
"Default value for the flag is false.")
|
||||
@Operation(summary = "Gets the entity log for a fileId", description =
|
||||
"Gets the entity log for a given file. The flag includeUnprocessed will merge into the entity log all the unprocessed changes if it's set to true."
|
||||
+ "Default value for the flag is false.")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The dossier / file / entity log is not found.")})
|
||||
EntityLog getEntityLog(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
|
||||
@ -5,4 +5,5 @@ public interface ExternalApi {
|
||||
// String BASE_PATH = "/api";
|
||||
|
||||
String BASE_PATH = "/redaction-gateway-v1";
|
||||
|
||||
}
|
||||
|
||||
@ -51,7 +51,10 @@ public interface FileAttributesResource {
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@Operation(summary = "Set file attributes base configuration and a list of file attributes, ", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
||||
@PutMapping(value = FILE_ATTRIBUTES_PATH + CONFIG_PATH + BASE_CONFIG_PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PutMapping(value = FILE_ATTRIBUTES_PATH
|
||||
+ CONFIG_PATH
|
||||
+ BASE_CONFIG_PATH
|
||||
+ DOSSIER_TEMPLATE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
FileAttributesConfig setFileAttributesConfig(@PathVariable(DOSSIER_TEMPLATE_ID) String dossierTemplateId, @RequestBody FileAttributesConfig fileAttributesConfig);
|
||||
|
||||
|
||||
@ -59,8 +62,11 @@ public interface FileAttributesResource {
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@Operation(summary = "Add or update a file attribute that can be used at importing csv.", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
||||
@PostMapping(value = FILE_ATTRIBUTES_PATH + CONFIG_PATH + FILE_ATTRIBUTE_PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
FileAttributeConfig addOrUpdateFileAttribute(@PathVariable(DOSSIER_TEMPLATE_ID) String dossierTemplateId,@Valid @RequestBody FileAttributeConfig fileAttributes);
|
||||
@PostMapping(value = FILE_ATTRIBUTES_PATH
|
||||
+ CONFIG_PATH
|
||||
+ FILE_ATTRIBUTE_PATH
|
||||
+ DOSSIER_TEMPLATE_ID_PATH_VARIABLE, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
FileAttributeConfig addOrUpdateFileAttribute(@PathVariable(DOSSIER_TEMPLATE_ID) String dossierTemplateId, @Valid @RequestBody FileAttributeConfig fileAttributes);
|
||||
|
||||
|
||||
@ResponseBody
|
||||
|
||||
@ -42,7 +42,12 @@ public interface HighlightsResource {
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
@Operation(summary = "Converts highlights to imported redactions", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
@PostMapping(value = DOSSIERS_PATH + DOSSIER_ID_PATH_VARIABLE + FILES_PATH + FILE_ID_PATH_VARIABLE + HIGHLIGHTS_PATH + CONVERT_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = DOSSIERS_PATH
|
||||
+ DOSSIER_ID_PATH_VARIABLE
|
||||
+ FILES_PATH
|
||||
+ FILE_ID_PATH_VARIABLE
|
||||
+ HIGHLIGHTS_PATH
|
||||
+ CONVERT_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
void convertHighlights(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody AnnotationIds annotationIds);
|
||||
|
||||
|
||||
@ -56,7 +61,12 @@ public interface HighlightsResource {
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
@Operation(summary = "Deletes wrong imported redactions for a file", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
@PostMapping(value = DOSSIERS_PATH + DOSSIER_ID_PATH_VARIABLE + FILES_PATH + FILE_ID_PATH_VARIABLE + IMPORTED_REDACTIONS_PATH + DELETE_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = DOSSIERS_PATH
|
||||
+ DOSSIER_ID_PATH_VARIABLE
|
||||
+ FILES_PATH
|
||||
+ FILE_ID_PATH_VARIABLE
|
||||
+ IMPORTED_REDACTIONS_PATH
|
||||
+ DELETE_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
void deleteImportedRedactions(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody AnnotationIds annotationIds);
|
||||
|
||||
}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.external.resource;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.saas.migration.MigrationStatusResponse;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -23,31 +25,32 @@ public interface MigrationStatusResource {
|
||||
String DOSSIER_ID = "dossierId";
|
||||
String DOSSIER_ID_PATH_VARIABLE = "/{" + DOSSIER_ID + "}";
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping(value = MIGRATION_STATUS_REST_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Show the status of the migration", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Success.")})
|
||||
MigrationStatusResponse migrationStatus();
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping(value = START_MIGRATION_REST_PATH + FILE_ID_PATH_VARIABLE + DOSSIER_ID_PATH_VARIABLE)
|
||||
@Operation(summary = "Start SAAS migration for specific file", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Success.")})
|
||||
ResponseEntity<?> startMigrationForFile(@RequestParam(value = DOSSIER_ID) String dossierId, @RequestParam(value = FILE_ID) String fileId);
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping(value = REVERT_MIGRATION_REST_PATH + FILE_ID_PATH_VARIABLE + DOSSIER_ID_PATH_VARIABLE)
|
||||
@Operation(summary = "Start SAAS migration for specific file", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Success.")})
|
||||
ResponseEntity<?> revertMigrationForFile(@RequestParam(value = DOSSIER_ID) String dossierId, @RequestParam(value = FILE_ID) String fileId);
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping(value = RETRY_MIGRATION_REST_PATH)
|
||||
@Operation(summary = "Restart SAAS migration for all files in error state", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Success.")})
|
||||
ResponseEntity<?> requeueErrorFiles();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -48,7 +48,8 @@ public interface ReportTemplateResource {
|
||||
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.CREATED)
|
||||
@PostMapping(value = REPORT_TEMPLATE_UPLOAD_PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = REPORT_TEMPLATE_UPLOAD_PATH
|
||||
+ DOSSIER_TEMPLATE_ID_PATH_VARIABLE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Upload template file for redaction-report", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "201", description = "Report template upload succeeded.")})
|
||||
ReportTemplate uploadTemplate(@Schema(type = "string", format = "binary", name = "file") @RequestPart(name = "file") MultipartFile file,
|
||||
|
||||
@ -33,7 +33,8 @@ public interface UploadResource {
|
||||
@ResponseStatus(value = HttpStatus.CREATED)
|
||||
@PostMapping(value = UPLOAD_PATH + DOSSIER_ID_PATH_VARIABLE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Receives an uploaded file and returns its fileId.", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "201", description = "File upload succeeded. Return the fileId of the " + "uploaded file."), @ApiResponse(responseCode = "404", description = "Dossier not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "201", description = "File upload succeeded. Return the fileId of the "
|
||||
+ "uploaded file."), @ApiResponse(responseCode = "404", description = "Dossier not found"), @ApiResponse(responseCode = "403", description = "Forbidden")})
|
||||
FileUploadResult upload(@Schema(type = "string", format = "binary", name = "file") @RequestPart(name = "file") MultipartFile file,
|
||||
@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@RequestParam(value = "keepManualRedactions", required = false, defaultValue = "false") boolean keepManualRedactions);
|
||||
|
||||
@ -18,7 +18,7 @@ import lombok.NonNull;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(name="DossierRequest", description = "Object containing information about a dossier.")
|
||||
@Schema(name = "DossierRequest", description = "Object containing information about a dossier.")
|
||||
public class DocuMineDossierRequest {
|
||||
|
||||
@Schema(description = "The id of the dossier, can be null for create requests.")
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.iqser.red.service.persistence.service.v2.api.external.model;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.Dossier;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@ -17,4 +18,5 @@ public class DossierList {
|
||||
|
||||
@Builder.Default
|
||||
private List<Dossier> dossiers = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
@ -26,9 +26,12 @@ public class FileAttributeDefinition {
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class DisplaySettings {
|
||||
|
||||
private boolean primaryAttribute;
|
||||
private boolean editable;
|
||||
private boolean filterable;
|
||||
private boolean displayedInFileList;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ public class FileAttributeDefinitionList {
|
||||
@Builder.Default
|
||||
private List<FileAttributeDefinition> fileAttributeDefinitions = new ArrayList<>();
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@ -39,11 +38,14 @@ public class FileAttributeDefinitionList {
|
||||
@Builder.Default
|
||||
private String encoding = StandardCharsets.UTF_8.name();
|
||||
|
||||
|
||||
// TODO: make csvMappingActive a persistent value instead of a transient one when implementing the endpoint to set the csv mapping
|
||||
@JsonProperty("csvMappingActive")
|
||||
public boolean isCsvMappingActive() {
|
||||
|
||||
return StringUtils.isNotBlank(filenameMappingCsvColumnHeader);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,4 +18,5 @@ public class FileComponentsList {
|
||||
|
||||
@Builder.Default
|
||||
private List<FileComponents> files = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
@ -16,4 +16,5 @@ public class FileDeleteRequest {
|
||||
|
||||
@Builder.Default
|
||||
private List<String> fileIds = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.iqser.red.service.persistence.service.v2.api.external.model;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileStatus;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@ -17,4 +18,5 @@ public class FileStatusList {
|
||||
|
||||
@Builder.Default
|
||||
private List<FileStatus> files = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
@ -54,64 +54,49 @@ public interface DossierTemplateResource {
|
||||
|
||||
@GetMapping(value = PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Get a specific DossierTemplate by its identifier.", description = "None")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "Get a specific DossierTemplate by its identifier."),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")
|
||||
})
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Get a specific DossierTemplate by its identifier."), @ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")})
|
||||
DossierTemplateModel getDossierTemplate(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
@PostMapping(value = PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + ENTITY_RULES_PATH, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Upload a component or entity rules file in drools format for a specific DossierTemplate.")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "Rules upload successful."),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found."),
|
||||
@ApiResponse(responseCode = "422", description = "Uploaded rules could not be verified.")
|
||||
})
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Rules upload successful."), @ApiResponse(responseCode = "404", description = "The DossierTemplate is not found."), @ApiResponse(responseCode = "422", description = "Uploaded rules could not be verified.")})
|
||||
ResponseEntity<RulesValidationResponse> uploadEntityRules(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
|
||||
@Schema(type = "string", format = "binary", name = "file") @RequestPart(name = "file") MultipartFile file,
|
||||
@Parameter(name = DRY_RUN_PARAM, description = "If true rules will be only validated not stored.") @RequestParam(value = DRY_RUN_PARAM, required = false ,defaultValue = "false") boolean dryRun);
|
||||
@Schema(type = "string", format = "binary", name = "file") @RequestPart(name = "file") MultipartFile file,
|
||||
@Parameter(name = DRY_RUN_PARAM, description = "If true rules will be only validated not stored.") @RequestParam(value = DRY_RUN_PARAM, required = false, defaultValue = "false") boolean dryRun);
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@Operation(summary = "Returns file containing the currently used entity rules.")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")
|
||||
})
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")})
|
||||
@GetMapping(value = PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + ENTITY_RULES_PATH)
|
||||
ResponseEntity<?> downloadEntityRules(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId);
|
||||
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
@PostMapping(value = PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + COMPONENT_RULES_PATH, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = PATH
|
||||
+ DOSSIER_TEMPLATE_ID_PATH_VARIABLE
|
||||
+ COMPONENT_RULES_PATH, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Upload a component or entity rules file in drools format for a specific DossierTemplate.")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "Rules upload successful."),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found."),
|
||||
@ApiResponse(responseCode = "422", description = "Uploaded rules could not be verified.")
|
||||
})
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Rules upload successful."), @ApiResponse(responseCode = "404", description = "The DossierTemplate is not found."), @ApiResponse(responseCode = "422", description = "Uploaded rules could not be verified.")})
|
||||
ResponseEntity<RulesValidationResponse> uploadComponentRules(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
|
||||
@Schema(type = "string", format = "binary", name = "file") @RequestPart(name = "file") MultipartFile file,
|
||||
@Parameter(name = DRY_RUN_PARAM, description = "If true rules will be only validated not stored.") @RequestParam(value = DRY_RUN_PARAM, required = false ,defaultValue = "false") boolean dryRun);
|
||||
@Schema(type = "string", format = "binary", name = "file") @RequestPart(name = "file") MultipartFile file,
|
||||
@Parameter(name = DRY_RUN_PARAM, description = "If true rules will be only validated not stored.") @RequestParam(value = DRY_RUN_PARAM, required = false, defaultValue = "false") boolean dryRun);
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@Operation(summary = "Returns file containing the currently used component rules.")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")
|
||||
})
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")})
|
||||
@GetMapping(value = PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + COMPONENT_RULES_PATH)
|
||||
ResponseEntity<?> downloadComponentRules(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId);
|
||||
|
||||
|
||||
@Operation(summary = "Get the file attribute definitions of a DossierTemplate.", description = "None")
|
||||
@GetMapping(value = PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + FILE_ATTRIBUTE_DEFINITIONS_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "File attribute definitions returned successfully."),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")
|
||||
})
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "File attribute definitions returned successfully."), @ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")})
|
||||
FileAttributeDefinitionList getFileAttributeDefinitions(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId);
|
||||
|
||||
}
|
||||
|
||||
@ -2,9 +2,11 @@ package com.iqser.red.service.persistence.service.v2.api.external.resource;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.license.LicenseReport;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.license.LicenseReportRequest;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -20,6 +22,7 @@ public interface LicenseResource {
|
||||
|
||||
String ACTIVE_USAGE_PATH = "/active/usage";
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = PATH + ACTIVE_USAGE_PATH, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@ -30,6 +30,7 @@ public class DossierTemplateInternalController implements DossierTemplateResourc
|
||||
return convert(dossierTemplatePersistenceService.getDossierTemplate(dossierTemplateId), DossierTemplate.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DossierTemplate getDossierTemplateById(String dossierTemplateId) {
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ public class EntityLogInternalController implements EntityLogResource {
|
||||
|
||||
private final EntityLogService entityLogService;
|
||||
|
||||
|
||||
@Override
|
||||
public EntityLog getEntityLog(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@ -27,5 +28,4 @@ public class EntityLogInternalController implements EntityLogResource {
|
||||
return entityLogService.getEntityLog(dossierId, fileId, excludedTypes, includeUnprocessed);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -22,7 +22,10 @@ public class FileStatusInternalController implements StatusResource {
|
||||
@Override
|
||||
public List<FileModel> getDossierStatus(@PathVariable(DOSSIER_ID_PARAM) String dossierId) {
|
||||
|
||||
return fileStatusService.getDossierStatus(dossierId).stream().filter(f -> !f.isSoftOrHardDeleted()).collect(Collectors.toList());
|
||||
return fileStatusService.getDossierStatus(dossierId)
|
||||
.stream()
|
||||
.filter(f -> !f.isSoftOrHardDeleted())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -36,13 +36,16 @@ public class FileStatusProcessingUpdateInternalController implements FileStatusP
|
||||
|
||||
public void preprocessingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
||||
|
||||
fileStatusProcessingUpdateService.preprocessingFailed(dossierId, fileId, new FileErrorInfo("preprocessing failed",
|
||||
MessagingConfiguration.PRE_PROCESSING_DLQ, "pdftron-service", OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS)));
|
||||
fileStatusProcessingUpdateService.preprocessingFailed(dossierId,
|
||||
fileId,
|
||||
new FileErrorInfo("preprocessing failed",
|
||||
MessagingConfiguration.PRE_PROCESSING_DLQ,
|
||||
"pdftron-service",
|
||||
OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS)));
|
||||
}
|
||||
|
||||
|
||||
public void preprocessingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody FileErrorInfo fileErrorInfo) {
|
||||
public void preprocessingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody FileErrorInfo fileErrorInfo) {
|
||||
|
||||
fileStatusProcessingUpdateService.preprocessingFailed(dossierId, fileId, fileErrorInfo);
|
||||
}
|
||||
@ -66,8 +69,7 @@ public class FileStatusProcessingUpdateInternalController implements FileStatusP
|
||||
}
|
||||
|
||||
|
||||
public void analysisFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody FileErrorInfo fileErrorInfo) {
|
||||
public void analysisFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody FileErrorInfo fileErrorInfo) {
|
||||
|
||||
fileStatusProcessingUpdateService.analysisFailed(dossierId, fileId, fileErrorInfo);
|
||||
}
|
||||
@ -87,13 +89,16 @@ public class FileStatusProcessingUpdateInternalController implements FileStatusP
|
||||
|
||||
public void ocrFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
||||
|
||||
fileStatusProcessingUpdateService.ocrFailed(dossierId, fileId, new FileErrorInfo("ocr failed",
|
||||
MessagingConfiguration.OCR_DLQ, "ocr-service", OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS)));
|
||||
fileStatusProcessingUpdateService.ocrFailed(dossierId,
|
||||
fileId,
|
||||
new FileErrorInfo("ocr failed",
|
||||
MessagingConfiguration.OCR_DLQ,
|
||||
"ocr-service",
|
||||
OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS)));
|
||||
}
|
||||
|
||||
|
||||
public void ocrFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody FileErrorInfo fileErrorInfo) {
|
||||
public void ocrFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody FileErrorInfo fileErrorInfo) {
|
||||
|
||||
fileStatusProcessingUpdateService.ocrFailed(dossierId, fileId, fileErrorInfo);
|
||||
}
|
||||
@ -113,12 +118,16 @@ public class FileStatusProcessingUpdateInternalController implements FileStatusP
|
||||
|
||||
public void indexingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
||||
|
||||
fileStatusProcessingUpdateService.indexingFailed(dossierId, fileId, new FileErrorInfo("indexing failed",
|
||||
MessagingConfiguration.INDEXING_DQL, "search-service", OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS)));
|
||||
fileStatusProcessingUpdateService.indexingFailed(dossierId,
|
||||
fileId,
|
||||
new FileErrorInfo("indexing failed",
|
||||
MessagingConfiguration.INDEXING_DQL,
|
||||
"search-service",
|
||||
OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS)));
|
||||
}
|
||||
|
||||
public void indexingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody FileErrorInfo fileErrorInfo) {
|
||||
|
||||
public void indexingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody FileErrorInfo fileErrorInfo) {
|
||||
|
||||
fileStatusProcessingUpdateService.indexingFailed(dossierId, fileId, fileErrorInfo);
|
||||
}
|
||||
|
||||
@ -2,8 +2,10 @@ package com.iqser.red.service.persistence.v1.internal.api.controller;
|
||||
|
||||
import com.iqser.red.commons.spring.ErrorMessage;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
@ -74,6 +76,7 @@ public class InternalControllerAdvice {
|
||||
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@Hidden
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
|
||||
@ -109,12 +112,14 @@ public class InternalControllerAdvice {
|
||||
@ExceptionHandler(value = MethodArgumentNotValidException.class)
|
||||
public ErrorMessage handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
|
||||
|
||||
|
||||
var errorList = e.getFieldErrors();
|
||||
String errorListAsString = errorList.stream().map(fieldError -> fieldError.getField() + ": " + fieldError.getDefaultMessage()).collect(Collectors.joining(", "));
|
||||
String errorListAsString = errorList.stream()
|
||||
.map(fieldError -> fieldError.getField() + ": " + fieldError.getDefaultMessage())
|
||||
.collect(Collectors.joining(", "));
|
||||
return new ErrorMessage(OffsetDateTime.now(), String.format("You have empty/wrong formatted parameters: %s", errorListAsString));
|
||||
}
|
||||
|
||||
|
||||
@Hidden
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
|
||||
@ -91,11 +91,11 @@ public class AdminInterfaceController {
|
||||
|
||||
for (var file : filesThatRequireOCR) {
|
||||
log.info("Will OCR file: {} from dossier {} with status {} and processing status {} with last OCR time {}",
|
||||
file.getId(),
|
||||
file.getDossierId(),
|
||||
file.getWorkflowStatus(),
|
||||
file.getProcessingStatus(),
|
||||
file.getOcrStartTime());
|
||||
file.getId(),
|
||||
file.getDossierId(),
|
||||
file.getWorkflowStatus(),
|
||||
file.getProcessingStatus(),
|
||||
file.getOcrStartTime());
|
||||
|
||||
if (!dryRun) {
|
||||
fileStatusService.validateFileIsNotDeletedAndNotApproved(file.getId());
|
||||
@ -129,11 +129,11 @@ public class AdminInterfaceController {
|
||||
|
||||
for (var file : filesThatRequireTextReset) {
|
||||
log.info("Will OCR file: {} from dossier {} with status {} and processing status {} with last OCR time {}",
|
||||
file.getId(),
|
||||
file.getDossierId(),
|
||||
file.getWorkflowStatus(),
|
||||
file.getProcessingStatus(),
|
||||
file.getOcrStartTime());
|
||||
file.getId(),
|
||||
file.getDossierId(),
|
||||
file.getWorkflowStatus(),
|
||||
file.getProcessingStatus(),
|
||||
file.getOcrStartTime());
|
||||
|
||||
if (!dryRun) {
|
||||
|
||||
|
||||
@ -36,30 +36,30 @@ public interface DictionaryResource {
|
||||
String VERSION_PATH = "/version";
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH+TYPE_PATH + DOSSIER_TEMPLATE_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(value = InternalApi.BASE_PATH + TYPE_PATH + DOSSIER_TEMPLATE_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
List<Type> getAllTypesForDossierTemplate(@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId,
|
||||
@RequestParam(value = INCLUDE_DELETED_PARAMETER_NAME, required = false, defaultValue = "false") boolean includeDeleted);
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH+TYPE_PATH + DOSSIER_PATH + DOSSIER_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(value = InternalApi.BASE_PATH + TYPE_PATH + DOSSIER_PATH + DOSSIER_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
List<Type> getAllTypesForDossier(@PathVariable(DOSSIER_ID_PARAMETER_NAME) String dossierId,
|
||||
@RequestParam(value = INCLUDE_DELETED_PARAMETER_NAME, required = false, defaultValue = "false") boolean includeDeleted);
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH+DICTIONARY_PATH + TYPE_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(value = InternalApi.BASE_PATH + DICTIONARY_PATH + TYPE_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
Type getDictionaryForType(@PathVariable(TYPE_PARAMETER_NAME) String typeId, @RequestParam(value = FROM_VERSION_PARAM, required = false) Long fromVersion);
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH+VERSION_PATH + DOSSIER_TEMPLATE_PATH_VARIABLE)
|
||||
@GetMapping(value = InternalApi.BASE_PATH + VERSION_PATH + DOSSIER_TEMPLATE_PATH_VARIABLE)
|
||||
long getVersion(@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId);
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH+VERSION_PATH + DOSSIER_PATH + DOSSIER_ID_PATH_VARIABLE)
|
||||
@GetMapping(value = InternalApi.BASE_PATH + VERSION_PATH + DOSSIER_PATH + DOSSIER_ID_PATH_VARIABLE)
|
||||
long getVersionForDossier(@PathVariable(DOSSIER_ID_PARAMETER_NAME) String dossierId);
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping(value = InternalApi.BASE_PATH+COLOR_PATH + DOSSIER_TEMPLATE_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(value = InternalApi.BASE_PATH + COLOR_PATH + DOSSIER_TEMPLATE_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
Colors getColors(@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId);
|
||||
|
||||
}
|
||||
|
||||
@ -17,15 +17,15 @@ public interface DigitalSignatureResource {
|
||||
String DIGITAL_SIGNATURE_KMS_PATH = DIGITAL_SIGNATURE_PATH + "/kms";
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH+DIGITAL_SIGNATURE_TYPE_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(value = InternalApi.BASE_PATH + DIGITAL_SIGNATURE_TYPE_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
DigitalSignatureType getActiveDigitalSignatureType();
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH+DIGITAL_SIGNATURE_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(value = InternalApi.BASE_PATH + DIGITAL_SIGNATURE_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
DigitalSignature getDigitalSignature();
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH+DIGITAL_SIGNATURE_KMS_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(value = InternalApi.BASE_PATH + DIGITAL_SIGNATURE_KMS_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
DigitalSignatureKms getDigitalSignatureKms();
|
||||
|
||||
}
|
||||
|
||||
@ -20,10 +20,12 @@ public interface DossierTemplateResource {
|
||||
|
||||
String DOSSIER_ID_PATH_PARAM = "/{" + DOSSIER_TEMPLATE_ID_PARAM + "}";
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping(value = InternalApi.BASE_PATH + DOSSIER_TEMPLATE_PATH + IMPORT_PATH, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
DossierTemplate importDossierTemplate(@RequestBody ImportDossierTemplateRequest request);
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH + DOSSIER_TEMPLATE_PATH + DOSSIER_ID_PATH_PARAM, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
DossierTemplate getDossierTemplateById(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId);
|
||||
|
||||
|
||||
@ -25,10 +25,12 @@ public interface EntityLogResource {
|
||||
|
||||
String FALSE = "false";
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping(value = InternalApi.BASE_PATH + ENTITY_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
EntityLog getEntityLog(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestParam(value = "excludedType", required = false) List<String> excludedTypes,
|
||||
@RequestParam(value = "includeUnprocessed", required = false, defaultValue = FALSE) boolean includeUnprocessed);
|
||||
|
||||
}
|
||||
|
||||
@ -22,20 +22,25 @@ public interface FileStatusProcessingUpdateResource {
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/preprocessing-successful", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = InternalApi.BASE_PATH
|
||||
+ STATUS_PATH
|
||||
+ DOSSIER_ID_PATH_PARAM
|
||||
+ FILE_ID_PATH_VARIABLE
|
||||
+ "/preprocessing-successful", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
void preprocessingSuccessful(@PathVariable(DOSSIER_ID_PARAM) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody UntouchedDocumentResponse untouchedDocumentResponse);
|
||||
|
||||
|
||||
@Deprecated
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/preprocessing-failed")
|
||||
void preprocessingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/preprocessing-failed-error")
|
||||
void preprocessingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody FileErrorInfo fileErrorInfo);
|
||||
void preprocessingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody FileErrorInfo fileErrorInfo);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@ -56,8 +61,7 @@ public interface FileStatusProcessingUpdateResource {
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/analysis-failed-error")
|
||||
void analysisFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody FileErrorInfo fileErrorInfo);
|
||||
void analysisFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody FileErrorInfo fileErrorInfo);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@ -78,8 +82,7 @@ public interface FileStatusProcessingUpdateResource {
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/ocr-failed-error")
|
||||
void ocrFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody FileErrorInfo fileErrorInfo);
|
||||
void ocrFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody FileErrorInfo fileErrorInfo);
|
||||
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@ -100,7 +103,6 @@ public interface FileStatusProcessingUpdateResource {
|
||||
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/indexing-failed-error")
|
||||
void indexingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
|
||||
@RequestBody FileErrorInfo fileErrorInfo);
|
||||
void indexingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody FileErrorInfo fileErrorInfo);
|
||||
|
||||
}
|
||||
|
||||
@ -2,5 +2,6 @@ package com.iqser.red.service.persistence.service.v1.api.internal.resources;
|
||||
|
||||
public interface InternalApi {
|
||||
|
||||
String BASE_PATH = "/internal-api";
|
||||
String BASE_PATH = "/internal-api";
|
||||
|
||||
}
|
||||
|
||||
@ -23,7 +23,10 @@ public interface ReportTemplateResource {
|
||||
List<ReportTemplate> getAvailableReportTemplates(@PathVariable(DOSSIER_TEMPLATE_ID) String dossierTemplateId);
|
||||
|
||||
|
||||
@GetMapping(value = InternalApi.BASE_PATH + REPORT_TEMPLATE_UPLOAD_PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + TEMPLATE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(value = InternalApi.BASE_PATH
|
||||
+ REPORT_TEMPLATE_UPLOAD_PATH
|
||||
+ DOSSIER_TEMPLATE_ID_PATH_VARIABLE
|
||||
+ TEMPLATE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ReportTemplate getReportTemplate(@PathVariable(DOSSIER_TEMPLATE_ID) String dossierTemplateId, @PathVariable(TEMPLATE_ID) String templateId);
|
||||
|
||||
}
|
||||
|
||||
@ -78,9 +78,11 @@ public class ACLBeanConfiguration {
|
||||
|
||||
@Bean
|
||||
public AclPermissionEvaluator defaultACLPermissionEvaluator() {
|
||||
|
||||
return new AclPermissionEvaluator(aclService());
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public MethodSecurityExpressionHandler defaultMethodSecurityExpressionHandler() {
|
||||
|
||||
@ -46,7 +46,9 @@ public class RedPermission extends AbstractPermission implements Permission {
|
||||
if (mask == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return ALL_PERMISSIONS.stream().filter(p -> p.getMask() == mask).findAny();
|
||||
return ALL_PERMISSIONS.stream()
|
||||
.filter(p -> p.getMask() == mask)
|
||||
.findAny();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -53,7 +53,8 @@ public abstract class ICustomPermissionService<T, ID extends Serializable> exten
|
||||
}
|
||||
|
||||
|
||||
public void applyCustomPermissions(CustomPermissionMappingModel customPermissionMappingModel, MutableAcl acl){
|
||||
public void applyCustomPermissions(CustomPermissionMappingModel customPermissionMappingModel, MutableAcl acl) {
|
||||
|
||||
applyAces(acl, customPermissionMappingModel);
|
||||
}
|
||||
|
||||
@ -65,13 +66,19 @@ public abstract class ICustomPermissionService<T, ID extends Serializable> exten
|
||||
var redPermission = RedPermission.resolvePermission(model.getTargetPermission().getMask());
|
||||
|
||||
if (redPermission.isPresent()) {
|
||||
var masks = model.getMappedPermissions().stream().map(CustomPermissionModel::getMask).collect(Collectors.toSet());
|
||||
var masks = model.getMappedPermissions()
|
||||
.stream()
|
||||
.map(CustomPermissionModel::getMask)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
var principalsForCustomPermission = getSidsForMasks(acl, masks);
|
||||
|
||||
if (allowEveryoneElseSetting() && masks.contains(EVERYONE_ELSE.getMask())) {
|
||||
var allUserIds = getUserIds();
|
||||
var usersWithDefinedPermissions = getSidsForMasks(acl, definingPermissions().stream().map(AbstractPermission::getMask).collect(Collectors.toSet()));
|
||||
var usersWithDefinedPermissions = getSidsForMasks(acl,
|
||||
definingPermissions().stream()
|
||||
.map(AbstractPermission::getMask)
|
||||
.collect(Collectors.toSet()));
|
||||
allUserIds.removeAll(usersWithDefinedPermissions);
|
||||
|
||||
principalsForCustomPermission.addAll(allUserIds);
|
||||
@ -85,7 +92,8 @@ public abstract class ICustomPermissionService<T, ID extends Serializable> exten
|
||||
protected void clearAces(MutableAcl acl) {
|
||||
|
||||
for (var i = acl.getEntries().size() - 1; i >= 0; i--) {
|
||||
if (acl.getEntries().get(i).getPermission().getMask() == forPermission().getMask()) {
|
||||
if (acl.getEntries()
|
||||
.get(i).getPermission().getMask() == forPermission().getMask()) {
|
||||
acl.deleteAce(i);
|
||||
}
|
||||
}
|
||||
@ -113,7 +121,10 @@ public abstract class ICustomPermissionService<T, ID extends Serializable> exten
|
||||
|
||||
private Set<String> getUserIds() {
|
||||
|
||||
return usersClient.getAllUsers(true).stream().map(User::getUserId).collect(Collectors.toSet());
|
||||
return usersClient.getAllUsers(true)
|
||||
.stream()
|
||||
.map(User::getUserId)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ public final class CustomPermissionConstants {
|
||||
|
||||
public static final CustomPermissionModel EVERYONE_ELSE = new CustomPermissionModel(-1, "EVERYONE_ELSE", 100_000, true);
|
||||
|
||||
|
||||
private CustomPermissionConstants() {}
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.security.acls.model.MutableAclService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.acl.RedPermission;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.acl.custom.api.ICustomPermissionService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.client.tenantusermanagementservice.UsersClient;
|
||||
@ -17,9 +18,8 @@ public class AccessObjectDossierObjectPermissionService extends ICustomPermissio
|
||||
|
||||
private final DossierManagementService dossierManagementService;
|
||||
|
||||
public AccessObjectDossierObjectPermissionService(UsersClient usersClient,
|
||||
MutableAclService mutableAclService,
|
||||
DossierManagementService dossierManagementService) {
|
||||
|
||||
public AccessObjectDossierObjectPermissionService(UsersClient usersClient, MutableAclService mutableAclService, DossierManagementService dossierManagementService) {
|
||||
|
||||
super(usersClient, mutableAclService);
|
||||
this.dossierManagementService = dossierManagementService;
|
||||
@ -36,7 +36,10 @@ public class AccessObjectDossierObjectPermissionService extends ICustomPermissio
|
||||
@Override
|
||||
protected Collection<String> provideAllObjectIds() {
|
||||
|
||||
return dossierManagementService.getAllDossiers(true, true).stream().map(Dossier::getId).collect(Collectors.toList());
|
||||
return dossierManagementService.getAllDossiers(true, true)
|
||||
.stream()
|
||||
.map(Dossier::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -41,7 +41,10 @@ public class DossierACLService extends AbstractACLService<String> {
|
||||
@PostFilter("hasPermission(filterObject, 'Dossier', 'VIEW_OBJECT')")
|
||||
public List<String> getDossierIdsWithViewPermission() {
|
||||
|
||||
return dossierManagementService.getAllDossiers(true, true).stream().map(Dossier::getId).collect(Collectors.toList());
|
||||
return dossierManagementService.getAllDossiers(true, true)
|
||||
.stream()
|
||||
.map(Dossier::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@ -50,20 +53,21 @@ public class DossierACLService extends AbstractACLService<String> {
|
||||
ObjectIdentityImpl dossierIdentity = new ObjectIdentityImpl(getIdentifier(), dossierId);
|
||||
var acl = mutableAclService.readAclById(dossierIdentity);
|
||||
Set<String> members = new HashSet<>();
|
||||
acl.getEntries().forEach(entry -> {
|
||||
if (entry.getSid() instanceof PrincipalSid) {
|
||||
var principal = ((PrincipalSid) entry.getSid()).getPrincipal();
|
||||
if (entry.getPermission().getMask() == RedPermission.APPROVE.getMask()) {
|
||||
members.add(principal);
|
||||
}
|
||||
if (entry.getPermission().getMask() == RedPermission.REVIEW.getMask()) {
|
||||
members.add(principal);
|
||||
}
|
||||
if (entry.getPermission().getMask() == RedPermission.OWNER.getMask()) {
|
||||
members.add(principal);
|
||||
}
|
||||
}
|
||||
});
|
||||
acl.getEntries()
|
||||
.forEach(entry -> {
|
||||
if (entry.getSid() instanceof PrincipalSid) {
|
||||
var principal = ((PrincipalSid) entry.getSid()).getPrincipal();
|
||||
if (entry.getPermission().getMask() == RedPermission.APPROVE.getMask()) {
|
||||
members.add(principal);
|
||||
}
|
||||
if (entry.getPermission().getMask() == RedPermission.REVIEW.getMask()) {
|
||||
members.add(principal);
|
||||
}
|
||||
if (entry.getPermission().getMask() == RedPermission.OWNER.getMask()) {
|
||||
members.add(principal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return members;
|
||||
}
|
||||
|
||||
@ -82,22 +86,23 @@ public class DossierACLService extends AbstractACLService<String> {
|
||||
dossier.setOwnerId(null);
|
||||
dossier.getMemberIds().clear();
|
||||
dossier.getApproverIds().clear();
|
||||
acl.getEntries().forEach(entry -> {
|
||||
if (entry.getSid() instanceof PrincipalSid) {
|
||||
var principal = ((PrincipalSid) entry.getSid()).getPrincipal();
|
||||
if (entry.getPermission().getMask() == RedPermission.APPROVE.getMask()) {
|
||||
dossier.getApproverIds().add(principal);
|
||||
dossier.getMemberIds().add(principal);
|
||||
}
|
||||
if (entry.getPermission().getMask() == RedPermission.REVIEW.getMask()) {
|
||||
dossier.getMemberIds().add(principal);
|
||||
}
|
||||
if (entry.getPermission().getMask() == RedPermission.OWNER.getMask()) {
|
||||
dossier.getMemberIds().add(principal);
|
||||
dossier.setOwnerId(principal);
|
||||
}
|
||||
}
|
||||
});
|
||||
acl.getEntries()
|
||||
.forEach(entry -> {
|
||||
if (entry.getSid() instanceof PrincipalSid) {
|
||||
var principal = ((PrincipalSid) entry.getSid()).getPrincipal();
|
||||
if (entry.getPermission().getMask() == RedPermission.APPROVE.getMask()) {
|
||||
dossier.getApproverIds().add(principal);
|
||||
dossier.getMemberIds().add(principal);
|
||||
}
|
||||
if (entry.getPermission().getMask() == RedPermission.REVIEW.getMask()) {
|
||||
dossier.getMemberIds().add(principal);
|
||||
}
|
||||
if (entry.getPermission().getMask() == RedPermission.OWNER.getMask()) {
|
||||
dossier.getMemberIds().add(principal);
|
||||
dossier.setOwnerId(principal);
|
||||
}
|
||||
}
|
||||
});
|
||||
return dossier;
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,10 @@ public class ViewObjectDossierObjectPermissionService extends ICustomPermissionS
|
||||
@Override
|
||||
protected Collection<String> provideAllObjectIds() {
|
||||
|
||||
return dossierManagementService.getAllDossiers(true, true).stream().map(Dossier::getId).collect(Collectors.toList());
|
||||
return dossierManagementService.getAllDossiers(true, true)
|
||||
.stream()
|
||||
.map(Dossier::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,15 +5,15 @@ import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ACLInitializer {
|
||||
public class ACLInitializer {
|
||||
|
||||
private final List<IACLInitializer> aclInitializerList;
|
||||
|
||||
|
||||
public void run() {
|
||||
|
||||
aclInitializerList.sort(Comparator.comparingInt(IACLInitializer::sort));
|
||||
|
||||
@ -49,7 +49,9 @@ public class CustomPermissionService {
|
||||
|
||||
public Set<String> getAllSupportedTargetObjects() {
|
||||
|
||||
return customPermissionServices.stream().map(AbstractACLService::getIdentifier).collect(Collectors.toSet());
|
||||
return customPermissionServices.stream()
|
||||
.map(AbstractACLService::getIdentifier)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
|
||||
@ -76,7 +78,9 @@ public class CustomPermissionService {
|
||||
}
|
||||
|
||||
var key = fromPermission(targetPermission.get());
|
||||
var value = RedPermission.resolvePermission(permission.getExistingPermissionMask()).map(this::fromPermission).orElse(EVERYONE_ELSE);
|
||||
var value = RedPermission.resolvePermission(permission.getExistingPermissionMask())
|
||||
.map(this::fromPermission)
|
||||
.orElse(EVERYONE_ELSE);
|
||||
|
||||
var list = mapping.computeIfAbsent(key, entry -> new ArrayList<>());
|
||||
list.add(value);
|
||||
@ -112,10 +116,12 @@ public class CustomPermissionService {
|
||||
|
||||
|
||||
public void applyCustomPermissions(String targetObject, MutableAcl acl) {
|
||||
|
||||
var mappings = getCustomPermissionMappings(targetObject);
|
||||
applyToAcl(mappings, acl);
|
||||
}
|
||||
|
||||
|
||||
public void applyToAcl(List<CustomPermissionMappingModel> customPermissionMappingModels, MutableAcl acl) {
|
||||
|
||||
customPermissionMappingModels.forEach(p -> customPermissionServices.forEach(s -> {
|
||||
@ -125,6 +131,7 @@ public class CustomPermissionService {
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
public void apply(List<CustomPermissionMappingModel> customPermissionMappingModels, Serializable objectId) {
|
||||
|
||||
customPermissionMappingModels.forEach(p -> customPermissionServices.forEach(s -> {
|
||||
@ -161,7 +168,8 @@ public class CustomPermissionService {
|
||||
|
||||
CustomPermissionMappingModel cmp = new CustomPermissionMappingModel();
|
||||
List<CustomPermissionModel> permissionModels = new ArrayList<>();
|
||||
service.definingPermissions().forEach(dp -> permissionModels.add(fromPermission(dp)));
|
||||
service.definingPermissions()
|
||||
.forEach(dp -> permissionModels.add(fromPermission(dp)));
|
||||
|
||||
if (service.allowEveryoneElseSetting()) {
|
||||
permissionModels.add(EVERYONE_ELSE);
|
||||
@ -188,16 +196,20 @@ public class CustomPermissionService {
|
||||
// retrieve the defined configuration of permissions
|
||||
List<CustomPermissionMappingModel> existingPermissionDefined = getExistingPermissions(targetObject);
|
||||
|
||||
customPermissionMappingModel.forEach(c -> c.getMappedPermissions().forEach(value -> {
|
||||
CustomPermissionEntity entity = new CustomPermissionEntity(targetObject, c.getTargetPermission().getMask(), value.getMask());
|
||||
entities.add(entity);
|
||||
}));
|
||||
customPermissionMappingModel.forEach(c -> c.getMappedPermissions()
|
||||
.forEach(value -> {
|
||||
CustomPermissionEntity entity = new CustomPermissionEntity(targetObject, c.getTargetPermission().getMask(), value.getMask());
|
||||
entities.add(entity);
|
||||
}));
|
||||
|
||||
for (CustomPermissionMappingModel permissionMappingModel : existingPermissionDefined) {
|
||||
CustomPermissionModel targetPermission = permissionMappingModel.getTargetPermission();
|
||||
List<CustomPermissionModel> mappedPermissionsDefined = permissionMappingModel.getMappedPermissions();
|
||||
//retrieve the permissions which can be changeable in order to add them
|
||||
List<Integer> mappedPermissionMasksNotChangeable = mappedPermissionsDefined.stream().filter(p -> !p.isChangeable()).map(CustomPermissionModel::getMask).toList();
|
||||
List<Integer> mappedPermissionMasksNotChangeable = mappedPermissionsDefined.stream()
|
||||
.filter(p -> !p.isChangeable())
|
||||
.map(CustomPermissionModel::getMask)
|
||||
.toList();
|
||||
for (Integer mappedMask : mappedPermissionMasksNotChangeable) {
|
||||
Optional<CustomPermissionEntity> existingPermissionEntity = entities.stream()
|
||||
.filter(e -> e.getTargetPermissionMask() == targetPermission.getMask() && e.getExistingPermissionMask() == mappedMask)
|
||||
@ -214,7 +226,4 @@ public class CustomPermissionService {
|
||||
this.apply(getCustomPermissionMappings(targetObject));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -46,9 +46,9 @@ public class PersistenceServiceExternalApiCacheConfiguration {
|
||||
|
||||
return (builder) -> builder.withCacheConfiguration(RATE_LIMITER_CACHE, RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofMinutes(60)))
|
||||
.withCacheConfiguration(ACL_CACHE,
|
||||
RedisCacheConfiguration.defaultCacheConfig()
|
||||
.entryTtl(Duration.ofMinutes(1))
|
||||
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new JdkSerializationRedisSerializer())))
|
||||
RedisCacheConfiguration.defaultCacheConfig()
|
||||
.entryTtl(Duration.ofMinutes(1))
|
||||
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new JdkSerializationRedisSerializer())))
|
||||
.withCacheConfiguration(OTT_CACHE, RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofSeconds(10)));
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@ public class MessagingConfiguration {
|
||||
public static final String DOWNLOAD_COMPRESSION_QUEUE = "download_compression_queue";
|
||||
public static final String DOWNLOAD_COMPRESSION_DLQ = "download_compression_dlq";
|
||||
|
||||
|
||||
public static final String EXPORT_DOWNLOAD_QUEUE = "exportDownloadQueue";
|
||||
public static final String EXPORT_DOWNLOAD_DLQ = "exportDownloadDLQ";
|
||||
|
||||
@ -75,7 +74,7 @@ public class MessagingConfiguration {
|
||||
public static final String X_ERROR_INFO_HEADER = "x-error-message";
|
||||
public static final String X_ERROR_INFO_TIMESTAMP_HEADER = "x-error-message-timestamp";
|
||||
|
||||
// --- Saas Migration, can be removed later ----
|
||||
// --- Saas Migration, can be removed later ----
|
||||
|
||||
public static final String MIGRATION_QUEUE = "migrationQueue";
|
||||
public static final String MIGRATION_DLQ = "migrationDLQ";
|
||||
@ -99,11 +98,16 @@ public class MessagingConfiguration {
|
||||
@Bean
|
||||
public Queue migrationResponseQueue() {
|
||||
|
||||
return QueueBuilder.durable(MIGRATION_RESPONSE_QUEUE).withArgument("x-dead-letter-exchange", "").withArgument("x-dead-letter-routing-key", MIGRATION_DLQ).maxPriority(2).build();
|
||||
return QueueBuilder.durable(MIGRATION_RESPONSE_QUEUE)
|
||||
.withArgument("x-dead-letter-exchange", "")
|
||||
.withArgument("x-dead-letter-routing-key", MIGRATION_DLQ)
|
||||
.maxPriority(2)
|
||||
.build();
|
||||
}
|
||||
|
||||
// --- End Saas Migration
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue nerRequestQueue() {
|
||||
|
||||
@ -166,6 +170,7 @@ public class MessagingConfiguration {
|
||||
return QueueBuilder.durable(CV_ANALYSIS_DLQ).build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue visualLayoutParsingRequestQueue() {
|
||||
|
||||
@ -176,10 +181,7 @@ public class MessagingConfiguration {
|
||||
@Bean
|
||||
public Queue visualLayoutParsingResponseQueue() {
|
||||
|
||||
return QueueBuilder.durable(VISUAL_LAYOUT_RESPONSE_QUEUE)
|
||||
.withArgument("x-dead-letter-exchange", "")
|
||||
.withArgument("x-dead-letter-routing-key", VISUAL_LAYOUT_DLQ)
|
||||
.build();
|
||||
return QueueBuilder.durable(VISUAL_LAYOUT_RESPONSE_QUEUE).withArgument("x-dead-letter-exchange", "").withArgument("x-dead-letter-routing-key", VISUAL_LAYOUT_DLQ).build();
|
||||
}
|
||||
|
||||
|
||||
@ -189,6 +191,7 @@ public class MessagingConfiguration {
|
||||
return QueueBuilder.durable(VISUAL_LAYOUT_DLQ).build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue ocrStatusUpdateResponseQueue() {
|
||||
|
||||
@ -212,6 +215,7 @@ public class MessagingConfiguration {
|
||||
return QueueBuilder.durable(REDACTION_QUEUE).withArgument("x-dead-letter-exchange", "").withArgument("x-dead-letter-routing-key", REDACTION_DQL).maxPriority(2).build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue redactionPriorityQueue() {
|
||||
|
||||
@ -222,6 +226,7 @@ public class MessagingConfiguration {
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue redactionAnalysisResponseQueue() {
|
||||
|
||||
@ -258,10 +263,14 @@ public class MessagingConfiguration {
|
||||
return QueueBuilder.durable(DOWNLOAD_DLQ).build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue downloadCompressionQueue() {
|
||||
|
||||
return QueueBuilder.durable(DOWNLOAD_COMPRESSION_QUEUE).withArgument("x-dead-letter-exchange", "").withArgument("x-dead-letter-routing-key", DOWNLOAD_COMPRESSION_DLQ).build();
|
||||
return QueueBuilder.durable(DOWNLOAD_COMPRESSION_QUEUE)
|
||||
.withArgument("x-dead-letter-exchange", "")
|
||||
.withArgument("x-dead-letter-routing-key", DOWNLOAD_COMPRESSION_DLQ)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@ -318,6 +327,7 @@ public class MessagingConfiguration {
|
||||
return QueueBuilder.durable(REPORT_RESULT_DLQ).build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue analysisFlagCalculationQueue() {
|
||||
|
||||
@ -406,6 +416,7 @@ public class MessagingConfiguration {
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue layoutparsingRequestQueue() {
|
||||
|
||||
@ -426,4 +437,5 @@ public class MessagingConfiguration {
|
||||
|
||||
return QueueBuilder.durable(LAYOUT_PARSING_DLQ).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -13,15 +13,17 @@ public class WebConfiguration implements WebMvcConfigurer {
|
||||
|
||||
private static final int TIMEOUT = 600000; // 10 minutes timeout;
|
||||
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
|
||||
registry.addInterceptor(new AsyncHandlerInterceptor() {
|
||||
@Override
|
||||
public void afterConcurrentHandlingStarted(HttpServletRequest request,
|
||||
HttpServletResponse response, Object handler) {
|
||||
public void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||
|
||||
request.getAsyncContext().setTimeout(TIMEOUT);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.dev;
|
||||
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -51,16 +50,17 @@ public class DevDataProvider {
|
||||
try (ZipOutputStream zs = new ZipOutputStream(bos)) {
|
||||
Stream<Path> paths = Files.walk(p);
|
||||
{
|
||||
paths.filter(path -> !Files.isDirectory(path)).forEach(path -> {
|
||||
ZipEntry zipEntry = new ZipEntry(p.relativize(path).toString());
|
||||
try {
|
||||
zs.putNextEntry(zipEntry);
|
||||
Files.copy(path, zs);
|
||||
zs.closeEntry();
|
||||
} catch (IOException e) {
|
||||
System.err.println(e);
|
||||
}
|
||||
});
|
||||
paths.filter(path -> !Files.isDirectory(path))
|
||||
.forEach(path -> {
|
||||
ZipEntry zipEntry = new ZipEntry(p.relativize(path).toString());
|
||||
try {
|
||||
zs.putNextEntry(zipEntry);
|
||||
Files.copy(path, zs);
|
||||
zs.closeEntry();
|
||||
} catch (IOException e) {
|
||||
System.err.println(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ public interface IBaseAnnotation {
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
default AnnotationStatus getStatus() {
|
||||
|
||||
return AnnotationStatus.APPROVED;
|
||||
}
|
||||
|
||||
|
||||
@ -66,4 +66,5 @@ public class ManualResizeRedactionEntity implements IBaseAnnotation {
|
||||
@ElementCollection
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
private Set<String> typeIdsOfModifiedDictionaries = new HashSet<>();
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.entity.configuration;
|
||||
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
|
||||
@ -42,7 +42,7 @@ public class DigitalSignatureKmsEntity {
|
||||
private String kmsSecretKey;
|
||||
@Column
|
||||
@Lob
|
||||
@Basic(fetch= FetchType.EAGER)
|
||||
@Basic(fetch = FetchType.EAGER)
|
||||
private byte[] certificate;
|
||||
|
||||
}
|
||||
|
||||
@ -122,6 +122,4 @@ public class DossierTemplateEntity {
|
||||
@Transient
|
||||
private DossierTemplateStatus dossierTemplateStatus;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.iqser.red.service.persistence.management.v1.processor.entity.downloa
|
||||
|
||||
import com.iqser.red.service.pdftron.redaction.v1.api.model.RedactionResultDetail;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.utils.JSONDownloadRedactionFileDetailsConverter;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@ -36,5 +37,4 @@ public class DownloadRedactionFileStatusEntity {
|
||||
@Convert(converter = JSONDownloadRedactionFileDetailsConverter.class)
|
||||
private List<RedactionResultDetail> details = new ArrayList<>();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.entity.migration;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.SaasMigrationStatus;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
||||
@ -7,6 +7,7 @@ public class NotFoundException extends RuntimeException {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
public NotFoundException(String message, Throwable t) {
|
||||
|
||||
super(message, t);
|
||||
|
||||
@ -4,6 +4,7 @@ public class RulesTimeoutDetectedException extends RuntimeException {
|
||||
|
||||
private static final String RULE_TIMEOUT_DETECTED_MESSAGE = "A timout (possible endless loop) was detected using the rules for dossierTemplateId %s";
|
||||
|
||||
|
||||
public RulesTimeoutDetectedException(String dossierTemplateId) {
|
||||
|
||||
super(String.format(RULE_TIMEOUT_DETECTED_MESSAGE, dossierTemplateId));
|
||||
|
||||
@ -3,6 +3,7 @@ package com.iqser.red.service.persistence.management.v1.processor.jobs;
|
||||
import java.text.ParseException;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.job.*;
|
||||
|
||||
import org.quartz.CronExpression;
|
||||
import org.quartz.CronScheduleBuilder;
|
||||
import org.quartz.JobBuilder;
|
||||
@ -159,7 +160,6 @@ public class CreateJobsConfiguration {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Bean
|
||||
public Trigger downloadReadyJobTrigger() throws ParseException {
|
||||
|
||||
@ -183,6 +183,7 @@ public class CreateJobsConfiguration {
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Trigger analysisFlagCalculationSchedulerTrigger() throws ParseException {
|
||||
|
||||
@ -206,6 +207,4 @@ public class CreateJobsConfiguration {
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -22,7 +22,9 @@ public class MigrationController {
|
||||
@PostMapping
|
||||
public void run(@RequestParam("migrationName") String migrationName, @RequestParam("force") boolean force) {
|
||||
|
||||
migrations.stream().filter(m -> m.getName().equalsIgnoreCase(migrationName) || m.getClass().getSimpleName().equalsIgnoreCase(migrationName)).forEach(m -> m.run(force));
|
||||
migrations.stream()
|
||||
.filter(m -> m.getName().equalsIgnoreCase(migrationName) || m.getClass().getSimpleName().equalsIgnoreCase(migrationName))
|
||||
.forEach(m -> m.run(force));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -34,29 +34,31 @@ public class MigrationStarterService {
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
public void migrate() {
|
||||
|
||||
tenantProvider.getTenants().forEach(tenant -> {
|
||||
tenantProvider.getTenants()
|
||||
.forEach(tenant -> {
|
||||
|
||||
if (!TenantUtils.isTenantReadyForPersistence(tenant)) {
|
||||
return;
|
||||
}
|
||||
if (!TenantUtils.isTenantReadyForPersistence(tenant)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TenantContext.setTenantId(tenant.getTenantId());
|
||||
TenantContext.setTenantId(tenant.getTenantId());
|
||||
|
||||
//This is always running on startup
|
||||
seedMigration();
|
||||
});
|
||||
//This is always running on startup
|
||||
seedMigration();
|
||||
});
|
||||
|
||||
// This should only run in post upgrade hook
|
||||
if (settings.isMigrateOnly()) {
|
||||
|
||||
tenantProvider.getTenants().forEach(tenant -> {
|
||||
tenantProvider.getTenants()
|
||||
.forEach(tenant -> {
|
||||
|
||||
if (!TenantUtils.isTenantReadyForPersistence(tenant)) {
|
||||
return;
|
||||
}
|
||||
if (!TenantUtils.isTenantReadyForPersistence(tenant)) {
|
||||
return;
|
||||
}
|
||||
|
||||
runForTenant(tenant.getTenantId());
|
||||
});
|
||||
runForTenant(tenant.getTenantId());
|
||||
});
|
||||
|
||||
log.info("Migration is finished");
|
||||
System.exit(SpringApplication.exit(ctx, () -> 0));
|
||||
|
||||
@ -41,7 +41,8 @@ public class SaasAnnotationIdMigrationService {
|
||||
|
||||
var newEntry = MagicConverter.convert(oldEntry.get(), ManualRedactionEntryEntity.class);
|
||||
newEntry.setPositions(MagicConverter.convert(oldEntry.get().getPositions(), RectangleEntity.class));
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId()).get());
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId())
|
||||
.get());
|
||||
newEntry.setId(newAnnotationEntityId);
|
||||
|
||||
manualRedactionRepository.deleteById(oldAnnotationEntityId);
|
||||
@ -61,7 +62,8 @@ public class SaasAnnotationIdMigrationService {
|
||||
if (oldEntry.isPresent()) {
|
||||
|
||||
var newEntry = MagicConverter.convert(oldEntry.get(), IdRemovalEntity.class);
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId()).get());
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId())
|
||||
.get());
|
||||
newEntry.setId(newAnnotationEntityId);
|
||||
|
||||
removeRedactionRepository.deleteById(oldAnnotationEntityId);
|
||||
@ -81,7 +83,8 @@ public class SaasAnnotationIdMigrationService {
|
||||
if (oldEntry.isPresent()) {
|
||||
|
||||
var newEntry = MagicConverter.convert(oldEntry.get(), ManualForceRedactionEntity.class);
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId()).get());
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId())
|
||||
.get());
|
||||
newEntry.setId(newAnnotationEntityId);
|
||||
|
||||
forceRedactionRepository.deleteById(oldAnnotationEntityId);
|
||||
@ -103,7 +106,8 @@ public class SaasAnnotationIdMigrationService {
|
||||
var newEntry = MagicConverter.convert(oldEntry.get(), ManualResizeRedactionEntity.class);
|
||||
newEntry.setId(newAnnotationEntityId);
|
||||
newEntry.setPositions(MagicConverter.convert(oldEntry.get().getPositions(), RectangleEntity.class));
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId()).get());
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId())
|
||||
.get());
|
||||
|
||||
resizeRedactionRepository.deleteById(oldAnnotationEntityId);
|
||||
resizeRedactionRepository.save(newEntry);
|
||||
@ -123,7 +127,8 @@ public class SaasAnnotationIdMigrationService {
|
||||
|
||||
var newEntry = MagicConverter.convert(oldEntry.get(), ManualRecategorizationEntity.class);
|
||||
newEntry.setId(newAnnotationEntityId);
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId()).get());
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId())
|
||||
.get());
|
||||
|
||||
recategorizationRepository.deleteById(oldAnnotationEntityId);
|
||||
recategorizationRepository.save(newEntry);
|
||||
@ -143,7 +148,8 @@ public class SaasAnnotationIdMigrationService {
|
||||
|
||||
var newEntry = MagicConverter.convert(oldEntry.get(), ManualLegalBasisChangeEntity.class);
|
||||
newEntry.setId(newAnnotationEntityId);
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId()).get());
|
||||
newEntry.setFileStatus(fileRepository.findById(oldAnnotationEntityId.getFileId())
|
||||
.get());
|
||||
|
||||
legalBasisChangeRepository.deleteById(oldAnnotationEntityId);
|
||||
legalBasisChangeRepository.save(newEntry);
|
||||
|
||||
@ -237,7 +237,7 @@ public class SaasMigrationService implements TenantSyncService {
|
||||
|
||||
private int addManualRedactionEntries(List<ManualRedactionEntry> manualRedactionEntriesToAdd) {
|
||||
|
||||
return manualRedactionService.addManualRedactionEntries(manualRedactionEntriesToAdd, true);
|
||||
return manualRedactionService.addManualRedactionEntries(manualRedactionEntriesToAdd, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -19,10 +19,13 @@ import com.iqser.red.storage.commons.exception.StorageObjectDoesNotExist;
|
||||
import com.iqser.red.storage.commons.service.StorageClientCache;
|
||||
import com.iqser.red.storage.commons.service.StorageService;
|
||||
import com.iqser.red.storage.commons.service.azure.AzureBlobClient;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import software.amazon.awssdk.services.s3.model.DeleteObjectRequest;
|
||||
import software.amazon.awssdk.services.s3.model.GetObjectRequest;
|
||||
import software.amazon.awssdk.services.s3.model.ListObjectsV2Request;
|
||||
@ -46,11 +49,7 @@ public class UncompressedFilesMigrationService {
|
||||
if (client.getS3StorageClient() != null) {
|
||||
|
||||
var keysToMigrate = new ArrayList<String>();
|
||||
ListObjectsV2Request listObjects = ListObjectsV2Request
|
||||
.builder()
|
||||
.bucket(client.getS3StorageClient().getS3StorageConnection().getBucketName())
|
||||
.maxKeys(100)
|
||||
.build();
|
||||
ListObjectsV2Request listObjects = ListObjectsV2Request.builder().bucket(client.getS3StorageClient().getS3StorageConnection().getBucketName()).maxKeys(100).build();
|
||||
|
||||
var response = client.getS3StorageClient().listObjectsV2Paginator(listObjects);
|
||||
|
||||
@ -75,11 +74,7 @@ public class UncompressedFilesMigrationService {
|
||||
for (var key : keysToMigrate) {
|
||||
|
||||
log.info("Migrating key: {}", key);
|
||||
var getObjectRequest = GetObjectRequest
|
||||
.builder()
|
||||
.bucket(client.getS3StorageClient().getS3StorageConnection().getBucketName())
|
||||
.key(key)
|
||||
.build();
|
||||
var getObjectRequest = GetObjectRequest.builder().bucket(client.getS3StorageClient().getS3StorageConnection().getBucketName()).key(key).build();
|
||||
|
||||
var tempFile = new File(tmpdir, key);
|
||||
// in case it was created by a previous migration
|
||||
@ -88,7 +83,7 @@ public class UncompressedFilesMigrationService {
|
||||
|
||||
client.getS3StorageClient().getObject(getObjectRequest, tempFile.toPath());
|
||||
|
||||
try(var fis = new FileInputStream(tempFile)) {
|
||||
try (var fis = new FileInputStream(tempFile)) {
|
||||
storageService.storeObject(tenant, key, fis);
|
||||
|
||||
IOUtils.closeQuietly(fis);
|
||||
@ -99,10 +94,7 @@ public class UncompressedFilesMigrationService {
|
||||
log.debug("Failed to delete temp file: {}", tempFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
var deleteObjectsRequest = DeleteObjectRequest.builder()
|
||||
.bucket(client.getS3StorageClient().getS3StorageConnection().getBucketName())
|
||||
.key(key)
|
||||
.build();
|
||||
var deleteObjectsRequest = DeleteObjectRequest.builder().bucket(client.getS3StorageClient().getS3StorageConnection().getBucketName()).key(key).build();
|
||||
|
||||
try {
|
||||
client.getS3StorageClient().deleteObject(deleteObjectsRequest);
|
||||
@ -116,8 +108,7 @@ public class UncompressedFilesMigrationService {
|
||||
} else if (client.getAzureBlobClient() != null) {
|
||||
|
||||
var azureClient = client.getAzureBlobClient();
|
||||
var blobContainerClient =
|
||||
azureClient.getBlobServiceClient().getBlobContainerClient(client.getAzureBlobClient().getAzureStorageConnection().getContainerName());
|
||||
var blobContainerClient = azureClient.getBlobServiceClient().getBlobContainerClient(client.getAzureBlobClient().getAzureStorageConnection().getContainerName());
|
||||
|
||||
List<String> keysToMigrate = new ArrayList<>();
|
||||
|
||||
@ -133,7 +124,6 @@ public class UncompressedFilesMigrationService {
|
||||
|
||||
log.info("Total files that require compression: {} / {} ", keysToMigrate.size(), counter.get());
|
||||
|
||||
|
||||
int attempts = 0;
|
||||
do {
|
||||
keysToMigrate = migrateBlobKeys(tenant, keysToMigrate, azureClient);
|
||||
@ -157,8 +147,7 @@ public class UncompressedFilesMigrationService {
|
||||
for (var key : keysToMigrate) {
|
||||
|
||||
try {
|
||||
var blobContainerClient =
|
||||
azureBlobClient.getBlobServiceClient().getBlobContainerClient(azureBlobClient.getAzureStorageConnection().getContainerName());
|
||||
var blobContainerClient = azureBlobClient.getBlobServiceClient().getBlobContainerClient(azureBlobClient.getAzureStorageConnection().getContainerName());
|
||||
|
||||
log.info("Migrating key: {}", key);
|
||||
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.migration.migrations;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.migration.Migration;
|
||||
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
|
||||
@ -53,8 +53,7 @@ public class ManualRedactionTypeRenameMigration15 extends Migration {
|
||||
@Override
|
||||
/*
|
||||
* Migrates the ManualRedactionType ADD_LOCALLY -> ADD, FORCE_REDACT -> FORCE, FORCE_HINT -> FORCE, REMOVE_LOCALLY -> REMOVE.
|
||||
*/
|
||||
protected void migrate() {
|
||||
*/ protected void migrate() {
|
||||
|
||||
log.info("Migrating ManualRedactionType names");
|
||||
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.migration.migrations;
|
||||
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.FileEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.migration.Migration;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.FileManagementStorageService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.FileType;
|
||||
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -37,7 +38,10 @@ public class MissingFileSizeMigration13 extends Migration {
|
||||
@Override
|
||||
protected void migrate() {
|
||||
|
||||
List<FileEntity> missingFileSizeFiles = fileStatusPersistenceService.getAllFiles().stream().filter(file -> file.getFileSize() == null).toList();
|
||||
List<FileEntity> missingFileSizeFiles = fileStatusPersistenceService.getAllFiles()
|
||||
.stream()
|
||||
.filter(file -> file.getFileSize() == null)
|
||||
.toList();
|
||||
|
||||
log.info("Number of files without fileSize: {}", missingFileSizeFiles.size());
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user