fixed RED-2688/RED-2692
This commit is contained in:
parent
310d864647
commit
8709e1645f
@ -1,6 +1,7 @@
|
|||||||
package com.iqser.red.service.redaction.v1.server.controller;
|
package com.iqser.red.service.redaction.v1.server.controller;
|
||||||
|
|
||||||
import com.iqser.red.commons.spring.ErrorMessage;
|
import com.iqser.red.commons.spring.ErrorMessage;
|
||||||
|
import com.iqser.red.service.redaction.v1.server.exception.RedactionLogNotFoundException;
|
||||||
import com.iqser.red.service.redaction.v1.server.exception.RulesValidationException;
|
import com.iqser.red.service.redaction.v1.server.exception.RulesValidationException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@ -17,6 +18,13 @@ public class ControllerAdvice {
|
|||||||
|
|
||||||
/* error handling */
|
/* error handling */
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@ResponseStatus(value = HttpStatus.NOT_FOUND)
|
||||||
|
@ExceptionHandler(value = RedactionLogNotFoundException.class)
|
||||||
|
public ErrorMessage handleRedactionLogNotFoundException(RedactionLogNotFoundException e) {
|
||||||
|
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
@ExceptionHandler(value = NullPointerException.class)
|
@ExceptionHandler(value = NullPointerException.class)
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.iqser.red.service.redaction.v1.resources.RedactionResource;
|
|||||||
import com.iqser.red.service.redaction.v1.server.classification.model.Document;
|
import com.iqser.red.service.redaction.v1.server.classification.model.Document;
|
||||||
import com.iqser.red.service.redaction.v1.server.classification.model.Page;
|
import com.iqser.red.service.redaction.v1.server.classification.model.Page;
|
||||||
import com.iqser.red.service.redaction.v1.server.exception.RedactionException;
|
import com.iqser.red.service.redaction.v1.server.exception.RedactionException;
|
||||||
|
import com.iqser.red.service.redaction.v1.server.exception.RedactionLogNotFoundException;
|
||||||
import com.iqser.red.service.redaction.v1.server.redaction.service.AnnotationService;
|
import com.iqser.red.service.redaction.v1.server.redaction.service.AnnotationService;
|
||||||
import com.iqser.red.service.redaction.v1.server.redaction.service.DictionaryService;
|
import com.iqser.red.service.redaction.v1.server.redaction.service.DictionaryService;
|
||||||
import com.iqser.red.service.redaction.v1.server.redaction.service.DroolsExecutionService;
|
import com.iqser.red.service.redaction.v1.server.redaction.service.DroolsExecutionService;
|
||||||
@ -151,10 +152,13 @@ public class RedactionController implements RedactionResource {
|
|||||||
log.info("Requested preview for: {}", redactionRequest);
|
log.info("Requested preview for: {}", redactionRequest);
|
||||||
dictionaryService.updateDictionary(redactionRequest.getDossierTemplateId(), redactionRequest.getDossierId());
|
dictionaryService.updateDictionary(redactionRequest.getDossierTemplateId(), redactionRequest.getDossierId());
|
||||||
|
|
||||||
|
|
||||||
SectionGrid sectionGrid = null;
|
SectionGrid sectionGrid = null;
|
||||||
var redactionLog = redactionStorageService.getRedactionLog(redactionRequest.getDossierId(), redactionRequest.getFileId());
|
var redactionLog = redactionStorageService.getRedactionLog(redactionRequest.getDossierId(), redactionRequest.getFileId());
|
||||||
|
|
||||||
|
if (redactionLog == null) {
|
||||||
|
throw new RedactionLogNotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (redactionRequest.isWithSectionDataForManualRedactions()) {
|
if (redactionRequest.isWithSectionDataForManualRedactions()) {
|
||||||
sectionGrid = redactionStorageService.getSectionGrid(redactionRequest.getDossierId(), redactionRequest.getFileId());
|
sectionGrid = redactionStorageService.getSectionGrid(redactionRequest.getDossierId(), redactionRequest.getFileId());
|
||||||
|
|||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.iqser.red.service.redaction.v1.server.exception;
|
||||||
|
|
||||||
|
public class RedactionLogNotFoundException extends RuntimeException {
|
||||||
|
|
||||||
|
public RedactionLogNotFoundException() {
|
||||||
|
super("RedactionLog not found!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user