Merge branch 'RED-8826' into 'master'

RED-8826: Added experimetal flag to entity types

Closes RED-8826

See merge request redactmanager/persistence-service!462
This commit is contained in:
Dominique Eifländer 2024-04-23 14:23:25 +02:00
commit 7acc0889b7
10 changed files with 45 additions and 6 deletions

View File

@ -60,6 +60,8 @@ public class TypeEntity {
private boolean autoHideSkipped;
@Column
private OffsetDateTime softDeletedTime;
@Column
private boolean experimental;
@Column
private boolean dossierDictionaryOnly;

View File

@ -106,7 +106,8 @@ public class DictionaryManagementService {
typeRequest.isHasDictionary(),
typeRequest.isSystemManaged(),
typeRequest.isAutoHideSkipped(),
typeRequest.isDossierDictionaryOnly()), Type.class, new TypeMapper());
typeRequest.isDossierDictionaryOnly(),
typeRequest.isExperimental()), Type.class, new TypeMapper());
}
@ -275,8 +276,11 @@ public class DictionaryManagementService {
public void checkForDossierTypeExistenceAndCreate(String typeId) {
checkForDossierTypeExistenceAndCreate(typeId,false);
checkForDossierTypeExistenceAndCreate(typeId, false);
}
public void checkForDossierTypeExistenceAndCreate(String typeId, boolean includeDeleted) {
// check for the existence of dossier type and create in case it does not exist
if (isDossierTypeId(typeId)) {
@ -289,7 +293,7 @@ public class DictionaryManagementService {
log.info("--> " + dossierId + " - " + dossierTemplateId);
checkDossierMatchesDossierTemplate(dossierId, dossierTemplateId);
// type not found, it should be created based on the info from the dossier template type
var dossierTemplateType = dictionaryPersistenceService.getType(getDosssierTemplateTypeIdFromTypeId(typeId),includeDeleted);
var dossierTemplateType = dictionaryPersistenceService.getType(getDosssierTemplateTypeIdFromTypeId(typeId), includeDeleted);
Type dossierDictionaryType = MagicConverter.convert(dossierTemplateType, Type.class);
dossierDictionaryType.setVersion(0);
dossierDictionaryType.setDossierId(dossierId);

View File

@ -274,6 +274,7 @@ public class DictionaryService {
.autoHideSkipped(typeResult.isAutoHideSkipped())
.dossierDictionaryOnly(typeResult.isDossierDictionaryOnly())
.softDeletedTime(typeResult.getSoftDeletedTime())
.experimental(typeResult.isExperimental())
.build())
.collect(Collectors.toList());
return new TypeResponse(typeValues);
@ -331,6 +332,7 @@ public class DictionaryService {
.systemManaged(dictionaryForType.isSystemManaged())
.autoHideSkipped(dictionaryForType.isAutoHideSkipped())
.dossierDictionaryOnly(dictionaryForType.isDossierDictionaryOnly())
.experimental(dictionaryForType.isExperimental())
.build();
}
@ -392,6 +394,7 @@ public class DictionaryService {
.systemManaged(entity.isSystemManaged())
.autoHideSkipped(entity.isAutoHideSkipped())
.dossierDictionaryOnly(entity.isDossierDictionaryOnly())
.experimental(entity.isExperimental())
.build();
dictionaries.add(dict);
});

View File

@ -174,7 +174,8 @@ public class DossierTemplateCloneService {
t.isHasDictionary(),
t.isSystemManaged(),
t.isAutoHideSkipped(),
t.isDossierDictionaryOnly());
t.isDossierDictionaryOnly(),
t.isExperimental());
entryPersistenceService.cloneEntries(t.getId(), type.getId());
}
}

View File

@ -53,7 +53,8 @@ public class DictionaryPersistenceService {
boolean hasDictionary,
boolean systemManaged,
boolean autoHideSkipped,
boolean dossierDictionaryOnly) {
boolean dossierDictionaryOnly,
boolean experimental) {
checkRankAlreadyExists(type, dossierTemplateId, rank, dossierId);
@ -78,6 +79,7 @@ public class DictionaryPersistenceService {
.autoHideSkipped(autoHideSkipped)
.softDeletedTime(null)
.dossierDictionaryOnly(dossierDictionaryOnly)
.experimental(experimental)
.build();
return typeRepository.saveAndFlush(t);
@ -90,7 +92,12 @@ public class DictionaryPersistenceService {
if (!existingTypesForRank.isEmpty()) {
for (var existingTypeValueForRank : existingTypesForRank) {
if (!existingTypeValueForRank.isDeleted() && !existingTypeValueForRank.getType().equalsIgnoreCase(type)) {
throw new ConflictException("Rank already exists: " + rank + " on type: " + existingTypeValueForRank.getType() + " type id: " + existingTypeValueForRank.getId());
throw new ConflictException("Rank already exists: "
+ rank
+ " on type: "
+ existingTypeValueForRank.getType()
+ " type id: "
+ existingTypeValueForRank.getId());
}
}
}
@ -298,6 +305,7 @@ public class DictionaryPersistenceService {
}
@Transactional
public void updateRankForType(String typeId, int newRank) {

View File

@ -199,3 +199,5 @@ databaseChangeLog:
file: db/changelog/tenant/sql/207-acl-migration-cleanup.sql
- include:
file: db/changelog/tenant/125-add-max-size-for-legal-basis-in-manual-legal-basis-change.yaml
- include:
file: db/changelog/tenant/126-add-experimental-flag-to-entity.yaml

View File

@ -0,0 +1,12 @@
databaseChangeLog:
- changeSet:
id: add-experimental-flag-to-entity
author: dom
changes:
- addColumn:
columns:
- column:
name: experimental
type: BOOLEAN
defaultValueBoolean: false
tableName: entity

View File

@ -66,6 +66,9 @@ public class TypeValue {
@Schema(description = "Flag to indicate the dictionary is on dossier level only")
private boolean dossierDictionaryOnly;
@Schema(description = "Flag to indicate if a entity is experimental and should not be show in default mode")
private boolean experimental;
@Schema(description = "Time of soft deletion, will be null if it's not soft deleted")
private OffsetDateTime softDeletedTime;

View File

@ -70,4 +70,7 @@ public class Dictionary {
@Schema(description = "Flag to indicate the dictionary is on dossier level only")
private boolean dossierDictionaryOnly;
@Schema(description = "Flag to indicate if a entity is experimental and should not be show in default mode")
private boolean experimental;
}

View File

@ -42,6 +42,7 @@ public class Type {
private boolean systemManaged;
private boolean autoHideSkipped;
private OffsetDateTime softDeletedTime;
private boolean experimental;
// For auto-mappers