RED-8339: Fixes
This commit is contained in:
parent
fcc87a078b
commit
34237ca813
@ -19,7 +19,6 @@ import com.iqser.red.service.persistence.management.v1.processor.exception.Dossi
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.InvalidRulesException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.RulesTimeoutDetectedException;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.exception.ComponentLogDocumentNotFoundException;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -135,14 +134,4 @@ public class InternalControllerAdvice {
|
||||
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@Hidden
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(ComponentLogDocumentNotFoundException.class)
|
||||
public ErrorMessage handleCustomException(ComponentLogDocumentNotFoundException e) {
|
||||
|
||||
return new ErrorMessage(OffsetDateTime.now(), e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.shared.mongo.exception;
|
||||
|
||||
public class ComponentLogDocumentNotFoundException extends RuntimeException {
|
||||
|
||||
public ComponentLogDocumentNotFoundException(String errorMessage) {
|
||||
|
||||
super(errorMessage);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.shared.mongo.exception;
|
||||
|
||||
public class DocumentNotFoundException extends RuntimeException {
|
||||
|
||||
public DocumentNotFoundException(String errorMessage) {
|
||||
|
||||
super(errorMessage);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.shared.mongo.exception;
|
||||
|
||||
public class EntityLogDocumentNotFoundException extends RuntimeException {
|
||||
|
||||
public EntityLogDocumentNotFoundException(String errorMessage) {
|
||||
|
||||
super(errorMessage);
|
||||
}
|
||||
|
||||
}
|
||||
@ -22,6 +22,6 @@ public interface ComponentDocumentRepository extends MongoRepository<ComponentDo
|
||||
List<ComponentDocument> findByDossierIdAndFileId(String componentLogId);
|
||||
|
||||
@Query(value = "{ 'componentLogId': ?0 }", fields = "{ 'overrideValues': 0 }")
|
||||
List<ComponentDocument> findWithoutEntriesByDossierIdAndFileId(String componentLogId);
|
||||
List<ComponentDocument> findWithoutOverrideValuesByDossierIdAndFileId(String componentLogId);
|
||||
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentLogEntry;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.document.ComponentDocument;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.document.ComponentLogDocument;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.exception.ComponentLogDocumentNotFoundException;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.exception.DocumentNotFoundException;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.mapper.ComponentLogDocumentMapper;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.repository.ComponentDocumentRepository;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.repository.ComponentLogDocumentRepository;
|
||||
@ -111,13 +111,9 @@ public class ComponentLogMongoService {
|
||||
|
||||
private ComponentLogDocument getComponentLogDocument(String componentLogId) {
|
||||
|
||||
Optional<ComponentLogDocument> optionalComponentLogDocument = componentLogDocumentRepository.findById(componentLogId);
|
||||
return componentLogDocumentRepository.findById(componentLogId)
|
||||
.orElseThrow(() -> new DocumentNotFoundException(String.format("Component log not found for %s", componentLogId)));
|
||||
|
||||
if (optionalComponentLogDocument.isEmpty()) {
|
||||
throw new ComponentLogDocumentNotFoundException(String.format("Component log not found for %s", componentLogId));
|
||||
}
|
||||
|
||||
return optionalComponentLogDocument.get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLogEntry;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.document.EntityLogDocument;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.document.EntityLogEntryDocument;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.exception.EntityLogDocumentNotFoundException;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.exception.DocumentNotFoundException;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.mapper.EntityLogDocumentMapper;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.repository.EntityLogDocumentRepository;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.mongo.repository.EntityLogEntryDocumentRepository;
|
||||
@ -167,7 +167,7 @@ public class EntityLogMongoService {
|
||||
Optional<EntityLogDocument> optionalEntityLogDocument = entityLogDocumentRepository.findById(entityLogId);
|
||||
|
||||
if (optionalEntityLogDocument.isEmpty()) {
|
||||
throw new EntityLogDocumentNotFoundException(String.format("Entity log not found for %s", entityLogId));
|
||||
throw new DocumentNotFoundException(String.format("Entity log not found for %s", entityLogId));
|
||||
}
|
||||
|
||||
return optionalEntityLogDocument.get();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user