Merge branch 'RED-9123' into 'master'
RED-9123: Improve performance of re-analysis (Spike) Closes RED-9123 See merge request redactmanager/persistence-service!571
This commit is contained in:
commit
a8a9232c4c
@ -32,17 +32,39 @@ public class DictionaryInternalController implements DictionaryResource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Type> getAllTypesForDossierTemplate(@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId,
|
public List<Type> getAllTypesForDossierTemplate(@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId,
|
||||||
|
@RequestParam(value = FROM_VERSION_PARAM, required = false) Long fromVersion,
|
||||||
@RequestParam(value = INCLUDE_DELETED_PARAMETER_NAME, required = false, defaultValue = "false") boolean includeDeleted) {
|
@RequestParam(value = INCLUDE_DELETED_PARAMETER_NAME, required = false, defaultValue = "false") boolean includeDeleted) {
|
||||||
|
|
||||||
return convert(dictionaryPersistenceService.getAllTypesForDossierTemplate(dossierTemplateId, includeDeleted), Type.class);
|
var targets = convert(dictionaryPersistenceService.getAllTypesForDossierTemplate(dossierTemplateId, includeDeleted), Type.class);
|
||||||
|
setEntriesForTypes(fromVersion, targets);
|
||||||
|
return targets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Type> getAllTypesForDossier(@PathVariable(DOSSIER_ID_PARAMETER_NAME) String dossierId,
|
public List<Type> getAllTypesForDossier(@PathVariable(DOSSIER_ID_PARAMETER_NAME) String dossierId,
|
||||||
|
@RequestParam(value = FROM_VERSION_PARAM, required = false) Long fromVersion,
|
||||||
@RequestParam(value = INCLUDE_DELETED_PARAMETER_NAME, required = false, defaultValue = "false") boolean includeDeleted) {
|
@RequestParam(value = INCLUDE_DELETED_PARAMETER_NAME, required = false, defaultValue = "false") boolean includeDeleted) {
|
||||||
|
|
||||||
return convert(dictionaryPersistenceService.getAllTypesForDossier(dossierId, includeDeleted), Type.class);
|
var targets = convert(dictionaryPersistenceService.getAllTypesForDossier(dossierId, includeDeleted), Type.class);
|
||||||
|
setEntriesForTypes(fromVersion, targets);
|
||||||
|
return targets;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setEntriesForTypes(Long fromVersion, List<Type> targets) {
|
||||||
|
|
||||||
|
targets.forEach(target -> {
|
||||||
|
setEntriesForType(target.getTypeId(), target, fromVersion != null ? fromVersion : -1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setEntriesForType(String typeId, Type target, Long fromVersion) {
|
||||||
|
|
||||||
|
target.setEntries(convert(entryPersistenceService.getEntries(typeId, DictionaryEntryType.ENTRY, fromVersion), DictionaryEntry.class));
|
||||||
|
target.setFalsePositiveEntries(convert(entryPersistenceService.getEntries(typeId, DictionaryEntryType.FALSE_POSITIVE, fromVersion), DictionaryEntry.class));
|
||||||
|
target.setFalseRecommendationEntries(convert(entryPersistenceService.getEntries(typeId, DictionaryEntryType.FALSE_RECOMMENDATION, fromVersion), DictionaryEntry.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -51,9 +73,7 @@ public class DictionaryInternalController implements DictionaryResource {
|
|||||||
|
|
||||||
var entity = dictionaryPersistenceService.getType(typeId, true);
|
var entity = dictionaryPersistenceService.getType(typeId, true);
|
||||||
var target = convert(entity, Type.class);
|
var target = convert(entity, Type.class);
|
||||||
target.setEntries(convert(entryPersistenceService.getEntries(typeId, DictionaryEntryType.ENTRY, fromVersion), DictionaryEntry.class));
|
setEntriesForType(typeId, target, fromVersion);
|
||||||
target.setFalsePositiveEntries(convert(entryPersistenceService.getEntries(typeId, DictionaryEntryType.FALSE_POSITIVE, fromVersion), DictionaryEntry.class));
|
|
||||||
target.setFalseRecommendationEntries(convert(entryPersistenceService.getEntries(typeId, DictionaryEntryType.FALSE_RECOMMENDATION, fromVersion), DictionaryEntry.class));
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,11 +38,13 @@ public interface DictionaryResource {
|
|||||||
|
|
||||||
@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,
|
List<Type> getAllTypesForDossierTemplate(@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId,
|
||||||
|
@RequestParam(value = FROM_VERSION_PARAM, required = false) Long fromVersion,
|
||||||
@RequestParam(value = INCLUDE_DELETED_PARAMETER_NAME, required = false, defaultValue = "false") boolean includeDeleted);
|
@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,
|
List<Type> getAllTypesForDossier(@PathVariable(DOSSIER_ID_PARAMETER_NAME) String dossierId,
|
||||||
|
@RequestParam(value = FROM_VERSION_PARAM, required = false) Long fromVersion,
|
||||||
@RequestParam(value = INCLUDE_DELETED_PARAMETER_NAME, required = false, defaultValue = "false") boolean includeDeleted);
|
@RequestParam(value = INCLUDE_DELETED_PARAMETER_NAME, required = false, defaultValue = "false") boolean includeDeleted);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user