DM-285: fully deprecated RedactionLog, added component rule file
* return 404, when component rule file hasn't been created yet* deprecate RSSResponse * enter clean redaction-service version * fixed some messages * used correct RuleFileType
This commit is contained in:
parent
2e142f12e9
commit
56baa7db07
@ -16,7 +16,7 @@ import com.iqser.red.service.persistence.management.v1.processor.service.EntityL
|
|||||||
import com.iqser.red.service.persistence.service.v1.api.external.resource.AnalysisLogResource;
|
import com.iqser.red.service.persistence.service.v1.api.external.resource.AnalysisLogResource;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentLog;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentLog;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.FilteredRedactionLogRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.FilteredEntityLogRequest;
|
||||||
|
|
||||||
import feign.FeignException;
|
import feign.FeignException;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -25,7 +25,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AnalysisLogController implements AnalysisLogResource {
|
public class AnalysisLogController implements AnalysisLogResource {
|
||||||
|
|
||||||
private final EntityLogService redactionLogService;
|
private final EntityLogService entityLogService;
|
||||||
private final ComponentLogService componentLogService;
|
private final ComponentLogService componentLogService;
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class AnalysisLogController implements AnalysisLogResource {
|
|||||||
@RequestParam(value = "includeFalsePositives", required = false, defaultValue = "false") boolean includeFalsePositives) {
|
@RequestParam(value = "includeFalsePositives", required = false, defaultValue = "false") boolean includeFalsePositives) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return redactionLogService.getEntityLog(dossierId, fileId, excludedTypes);
|
return entityLogService.getEntityLog(dossierId, fileId, excludedTypes);
|
||||||
} catch (FeignException e) {
|
} catch (FeignException e) {
|
||||||
throw processFeignException(e);
|
throw processFeignException(e);
|
||||||
}
|
}
|
||||||
@ -47,10 +47,10 @@ public class AnalysisLogController implements AnalysisLogResource {
|
|||||||
@PreAuthorize("hasAuthority('" + READ_REDACTION_LOG + "')")
|
@PreAuthorize("hasAuthority('" + READ_REDACTION_LOG + "')")
|
||||||
public EntityLog getFilteredEntityLog(@PathVariable(DOSSIER_ID) String dossierId,
|
public EntityLog getFilteredEntityLog(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@RequestBody FilteredRedactionLogRequest filteredRedactionLogRequest) {
|
@RequestBody FilteredEntityLogRequest filteredEntityLogRequest) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return redactionLogService.getFilteredEntityLog(dossierId, fileId, filteredRedactionLogRequest);
|
return entityLogService.getFilteredEntityLog(dossierId, fileId, filteredEntityLogRequest);
|
||||||
} catch (FeignException e) {
|
} catch (FeignException e) {
|
||||||
throw processFeignException(e);
|
throw processFeignException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.ResponseStatus;
|
|||||||
|
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentLog;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentLog;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.FilteredRedactionLogRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.FilteredEntityLogRequest;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
@ -33,7 +33,7 @@ public interface AnalysisLogResource {
|
|||||||
|
|
||||||
|
|
||||||
@GetMapping(value = ENTITY_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = ENTITY_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Gets the redaction log for a fileId", description = "None")
|
@Operation(summary = "Gets the entity log for a fileId", description = "None")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The redaction log is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The redaction log is not found.")})
|
||||||
EntityLog getEntityLog(@PathVariable(DOSSIER_ID) String dossierId,
|
EntityLog getEntityLog(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@ -43,15 +43,15 @@ public interface AnalysisLogResource {
|
|||||||
|
|
||||||
|
|
||||||
@PostMapping(value = ENTITY_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE + "/filtered", produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = ENTITY_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE + "/filtered", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Gets the redaction log for a fileId grater than the specified date", description = "None")
|
@Operation(summary = "Gets the entity log for a fileId grater than the specified date", description = "None")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The redaction log is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The redaction log is not found.")})
|
||||||
EntityLog getFilteredEntityLog(@PathVariable(DOSSIER_ID) String dossierId,
|
EntityLog getFilteredEntityLog(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@RequestBody FilteredRedactionLogRequest filteredRedactionLogRequest);
|
@RequestBody FilteredEntityLogRequest filteredEntityLogRequest);
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = COMPONENT_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = COMPONENT_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Gets the redaction log for a fileId", description = "None")
|
@Operation(summary = "Gets the component log for a fileId", description = "None")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The redaction log is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The redaction log is not found.")})
|
||||||
ComponentLog getComponentLog(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
ComponentLog getComponentLog(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLogEntry;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLogEntry;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.FilteredRedactionLogRequest;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.FilteredEntityLogRequest;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@ -48,14 +48,13 @@ public class EntityLogService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public EntityLog getFilteredEntityLog(String dossierId, String fileId, FilteredEntityLogRequest filteredEntityLogRequest) {
|
||||||
|
|
||||||
public EntityLog getFilteredEntityLog(String dossierId, String fileId, FilteredRedactionLogRequest filteredRedactionLogRequest) {
|
if (filteredEntityLogRequest.getSpecifiedDate() == null) {
|
||||||
|
filteredEntityLogRequest.setSpecifiedDate(OffsetDateTime.MIN);
|
||||||
if (filteredRedactionLogRequest.getSpecifiedDate() == null) {
|
|
||||||
filteredRedactionLogRequest.setSpecifiedDate(OffsetDateTime.MIN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var entityLog = getEntityLog(dossierId, fileId, filteredRedactionLogRequest.getExcludedTypes());
|
var entityLog = getEntityLog(dossierId, fileId, filteredEntityLogRequest.getExcludedTypes());
|
||||||
var entityLogEntry = entityLog.getEntityLogEntry();
|
var entityLogEntry = entityLog.getEntityLogEntry();
|
||||||
|
|
||||||
Iterator<EntityLogEntry> it = entityLogEntry.iterator();
|
Iterator<EntityLogEntry> it = entityLogEntry.iterator();
|
||||||
@ -63,15 +62,17 @@ public class EntityLogService {
|
|||||||
var redactionLogEntry = it.next();
|
var redactionLogEntry = it.next();
|
||||||
boolean isAfterSpecifiedDate = false;
|
boolean isAfterSpecifiedDate = false;
|
||||||
for (var change : redactionLogEntry.getChanges()) {
|
for (var change : redactionLogEntry.getChanges()) {
|
||||||
if (change.getDateTime() != null && change.getDateTime().isAfter(filteredRedactionLogRequest.getSpecifiedDate())) {
|
if (change.getDateTime() != null && change.getDateTime().isAfter(filteredEntityLogRequest.getSpecifiedDate())) {
|
||||||
isAfterSpecifiedDate = true;
|
isAfterSpecifiedDate = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var manualChange : redactionLogEntry.getManualChanges()) {
|
for (var manualChange : redactionLogEntry.getManualChanges()) {
|
||||||
if (manualChange.getProcessedDate() != null && manualChange.getProcessedDate()
|
if (manualChange.getProcessedDate() != null && manualChange.getProcessedDate()
|
||||||
.isAfter(filteredRedactionLogRequest.getSpecifiedDate()) || manualChange.getRequestedDate() != null && manualChange.getRequestedDate()
|
.isAfter(filteredEntityLogRequest.getSpecifiedDate()) || manualChange.getRequestedDate() != null && manualChange.getRequestedDate()
|
||||||
.isAfter(filteredRedactionLogRequest.getSpecifiedDate())) {
|
.isAfter(filteredEntityLogRequest.getSpecifiedDate())) {
|
||||||
isAfterSpecifiedDate = true;
|
isAfterSpecifiedDate = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -100,8 +100,8 @@ public class FileManagementStorageService {
|
|||||||
try {
|
try {
|
||||||
return storageService.readJSONObject(TenantContext.getTenantId(), StorageIdUtils.getStorageId(dossierId, fileId, FileType.ENTITY_LOG), EntityLog.class);
|
return storageService.readJSONObject(TenantContext.getTenantId(), StorageIdUtils.getStorageId(dossierId, fileId, FileType.ENTITY_LOG), EntityLog.class);
|
||||||
} catch (StorageObjectDoesNotExist e) {
|
} catch (StorageObjectDoesNotExist e) {
|
||||||
log.debug("RedactionLog does not exist");
|
log.debug("EntityLog does not exist");
|
||||||
throw new NotFoundException(String.format("RedactionLog does not exist for Dossier ID \"%s\" and File ID \"%s\"!", dossierId, fileId));
|
throw new NotFoundException(String.format("EntityLog does not exist for Dossier ID \"%s\" and File ID \"%s\"!", dossierId, fileId));
|
||||||
} catch (StorageException e) {
|
} catch (StorageException e) {
|
||||||
throw new InternalServerErrorException(e.getMessage());
|
throw new InternalServerErrorException(e.getMessage());
|
||||||
}
|
}
|
||||||
@ -171,8 +171,8 @@ public class FileManagementStorageService {
|
|||||||
try {
|
try {
|
||||||
return storageService.readJSONObject(TenantContext.getTenantId(), StorageIdUtils.getStorageId(dossierId, fileId, FileType.COMPONENT_LOG), ComponentLog.class);
|
return storageService.readJSONObject(TenantContext.getTenantId(), StorageIdUtils.getStorageId(dossierId, fileId, FileType.COMPONENT_LOG), ComponentLog.class);
|
||||||
} catch (StorageObjectDoesNotExist e) {
|
} catch (StorageObjectDoesNotExist e) {
|
||||||
log.debug("RedactionLog does not exist");
|
log.debug("ComponentLog does not exist");
|
||||||
throw new NotFoundException(String.format("RedactionLog does not exist for Dossier ID \"%s\" and File ID \"%s\"!", dossierId, fileId));
|
throw new NotFoundException(String.format("ComponentLog does not exist for Dossier ID \"%s\" and File ID \"%s\"!", dossierId, fileId));
|
||||||
} catch (StorageException e) {
|
} catch (StorageException e) {
|
||||||
throw new InternalServerErrorException(e.getMessage());
|
throw new InternalServerErrorException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -177,7 +177,7 @@ public class DossierTemplateExportService {
|
|||||||
objectMapper.writeValueAsBytes(ruleSet.getValue())));
|
objectMapper.writeValueAsBytes(ruleSet.getValue())));
|
||||||
|
|
||||||
// add component rule set
|
// add component rule set
|
||||||
var componentRuleSet = rulesPersistenceService.getRules(dossierTemplateId, RuleFileType.ENTITY);
|
var componentRuleSet = rulesPersistenceService.getRules(dossierTemplateId, RuleFileType.COMPONENT);
|
||||||
fileSystemBackedArchiver.addEntries(new FileSystemBackedArchiver.ArchiveModel(null,
|
fileSystemBackedArchiver.addEntries(new FileSystemBackedArchiver.ArchiveModel(null,
|
||||||
getFilename(ExportFilename.COMPONENT_RULES, TXT_EXT),
|
getFilename(ExportFilename.COMPONENT_RULES, TXT_EXT),
|
||||||
objectMapper.writeValueAsBytes(componentRuleSet.getValue())));
|
objectMapper.writeValueAsBytes(componentRuleSet.getValue())));
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@Builder
|
@Builder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class FilteredRedactionLogRequest {
|
public class FilteredEntityLogRequest {
|
||||||
|
|
||||||
private List<String> excludedTypes;
|
private List<String> excludedTypes;
|
||||||
private boolean withManualRedactions;
|
private boolean withManualRedactions;
|
||||||
Loading…
x
Reference in New Issue
Block a user