bug fixes

This commit is contained in:
Efstratios Giannopoulos 2024-05-02 17:37:17 +03:00
parent a3fba92999
commit 8426d49157
5 changed files with 120 additions and 53 deletions

View File

@ -1,10 +1,21 @@
package org.opencdmp.controllers; package org.opencdmp.controllers;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import gr.cite.tools.auditing.AuditService;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.censor.CensorFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.exception.MyForbiddenException;
import gr.cite.tools.exception.MyNotFoundException;
import gr.cite.tools.fieldset.BaseFieldSet;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService;
import gr.cite.tools.logging.MapLogEntry;
import gr.cite.tools.validation.ValidationFilterAnnotation;
import jakarta.xml.bind.JAXBException;
import org.opencdmp.audit.AuditableAction; import org.opencdmp.audit.AuditableAction;
import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.authorization.AuthorizationFlags;
import gr.cite.tools.fieldset.BaseFieldSet;
import gr.cite.tools.validation.ValidationFilterAnnotation;
import org.opencdmp.data.DescriptionTemplateEntity; import org.opencdmp.data.DescriptionTemplateEntity;
import org.opencdmp.model.DescriptionTemplate; import org.opencdmp.model.DescriptionTemplate;
import org.opencdmp.model.DmpBlueprint; import org.opencdmp.model.DmpBlueprint;
@ -17,17 +28,7 @@ import org.opencdmp.model.result.QueryResult;
import org.opencdmp.query.DescriptionTemplateQuery; import org.opencdmp.query.DescriptionTemplateQuery;
import org.opencdmp.query.lookup.DescriptionTemplateLookup; import org.opencdmp.query.lookup.DescriptionTemplateLookup;
import org.opencdmp.service.descriptiontemplate.DescriptionTemplateService; import org.opencdmp.service.descriptiontemplate.DescriptionTemplateService;
import gr.cite.tools.auditing.AuditService; import org.opencdmp.service.fieldsetexpander.FieldSetExpanderService;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.censor.CensorFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.exception.MyForbiddenException;
import gr.cite.tools.exception.MyNotFoundException;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService;
import gr.cite.tools.logging.MapLogEntry;
import jakarta.xml.bind.JAXBException;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
@ -63,20 +64,22 @@ public class DescriptionTemplateController {
private final QueryFactory queryFactory; private final QueryFactory queryFactory;
private final MessageSource messageSource; private final MessageSource messageSource;
private final FieldSetExpanderService fieldSetExpanderService;
public DescriptionTemplateController( public DescriptionTemplateController(
BuilderFactory builderFactory, BuilderFactory builderFactory,
AuditService auditService, AuditService auditService,
DescriptionTemplateService descriptionTemplateTypeService, DescriptionTemplateService descriptionTemplateTypeService,
CensorFactory censorFactory, CensorFactory censorFactory,
QueryFactory queryFactory, QueryFactory queryFactory,
MessageSource messageSource) { MessageSource messageSource, FieldSetExpanderService fieldSetExpanderService) {
this.builderFactory = builderFactory; this.builderFactory = builderFactory;
this.auditService = auditService; this.auditService = auditService;
this.descriptionTemplateTypeService = descriptionTemplateTypeService; this.descriptionTemplateTypeService = descriptionTemplateTypeService;
this.censorFactory = censorFactory; this.censorFactory = censorFactory;
this.queryFactory = queryFactory; this.queryFactory = queryFactory;
this.messageSource = messageSource; this.messageSource = messageSource;
this.fieldSetExpanderService = fieldSetExpanderService;
} }
@PostMapping("query") @PostMapping("query")
@ -99,13 +102,14 @@ public class DescriptionTemplateController {
@GetMapping("{id}") @GetMapping("{id}")
public DescriptionTemplate get(@PathVariable("id") UUID id, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException { public DescriptionTemplate get(@PathVariable("id") UUID id, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
logger.debug(new MapLogEntry("retrieving" + DescriptionTemplate.class.getSimpleName()).And("id", id).And("fields", fieldSet)); logger.debug(new MapLogEntry("retrieving" + DescriptionTemplate.class.getSimpleName()).And("id", id).And("fields", fieldSet));
fieldSet = this.fieldSetExpanderService.expand(fieldSet);
this.censorFactory.censor(DescriptionTemplateCensor.class).censor(fieldSet, null); this.censorFactory.censor(DescriptionTemplateCensor.class).censor(fieldSet, null);
DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id); DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
DescriptionTemplate model = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet)); DescriptionTemplate model = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
if (model == null) if (model == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale())); throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
this.auditService.track(AuditableAction.DescriptionTemplate_Lookup, Map.ofEntries( this.auditService.track(AuditableAction.DescriptionTemplate_Lookup, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("id", id), new AbstractMap.SimpleEntry<String, Object>("id", id),
@ -120,6 +124,7 @@ public class DescriptionTemplateController {
@ValidationFilterAnnotation(validator = DescriptionTemplatePersist.DescriptionTemplatePersistValidator.ValidatorName, argumentName = "model") @ValidationFilterAnnotation(validator = DescriptionTemplatePersist.DescriptionTemplatePersistValidator.ValidatorName, argumentName = "model")
public DescriptionTemplate persist(@RequestBody DescriptionTemplatePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException { public DescriptionTemplate persist(@RequestBody DescriptionTemplatePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
logger.debug(new MapLogEntry("persisting" + DescriptionTemplate.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); logger.debug(new MapLogEntry("persisting" + DescriptionTemplate.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
fieldSet = this.fieldSetExpanderService.expand(fieldSet);
new BaseFieldSet(fieldSet.getFields()).ensure(DescriptionTemplate._id); new BaseFieldSet(fieldSet.getFields()).ensure(DescriptionTemplate._id);
DescriptionTemplate persisted = this.descriptionTemplateTypeService.persist(model, fieldSet); DescriptionTemplate persisted = this.descriptionTemplateTypeService.persist(model, fieldSet);
@ -144,6 +149,7 @@ public class DescriptionTemplateController {
@GetMapping("clone/{id}") @GetMapping("clone/{id}")
public DescriptionTemplate buildClone(@PathVariable("id") UUID id, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException { public DescriptionTemplate buildClone(@PathVariable("id") UUID id, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
logger.debug(new MapLogEntry("clone" + DmpBlueprint.class.getSimpleName()).And("id", id).And("fields", fieldSet)); logger.debug(new MapLogEntry("clone" + DmpBlueprint.class.getSimpleName()).And("id", id).And("fields", fieldSet));
fieldSet = this.fieldSetExpanderService.expand(fieldSet);
this.censorFactory.censor(DmpBlueprintCensor.class).censor(fieldSet, null); this.censorFactory.censor(DmpBlueprintCensor.class).censor(fieldSet, null);
@ -162,6 +168,7 @@ public class DescriptionTemplateController {
@ValidationFilterAnnotation(validator = NewVersionDescriptionTemplatePersist.NewVersionDescriptionTemplatePersistValidator.ValidatorName, argumentName = "model") @ValidationFilterAnnotation(validator = NewVersionDescriptionTemplatePersist.NewVersionDescriptionTemplatePersistValidator.ValidatorName, argumentName = "model")
public DescriptionTemplate createNewVersion(@RequestBody NewVersionDescriptionTemplatePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException { public DescriptionTemplate createNewVersion(@RequestBody NewVersionDescriptionTemplatePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
logger.debug(new MapLogEntry("persisting" + NewVersionDescriptionTemplatePersist.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); logger.debug(new MapLogEntry("persisting" + NewVersionDescriptionTemplatePersist.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
fieldSet = this.fieldSetExpanderService.expand(fieldSet);
DescriptionTemplate persisted = this.descriptionTemplateTypeService.createNewVersion(model, fieldSet); DescriptionTemplate persisted = this.descriptionTemplateTypeService.createNewVersion(model, fieldSet);
this.auditService.track(AuditableAction.DescriptionTemplate_PersistNewVersion, Map.ofEntries( this.auditService.track(AuditableAction.DescriptionTemplate_PersistNewVersion, Map.ofEntries(
@ -172,7 +179,7 @@ public class DescriptionTemplateController {
return persisted; return persisted;
} }
@RequestMapping(method = RequestMethod.GET, value = {"/xml/export/{id}"}, produces = "application/xml") @RequestMapping(method = RequestMethod.GET, value = "/xml/export/{id}", produces = "application/xml")
public @ResponseBody ResponseEntity<byte[]> getXml(@PathVariable UUID id) throws JAXBException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException { public @ResponseBody ResponseEntity<byte[]> getXml(@PathVariable UUID id) throws JAXBException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
logger.debug(new MapLogEntry("export" + DescriptionTemplate.class.getSimpleName()).And("id", id)); logger.debug(new MapLogEntry("export" + DescriptionTemplate.class.getSimpleName()).And("id", id));
@ -188,6 +195,7 @@ public class DescriptionTemplateController {
@RequestMapping(method = RequestMethod.POST, value = {"/xml/import/{id}", "/xml/import"}) @RequestMapping(method = RequestMethod.POST, value = {"/xml/import/{id}", "/xml/import"})
public DescriptionTemplate importXml(@RequestParam("file") MultipartFile file, @PathVariable(value = "id", required = false) UUID id, FieldSet fieldSet) throws IOException, JAXBException, InvalidApplicationException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException { public DescriptionTemplate importXml(@RequestParam("file") MultipartFile file, @PathVariable(value = "id", required = false) UUID id, FieldSet fieldSet) throws IOException, JAXBException, InvalidApplicationException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException {
logger.debug(new MapLogEntry("import" + DescriptionTemplate.class.getSimpleName()).And("file", file).And("id", id)); logger.debug(new MapLogEntry("import" + DescriptionTemplate.class.getSimpleName()).And("file", file).And("id", id));
fieldSet = this.fieldSetExpanderService.expand(fieldSet);
this.censorFactory.censor(DescriptionTemplateCensor.class).censor(fieldSet, null); this.censorFactory.censor(DescriptionTemplateCensor.class).censor(fieldSet, null);

View File

@ -1,23 +1,6 @@
package org.opencdmp.controllers; package org.opencdmp.controllers;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import org.opencdmp.audit.AuditableAction;
import org.opencdmp.authorization.AuthorizationFlags;
import org.opencdmp.data.PrefillingSourceEntity;
import org.opencdmp.model.Description;
import org.opencdmp.model.Prefilling;
import org.opencdmp.model.PrefillingSource;
import org.opencdmp.model.builder.PrefillingSourceBuilder;
import org.opencdmp.model.censorship.DescriptionCensor;
import org.opencdmp.model.censorship.PrefillingCensor;
import org.opencdmp.model.censorship.PrefillingSourceCensor;
import org.opencdmp.model.persist.PrefillingSearchRequest;
import org.opencdmp.model.persist.DescriptionPrefillingRequest;
import org.opencdmp.model.persist.PrefillingSourcePersist;
import org.opencdmp.model.result.QueryResult;
import org.opencdmp.query.PrefillingSourceQuery;
import org.opencdmp.query.lookup.PrefillingSourceLookup;
import org.opencdmp.service.prefillingsource.PrefillingSourceService;
import gr.cite.tools.auditing.AuditService; import gr.cite.tools.auditing.AuditService;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.data.censor.CensorFactory;
@ -31,6 +14,24 @@ import gr.cite.tools.logging.MapLogEntry;
import gr.cite.tools.validation.ValidationFilterAnnotation; import gr.cite.tools.validation.ValidationFilterAnnotation;
import jakarta.transaction.Transactional; import jakarta.transaction.Transactional;
import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.JAXBException;
import org.opencdmp.audit.AuditableAction;
import org.opencdmp.authorization.AuthorizationFlags;
import org.opencdmp.data.PrefillingSourceEntity;
import org.opencdmp.model.Description;
import org.opencdmp.model.Prefilling;
import org.opencdmp.model.PrefillingSource;
import org.opencdmp.model.builder.PrefillingSourceBuilder;
import org.opencdmp.model.censorship.DescriptionCensor;
import org.opencdmp.model.censorship.PrefillingCensor;
import org.opencdmp.model.censorship.PrefillingSourceCensor;
import org.opencdmp.model.persist.DescriptionPrefillingRequest;
import org.opencdmp.model.persist.PrefillingSearchRequest;
import org.opencdmp.model.persist.PrefillingSourcePersist;
import org.opencdmp.model.result.QueryResult;
import org.opencdmp.query.PrefillingSourceQuery;
import org.opencdmp.query.lookup.PrefillingSourceLookup;
import org.opencdmp.service.fieldsetexpander.FieldSetExpanderService;
import org.opencdmp.service.prefillingsource.PrefillingSourceService;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
@ -47,7 +48,7 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
@RestController @RestController
@RequestMapping(path = {"api/prefilling-source"}) @RequestMapping(path = "api/prefilling-source")
public class PrefillingSourceController { public class PrefillingSourceController {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PrefillingSourceController.class)); private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PrefillingSourceController.class));
@ -61,23 +62,23 @@ public class PrefillingSourceController {
private final QueryFactory queryFactory; private final QueryFactory queryFactory;
private final MessageSource messageSource; private final MessageSource messageSource;
private final PrefillingSourceService prefillingSourceService; private final PrefillingSourceService prefillingSourceService;
private final FieldSetExpanderService fieldSetExpanderService;
@Autowired @Autowired
public PrefillingSourceController( public PrefillingSourceController(
BuilderFactory builderFactory, BuilderFactory builderFactory,
AuditService auditService, AuditService auditService,
CensorFactory censorFactory, CensorFactory censorFactory,
QueryFactory queryFactory, QueryFactory queryFactory,
MessageSource messageSource, PrefillingSourceService prefillingSourceService) { MessageSource messageSource, PrefillingSourceService prefillingSourceService, FieldSetExpanderService fieldSetExpanderService) {
this.builderFactory = builderFactory; this.builderFactory = builderFactory;
this.auditService = auditService; this.auditService = auditService;
this.censorFactory = censorFactory; this.censorFactory = censorFactory;
this.queryFactory = queryFactory; this.queryFactory = queryFactory;
this.messageSource = messageSource; this.messageSource = messageSource;
this.prefillingSourceService = prefillingSourceService; this.prefillingSourceService = prefillingSourceService;
this.fieldSetExpanderService = fieldSetExpanderService;
} }
@PostMapping("query") @PostMapping("query")
@ -99,13 +100,14 @@ public class PrefillingSourceController {
@GetMapping("{id}") @GetMapping("{id}")
public PrefillingSource get(@PathVariable("id") UUID id, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException { public PrefillingSource get(@PathVariable("id") UUID id, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
logger.debug(new MapLogEntry("retrieving" + PrefillingSource.class.getSimpleName()).And("id", id).And("fields", fieldSet)); logger.debug(new MapLogEntry("retrieving" + PrefillingSource.class.getSimpleName()).And("id", id).And("fields", fieldSet));
fieldSet = this.fieldSetExpanderService.expand(fieldSet);
this.censorFactory.censor(PrefillingSourceCensor.class).censor(fieldSet, null); this.censorFactory.censor(PrefillingSourceCensor.class).censor(fieldSet, null);
PrefillingSourceQuery query = this.queryFactory.query(PrefillingSourceQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id); PrefillingSourceQuery query = this.queryFactory.query(PrefillingSourceQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
PrefillingSource model = this.builderFactory.builder(PrefillingSourceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet)); PrefillingSource model = this.builderFactory.builder(PrefillingSourceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
if (model == null) if (model == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, PrefillingSource.class.getSimpleName()}, LocaleContextHolder.getLocale())); throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, PrefillingSource.class.getSimpleName()}, LocaleContextHolder.getLocale()));
this.auditService.track(AuditableAction.PrefillingSource_Lookup, Map.ofEntries( this.auditService.track(AuditableAction.PrefillingSource_Lookup, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("id", id), new AbstractMap.SimpleEntry<String, Object>("id", id),
@ -120,6 +122,7 @@ public class PrefillingSourceController {
@ValidationFilterAnnotation(validator = PrefillingSourcePersist.PrefillingSourcePersistValidator.ValidatorName, argumentName = "model") @ValidationFilterAnnotation(validator = PrefillingSourcePersist.PrefillingSourcePersistValidator.ValidatorName, argumentName = "model")
public PrefillingSource persist(@RequestBody PrefillingSourcePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, JsonProcessingException, InvalidApplicationException { public PrefillingSource persist(@RequestBody PrefillingSourcePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, JsonProcessingException, InvalidApplicationException {
logger.debug(new MapLogEntry("persisting" + PrefillingSource.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); logger.debug(new MapLogEntry("persisting" + PrefillingSource.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
fieldSet = this.fieldSetExpanderService.expand(fieldSet);
this.censorFactory.censor(PrefillingSourceCensor.class).censor(fieldSet, null); this.censorFactory.censor(PrefillingSourceCensor.class).censor(fieldSet, null);
PrefillingSource persisted = this.prefillingSourceService.persist(model, fieldSet); PrefillingSource persisted = this.prefillingSourceService.persist(model, fieldSet);
@ -162,6 +165,7 @@ public class PrefillingSourceController {
@ValidationFilterAnnotation(validator = DescriptionPrefillingRequest.DescriptionProfilingRequestValidator.ValidatorName, argumentName = "model") @ValidationFilterAnnotation(validator = DescriptionPrefillingRequest.DescriptionProfilingRequestValidator.ValidatorName, argumentName = "model")
public Description generate(@RequestBody DescriptionPrefillingRequest model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException { public Description generate(@RequestBody DescriptionPrefillingRequest model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
logger.debug(new MapLogEntry("persisting" + Prefilling.class.getSimpleName()).And("model", model)); logger.debug(new MapLogEntry("persisting" + Prefilling.class.getSimpleName()).And("model", model));
fieldSet = this.fieldSetExpanderService.expand(fieldSet);
this.censorFactory.censor(DescriptionCensor.class).censor(fieldSet, null); this.censorFactory.censor(DescriptionCensor.class).censor(fieldSet, null);

View File

@ -1,6 +1,6 @@
fieldSetExpander: fieldSetExpander:
mappings: mappings:
- key: DescriptionEditorDescriptionTemplateLookupFields - key: DescriptionEditorDescriptionTemplateForDescriptionLookupFields
fields: fields:
- descriptionTemplate.id - descriptionTemplate.id
- descriptionTemplate.label - descriptionTemplate.label
@ -50,4 +50,53 @@ fieldSetExpander:
- descriptionTemplate.definition.pages.sections.fieldSets.fields.data.types.value - descriptionTemplate.definition.pages.sections.fieldSets.fields.data.types.value
- descriptionTemplate.definition.pages.sections.fieldSets.fields.data.referenceType.id - descriptionTemplate.definition.pages.sections.fieldSets.fields.data.referenceType.id
- descriptionTemplate.definition.pages.sections.fieldSets.fields.data.referenceType.name - descriptionTemplate.definition.pages.sections.fieldSets.fields.data.referenceType.name
- key: DescriptionEditorDescriptionTemplateLookupFields
fields:
- id
- label
- version
- versionStatus
- groupId
- isActive
- definition.pages.id
- definition.pages.ordinal
- definition.pages.title
- definition.pages.sections.id
- definition.pages.sections.ordinal
- definition.pages.sections.title
- definition.pages.sections.description
- definition.pages.sections.sections
- definition.pages.sections.fieldSets.id
- definition.pages.sections.fieldSets.ordinal
- definition.pages.sections.fieldSets.title
- definition.pages.sections.fieldSets.description
- definition.pages.sections.fieldSets.extendedDescription
- definition.pages.sections.fieldSets.additionalInformation
- definition.pages.sections.fieldSets.hasCommentField
- definition.pages.sections.fieldSets.hasMultiplicity
- definition.pages.sections.fieldSets.multiplicity.min
- definition.pages.sections.fieldSets.multiplicity.max
- definition.pages.sections.fieldSets.multiplicity.placeholder
- definition.pages.sections.fieldSets.multiplicity.tableView
- definition.pages.sections.fieldSets.fields.id
- definition.pages.sections.fieldSets.fields.defaultValue.textValue
- definition.pages.sections.fieldSets.fields.defaultValue.textListValue
- definition.pages.sections.fieldSets.fields.defaultValue.dateValue
- definition.pages.sections.fieldSets.fields.defaultValue.booleanValue
- definition.pages.sections.fieldSets.fields.validations
- definition.pages.sections.fieldSets.fields.visibilityRules.target
- definition.pages.sections.fieldSets.fields.visibilityRules.textValue
- definition.pages.sections.fieldSets.fields.visibilityRules.textListValue
- definition.pages.sections.fieldSets.fields.visibilityRules.dateValue
- definition.pages.sections.fieldSets.fields.visibilityRules.booleanValue
- definition.pages.sections.fieldSets.fields.data.label
- definition.pages.sections.fieldSets.fields.data.fieldType
- definition.pages.sections.fieldSets.fields.data.options.label
- definition.pages.sections.fieldSets.fields.data.options.value
- definition.pages.sections.fieldSets.fields.data.multipleSelect
- definition.pages.sections.fieldSets.fields.data.type
- definition.pages.sections.fieldSets.fields.data.maxFileSizeInMB
- definition.pages.sections.fieldSets.fields.data.types.label
- definition.pages.sections.fieldSets.fields.data.types.value
- definition.pages.sections.fieldSets.fields.data.referenceType.id
- definition.pages.sections.fieldSets.fields.data.referenceType.name

View File

@ -32,14 +32,14 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
return [ return [
...DescriptionEditorResolver.descriptionLookupFields(), ...DescriptionEditorResolver.descriptionLookupFields(),
...DescriptionEditorResolver.dmpLookupFields(nameof<Description>(x => x.dmp)), ...DescriptionEditorResolver.dmpLookupFields(nameof<Description>(x => x.dmp)),
...DescriptionEditorResolver.descriptionTemplateLookupFields(nameof<Description>(x => x.descriptionTemplate)), ...DescriptionEditorResolver.descriptionTemplateLookupFieldsForDescrption(),
] ]
} }
public static cloneLookupFields(): string[] { public static cloneLookupFields(): string[] {
return [ return [
...DescriptionEditorResolver.descriptionLookupFields(), ...DescriptionEditorResolver.descriptionLookupFields(),
...DescriptionEditorResolver.descriptionTemplateLookupFields(nameof<Description>(x => x.descriptionTemplate)), ...DescriptionEditorResolver.descriptionTemplateLookupFieldsForDescrption(),
] ]
} }
@ -94,7 +94,13 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
] ]
} }
public static descriptionTemplateLookupFields(prefix?: string): string[] { public static descriptionTemplateLookupFieldsForDescrption(): string[] {
return [
"DescriptionEditorDescriptionTemplateForDescriptionLookupFields"
]
}
public static descriptionTemplateLookupFields(): string[] {
return [ return [
"DescriptionEditorDescriptionTemplateLookupFields" "DescriptionEditorDescriptionTemplateLookupFields"
] ]

View File

@ -86,7 +86,7 @@ export class PrefillDescriptionDialogComponent extends BaseComponent implements
next() { next() {
const formData = this.formService.getValue(this.prefillForm.value) as DescriptionPrefillingRequest; const formData = this.formService.getValue(this.prefillForm.value) as DescriptionPrefillingRequest;
this.prefillingSourceService.generate(formData, DescriptionEditorResolver.descriptionTemplateLookupFields(nameof<Description>(x => x.descriptionTemplate))) this.prefillingSourceService.generate(formData, DescriptionEditorResolver.descriptionTemplateLookupFieldsForDescrption())
.pipe(takeUntil(this._destroyed)).subscribe(description => { .pipe(takeUntil(this._destroyed)).subscribe(description => {
if (description) { if (description) {
this.closeDialog(description); this.closeDialog(description);