description template clone fix

This commit is contained in:
CITE\amentis 2024-07-29 14:10:02 +03:00
parent 9a6da41ecd
commit 55be58d39a
1 changed files with 9 additions and 3 deletions

View File

@ -571,11 +571,10 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
for (Field field: fields) {
if (!this.conventionService.isListNullOrEmpty(field.getVisibilityRules())){
field.getVisibilityRules().stream().map(x -> x.getTarget()).collect(Collectors.toList()).forEach(y -> {
visibilityRulesMap.put(y, null);
if (!visibilityRulesMap.containsKey(y)) visibilityRulesMap.put(y, null);
});
}
}
}
if (model.getPages() != null) {
for (Page page : model.getPages()) {
@ -625,7 +624,14 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
private void reassignFieldSet(org.opencdmp.model.descriptiontemplate.FieldSet model, Map<String, String> visibilityRulesMap) {
if (model == null)
return;
String oldFieldSetId = model.getId();
if (visibilityRulesMap != null && visibilityRulesMap.containsKey(oldFieldSetId)){
model.setId(UUID.randomUUID().toString());
visibilityRulesMap.put(oldFieldSetId, model.getId());
} else {
model.setId(UUID.randomUUID().toString());
}
if (model.getFields() != null) {
for (Field field : model.getFields()) {