add sActive description tags filter and fix dmp clone

This commit is contained in:
amentis 2024-04-26 18:03:34 +03:00
parent c91a2408a3
commit 429d4a35ea
5 changed files with 9 additions and 5 deletions

View File

@ -94,10 +94,7 @@ public class CloneDmpPersist {
.failOn(CloneDmpPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._label}, LocaleContextHolder.getLocale())), .failOn(CloneDmpPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._label}, LocaleContextHolder.getLocale())),
this.spec() this.spec()
.must(() -> !this.isEmpty(item.getDescription())) .must(() -> !this.isEmpty(item.getDescription()))
.failOn(CloneDmpPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._description}, LocaleContextHolder.getLocale())), .failOn(CloneDmpPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._description}, LocaleContextHolder.getLocale()))
this.spec()
.must(() -> !this.isNull(item.getDescriptions()))
.failOn(CloneDmpPersist._descriptions).failWith(messageSource.getMessage("Validation_Required", new Object[]{CloneDmpPersist._descriptions}, LocaleContextHolder.getLocale()))
); );
} }
} }

View File

@ -580,6 +580,11 @@ public class DmpServiceImpl implements DmpService {
this.annotationEntityTouchedIntegrationEventHandler.handleDmp(newDmp.getId()); this.annotationEntityTouchedIntegrationEventHandler.handleDmp(newDmp.getId());
DmpEntity resultingDmpEntity = this.queryFactory.query(DmpQuery.class).ids(newDmp.getId()).firstAs(fields); DmpEntity resultingDmpEntity = this.queryFactory.query(DmpQuery.class).ids(newDmp.getId()).firstAs(fields);
if (!this.conventionService.isListNullOrEmpty(model.getDescriptions())){
for (UUID description: model.getDescriptions()) {
descriptionService.clone(newDmp.getId(), description);
}
}
return this.builderFactory.builder(DmpBuilder.class).build(fields, resultingDmpEntity); return this.builderFactory.builder(DmpBuilder.class).build(fields, resultingDmpEntity);
} }

View File

@ -36,7 +36,7 @@ export class DescriptionEditorModel extends BaseEditorModel implements Descripti
this.descriptionTemplateId = item.descriptionTemplate?.id; this.descriptionTemplateId = item.descriptionTemplate?.id;
this.status = item.status ?? DescriptionStatus.Draft; this.status = item.status ?? DescriptionStatus.Draft;
this.description = item.description; this.description = item.description;
this.tags = item.descriptionTags?.map(x => x.tag?.label); this.tags = item.descriptionTags?.filter(x => x.isActive === IsActive.Active).map(x => x.tag?.label);
this.properties = new DescriptionPropertyDefinitionEditorModel(this.validationErrorModel).fromModel(item.properties, descriptionTemplate, item.descriptionReferences); this.properties = new DescriptionPropertyDefinitionEditorModel(this.validationErrorModel).fromModel(item.properties, descriptionTemplate, item.descriptionReferences);
} }
return this; return this;

View File

@ -75,6 +75,7 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.id),].join('.'), [nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.id),].join('.'),
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.tag), nameof<Tag>(x => x.label)].join('.'), [nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.tag), nameof<Tag>(x => x.label)].join('.'),
[nameof<Description>(x => x.descriptionTags), nameof<DescriptionTag>(x => x.tag), nameof<Tag>(x => x.isActive)].join('.'),
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.data), nameof<DescriptionReferenceData>(x => x.fieldId)].join('.'), [nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.data), nameof<DescriptionReferenceData>(x => x.fieldId)].join('.'),
[nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'), [nameof<Description>(x => x.descriptionReferences), nameof<DescriptionReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),

View File

@ -63,6 +63,7 @@ export class TagsComponent extends BaseComponent implements OnInit {
if (index >= 0) { if (index >= 0) {
this.tags.splice(index, 1); this.tags.splice(index, 1);
this.form.setValue(this.tags);
} }
} }