RED-6485 - Dossier-only entity setting in the dossier template
- add to flag to type entity to indicate if it is dossier dictionary only - prevent update of that flag - return the added information to dictionary and type result - update junit tests
This commit is contained in:
parent
2a805811c3
commit
b9e6e63c2f
@ -61,6 +61,9 @@ public class TypeEntity {
|
||||
@Column
|
||||
private OffsetDateTime softDeletedTime;
|
||||
|
||||
@Column
|
||||
private boolean dossierDictionaryOnly;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "dossier_template_id")
|
||||
private DossierTemplateEntity dossierTemplate;
|
||||
|
||||
@ -69,7 +69,8 @@ public class ManualRedactionTypeMigration9 extends Migration {
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
false);
|
||||
false,
|
||||
true);
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -92,7 +92,8 @@ public class DictionaryManagementService {
|
||||
typeRequest.getDossierId(),
|
||||
typeRequest.isHasDictionary(),
|
||||
typeRequest.isSystemManaged(),
|
||||
typeRequest.isAutoHideSkipped()), Type.class, new TypeMapper());
|
||||
typeRequest.isAutoHideSkipped(),
|
||||
typeRequest.isDossierDictionaryOnly()), Type.class, new TypeMapper());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -92,6 +92,7 @@ public class DictionaryService {
|
||||
|
||||
accessControlService.verifyUserHasAccessPermissions(dossierId);
|
||||
accessControlService.verifyUserIsMemberOrApprover(dossierId);
|
||||
//TODO: check if dossier type exists and dossier template type exists
|
||||
deleteEntries(toTypeId(type, dossierTemplateId, dossierId), entries, dictionaryEntryType);
|
||||
}
|
||||
|
||||
@ -158,6 +159,7 @@ public class DictionaryService {
|
||||
.hasDictionary(typeValue.isHasDictionary())
|
||||
.systemManaged(false)
|
||||
.autoHideSkipped(typeValue.isAutoHideSkipped())
|
||||
.dossierDictionaryOnly(dossierId != null && typeValue.isDossierDictionaryOnly())
|
||||
.build());
|
||||
}
|
||||
|
||||
@ -223,6 +225,7 @@ public class DictionaryService {
|
||||
.hasDictionary(typeResult.isHasDictionary())
|
||||
.systemManaged(typeResult.isSystemManaged())
|
||||
.autoHideSkipped(typeResult.isAutoHideSkipped())
|
||||
.dossierDictionaryOnly(typeResult.isDossierDictionaryOnly())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
return new TypeResponse(typeValues);
|
||||
@ -271,6 +274,7 @@ public class DictionaryService {
|
||||
.hasDictionary(dictionaryForType.isHasDictionary())
|
||||
.systemManaged(dictionaryForType.isSystemManaged())
|
||||
.autoHideSkipped(dictionaryForType.isAutoHideSkipped())
|
||||
.dossierDictionaryOnly(dictionaryForType.isDossierDictionaryOnly())
|
||||
.build();
|
||||
} catch (AccessDeniedException e) {
|
||||
throw new NotFoundException("Object not found");
|
||||
|
||||
@ -291,6 +291,7 @@ public class DossierManagementService {
|
||||
.dossierId(dossierId)
|
||||
.hasDictionary(true)
|
||||
.systemManaged(true)
|
||||
.dossierDictionaryOnly(true)
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +157,8 @@ public class DossierTemplateCloneService {
|
||||
null,
|
||||
t.isHasDictionary(),
|
||||
t.isSystemManaged(),
|
||||
t.isAutoHideSkipped());
|
||||
t.isAutoHideSkipped(),
|
||||
t.isDossierDictionaryOnly());
|
||||
entryPersistenceService.cloneEntries(t.getId(), type.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public class DictionaryPersistenceService {
|
||||
String dossierId,
|
||||
boolean hasDictionary,
|
||||
boolean systemManaged,
|
||||
boolean autoHideSkipped) {
|
||||
boolean autoHideSkipped, boolean dossierDictionaryOnly) {
|
||||
|
||||
checkRankAlreadyExists(type, dossierTemplateId, rank, dossierId);
|
||||
|
||||
@ -75,6 +75,7 @@ public class DictionaryPersistenceService {
|
||||
.systemManaged(systemManaged)
|
||||
.autoHideSkipped(autoHideSkipped)
|
||||
.softDeletedTime(null)
|
||||
.dossierDictionaryOnly(dossierDictionaryOnly)
|
||||
.build();
|
||||
|
||||
return typeRepository.saveAndFlush(t);
|
||||
@ -128,7 +129,8 @@ public class DictionaryPersistenceService {
|
||||
"dossierTemplate",
|
||||
"dossier",
|
||||
"id",
|
||||
"version");
|
||||
"version",
|
||||
"dossierDictionaryOnly");
|
||||
}
|
||||
typeRepository.save(type);
|
||||
});
|
||||
|
||||
@ -135,3 +135,5 @@ databaseChangeLog:
|
||||
file: db/changelog/tenant/sql/49-add-keep_overlapping_objects.sql
|
||||
- include:
|
||||
file: db/changelog/tenant/50-add-file-status-error-info.yaml
|
||||
- include:
|
||||
file: db/changelog/tenant/51-add-dossier-dictionary-only-flag.yaml
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
databaseChangeLog:
|
||||
- changeSet:
|
||||
id: add-dossier-dictionary-only-flag
|
||||
author: corinaolariu
|
||||
changes:
|
||||
- addColumn:
|
||||
columns:
|
||||
- column:
|
||||
name: dossier_dictionary_only
|
||||
type: BOOLEAN
|
||||
tableName: entity
|
||||
@ -48,6 +48,7 @@ public class DictionaryTest extends AbstractPersistenceServerServiceTest {
|
||||
var type = typeProvider.testAndProvideType(dossierTemplate);
|
||||
assertThat(type.getRecommendationHexColor()).isEqualTo("#aaaaaa");
|
||||
assertThat(type.getSkippedHexColor()).isEqualTo("#aaaaaa");
|
||||
assertThat(type.isDossierDictionaryOnly()).isFalse();
|
||||
|
||||
dictionaryClient.addEntry(type.getType(), type.getDossierTemplateId(), List.of("word1", "word2"), false, null, DictionaryEntryType.ENTRY);
|
||||
dictionaryClient.addEntry(type.getType(), type.getDossierTemplateId(), List.of("false_positive1", "false_positive"), false, null, DictionaryEntryType.FALSE_POSITIVE);
|
||||
@ -181,6 +182,7 @@ public class DictionaryTest extends AbstractPersistenceServerServiceTest {
|
||||
dictionary = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), null);
|
||||
assertThat(dictionary.getEntries()).hasSize(1);
|
||||
assertThat(dictionary.getEntries().iterator().next()).isEqualTo(word);
|
||||
assertThat((dictionary.isDossierDictionaryOnly())).isFalse();
|
||||
|
||||
// Act & Assert: Delete word; Should have 'deleted' flag
|
||||
entries = new ArrayList<>();
|
||||
@ -246,7 +248,7 @@ public class DictionaryTest extends AbstractPersistenceServerServiceTest {
|
||||
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier();
|
||||
|
||||
dictionaryClient.addType(CreateTypeValue.builder()
|
||||
var returnedtype1 = dictionaryClient.addType(CreateTypeValue.builder()
|
||||
.type("dossier_redaction_2")
|
||||
.label("Dossier Redactions")
|
||||
.hexColor("#fcba03")
|
||||
@ -257,13 +259,15 @@ public class DictionaryTest extends AbstractPersistenceServerServiceTest {
|
||||
.description("Something")
|
||||
.addToDictionaryAction(false)
|
||||
.dossierTemplateId(dossier.getDossierTemplateId())
|
||||
.dossierDictionaryOnly(true)
|
||||
.build(), dossier.getId());
|
||||
assertThat(returnedtype1.isDossierDictionaryOnly()).isTrue();
|
||||
|
||||
var dossierTemplate = dossierTemplateClient.getDossierTemplate(dossier.getDossierTemplateId());
|
||||
|
||||
var dossier2 = dossierTesterAndProvider.provideTestDossier(dossierTemplate, "dossier2");
|
||||
|
||||
dictionaryClient.addType(CreateTypeValue.builder()
|
||||
var returnedType2 = dictionaryClient.addType(CreateTypeValue.builder()
|
||||
.type("dossier_redaction_2")
|
||||
.label("Dossier Redactions 2")
|
||||
.hexColor("#fcba03")
|
||||
@ -273,7 +277,9 @@ public class DictionaryTest extends AbstractPersistenceServerServiceTest {
|
||||
.description("Something")
|
||||
.addToDictionaryAction(false)
|
||||
.dossierTemplateId(dossier2.getDossierTemplateId())
|
||||
.dossierDictionaryOnly(true)
|
||||
.build(), dossier2.getId());
|
||||
assertThat(returnedType2.isDossierDictionaryOnly()).isTrue();
|
||||
|
||||
assertThat(dictionaryClient.getAllTypes(dossier.getDossierTemplateId(), null, false).getTypes()).isEmpty();
|
||||
assertThat(dictionaryClient.getAllTypes(dossier.getDossierTemplateId(), dossier.getId(), false).getTypes().size()).isEqualTo(2);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.iqser.red.service.peristence.v1.server.integration.tests;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.client.DictionaryClient;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.client.DossierClient;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.client.DossierStatusClient;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.client.ReportTemplateClient;
|
||||
@ -53,6 +55,9 @@ public class DossierTest extends AbstractPersistenceServerServiceTest {
|
||||
@Autowired
|
||||
private DossierStatusClient dossierStatusClient;
|
||||
|
||||
@Autowired
|
||||
private DictionaryClient dictionaryClient;
|
||||
|
||||
@Autowired
|
||||
private WatermarkClient watermarkClient;
|
||||
|
||||
@ -101,6 +106,10 @@ public class DossierTest extends AbstractPersistenceServerServiceTest {
|
||||
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier();
|
||||
|
||||
var returnedTypes = dictionaryClient.getAllTypes(dossier.getDossierTemplateId(), dossier.getDossierId(), false);
|
||||
assertThat(returnedTypes.getTypes().size()).isEqualTo(1);
|
||||
assertThat(returnedTypes.getTypes().get(0).isDossierDictionaryOnly()).isTrue();
|
||||
|
||||
var watermark = new WatermarkModel();
|
||||
watermark.setName("watermark name");
|
||||
watermark.setEnabled(true);
|
||||
|
||||
@ -61,4 +61,7 @@ public class CreateTypeValue {
|
||||
@Schema(description = "If the ui should hide entries of this type by default if they are skipped")
|
||||
private boolean autoHideSkipped;
|
||||
|
||||
@Schema(description = "Flag to indicate the dictionary is on dossier level only")
|
||||
private boolean dossierDictionaryOnly;
|
||||
|
||||
}
|
||||
|
||||
@ -67,4 +67,7 @@ public class Dictionary {
|
||||
@Schema(description = "If the ui should hide entries of this type by default if they are skipped")
|
||||
private boolean autoHideSkipped;
|
||||
|
||||
@Schema(description = "Flag to indicate the dictionary is on dossier level only")
|
||||
private boolean dossierDictionaryOnly;
|
||||
|
||||
}
|
||||
|
||||
@ -62,4 +62,7 @@ public class TypeValue {
|
||||
@Schema(description = "If the ui should hide entries of this type by default if they are skipped")
|
||||
private boolean autoHideSkipped;
|
||||
|
||||
@Schema(description = "Flag to indicate the dictionary is on dossier level only")
|
||||
private boolean dossierDictionaryOnly;
|
||||
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ public class Type {
|
||||
private String description;
|
||||
private long version;
|
||||
private boolean addToDictionaryAction;
|
||||
private boolean dossierDictionaryOnly;
|
||||
private String dossierTemplateId;
|
||||
private String dossierId;
|
||||
private List<DictionaryEntry> entries = new ArrayList<>();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user