diff --git a/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java b/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java index 236acc112..76d0110dd 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java +++ b/dmp-backend/core/src/main/java/eu/eudat/query/ReferenceQuery.java @@ -265,7 +265,7 @@ public class ReferenceQuery extends QueryBase { else if (item.match(Reference._updatedAt)) return ReferenceEntity._updatedAt; else if (item.match(Reference._hash)) return ReferenceEntity._updatedAt; else if (item.match(Reference._isActive)) return ReferenceEntity._isActive; - else if (item.match(Reference._definition)) return ReferenceEntity._definition; + else if (item.prefix(Reference._definition)) return ReferenceEntity._definition; else if (item.match(Reference._abbreviation)) return ReferenceEntity._abbreviation; else if (item.match(Reference._reference) || item.match(PublicReference._reference)) return ReferenceEntity._reference; else if (item.match(Reference._source)) return ReferenceEntity._source; diff --git a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.model.ts b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.model.ts index 89b3b452b..c9a55ead7 100644 --- a/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.model.ts +++ b/dmp-frontend/src/app/ui/admin/dmp-blueprint/editor/dmp-blueprint-editor.model.ts @@ -28,7 +28,7 @@ export class DmpBlueprintEditorModel extends BaseEditorModel implements DmpBluep this.label = item.label; this.status = item.status; this.description = item.description; - this.definition = new DmpBlueprintDefinitionEditorModel().fromModel(item.definition); + this.definition = new DmpBlueprintDefinitionEditorModel(this.validationErrorModel).fromModel(item.definition); } return this; } @@ -108,7 +108,7 @@ export class DmpBlueprintDefinitionEditorModel implements DmpBlueprintDefinition public fromModel(item: DmpBlueprintDefinition): DmpBlueprintDefinitionEditorModel { if (item) { - if (item.sections) { item.sections.map(x => this.sections.push(new DmpBlueprintDefinitionSectionEditorModel().fromModel(x))); } + if (item.sections) { item.sections.map(x => this.sections.push(new DmpBlueprintDefinitionSectionEditorModel(this.validationErrorModel).fromModel(x))); } } return this; } @@ -192,8 +192,8 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef this.description = item.description; this.ordinal = item.ordinal; this.hasTemplates = item.hasTemplates; - if (item.fields) { item.fields.map(x => this.fields.push(new FieldInSectionEditorModel().fromModel(x))); } - if (item.descriptionTemplates) { item.descriptionTemplates.map(x => this.descriptionTemplates.push(new DescriptionTemplatesInSectionEditorModel().fromModel(x))); } + if (item.fields) { item.fields.map(x => this.fields.push(new FieldInSectionEditorModel(this.validationErrorModel).fromModel(x))); } + if (item.descriptionTemplates) { item.descriptionTemplates.map(x => this.descriptionTemplates.push(new DescriptionTemplatesInSectionEditorModel(this.validationErrorModel).fromModel(x))); } } return this; } @@ -222,7 +222,7 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef (item, index) => new FieldInSectionEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `fields[${index}].` + rootPath: `${rootPath}fields[${index}].` }), context.getValidation('fields') ) ), @@ -231,7 +231,7 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef (item, index) => new DescriptionTemplatesInSectionEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `fields[${index}].` + rootPath: `${rootPath}descriptionTemplates[${index}].` }), context.getValidation('descriptionTemplates') ) ) diff --git a/dmp-frontend/src/app/ui/admin/reference-type/editor/reference-type-editor.model.ts b/dmp-frontend/src/app/ui/admin/reference-type/editor/reference-type-editor.model.ts index aea42c0da..67eef1c98 100644 --- a/dmp-frontend/src/app/ui/admin/reference-type/editor/reference-type-editor.model.ts +++ b/dmp-frontend/src/app/ui/admin/reference-type/editor/reference-type-editor.model.ts @@ -25,7 +25,7 @@ export class ReferenceTypeEditorModel extends BaseEditorModel implements Referen this.id = item.id; this.name = item.name; this.code = item.code; - this.definition = new ReferenceTypeDefinitionEditorModel().fromModel(item.definition); + this.definition = new ReferenceTypeDefinitionEditorModel(this.validationErrorModel).fromModel(item.definition); this.hash = item.hash; if (item.createdAt) { this.createdAt = item.createdAt; } if (item.updatedAt) { this.updatedAt = item.updatedAt; } @@ -130,8 +130,8 @@ export class ReferenceTypeDefinitionEditorModel implements ReferenceTypeDefiniti public fromModel(item: ReferenceTypeDefinition): ReferenceTypeDefinitionEditorModel { if (item) { - if (item.fields) { item.fields.map(x => this.fields.push(new ReferenceTypeFieldEditorModel().fromModel(x))); } - if (item.sources) { item.sources.map(x => this.sources.push(new ReferenceTypeSourceBaseConfigurationEditorModel().fromModel(x))); } + if (item.fields) { item.fields.map(x => this.fields.push(new ReferenceTypeFieldEditorModel(this.validationErrorModel).fromModel(x))); } + if (item.sources) { item.sources.map(x => this.sources.push(new ReferenceTypeSourceBaseConfigurationEditorModel(this.validationErrorModel).fromModel(x))); } } return this; } @@ -155,7 +155,7 @@ export class ReferenceTypeDefinitionEditorModel implements ReferenceTypeDefiniti (item, index) => new ReferenceTypeFieldEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `[${index}].` + rootPath: `${rootPath}fields[${index}].` }), context.getValidation('fields') ) ), @@ -164,7 +164,7 @@ export class ReferenceTypeDefinitionEditorModel implements ReferenceTypeDefiniti (item, index) => new ReferenceTypeSourceBaseConfigurationEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `sources[${index}].` + rootPath: `${rootPath}sources[${index}].` }), context.getValidation('sources') ) ) @@ -305,7 +305,7 @@ export class ReferenceTypeSourceBaseConfigurationEditorModel implements Referenc ordinal: number; url: string; - results: ResultsConfigurationEditorModel = new ResultsConfigurationEditorModel(); + results: ResultsConfigurationEditorModel = new ResultsConfigurationEditorModel(this.validationErrorModel); paginationPath: string; contentType: string; firstPage: string; @@ -333,25 +333,25 @@ export class ReferenceTypeSourceBaseConfigurationEditorModel implements Referenc this.ordinal = item.ordinal; if (item.url) this.url = item.url; - if (item.results) this.results = new ResultsConfigurationEditorModel().fromModel(item.results); + if (item.results) this.results = new ResultsConfigurationEditorModel(this.validationErrorModel).fromModel(item.results); if (item.paginationPath) this.paginationPath = item.paginationPath; if (item.contentType) this.contentType = item.contentType; if (item.firstPage) this.firstPage = item.firstPage; if (item.httpMethod) this.httpMethod = item.httpMethod; if (item.requestBody) this.requestBody = item.requestBody; if (item.filterType) this.filterType = item.filterType; - if (item.auth) this.auth = new AuthenticationConfigurationEditorModel().fromModel(item.auth); - if (item.queries) { item.queries.map(x => this.queries.push(new QueryConfigEditorModel().fromModel(x))); } + if (item.auth) this.auth = new AuthenticationConfigurationEditorModel(this.validationErrorModel).fromModel(item.auth); + if (item.queries) { item.queries.map(x => this.queries.push(new QueryConfigEditorModel(this.validationErrorModel).fromModel(x))); } if (item.options) { - item.options.map(x => this.options.push(new ReferenceTypeStaticOptionEditorModel().fromModel(x))); + item.options.map(x => this.options.push(new ReferenceTypeStaticOptionEditorModel(this.validationErrorModel).fromModel(x))); } else { this.options.push(new ReferenceTypeStaticOptionEditorModel().fromModel({ code: 'reference_id', value: undefined })); this.options.push(new ReferenceTypeStaticOptionEditorModel().fromModel({ code: 'label', value: undefined })); this.options.push(new ReferenceTypeStaticOptionEditorModel().fromModel({ code: 'description', value: undefined })); } - if (item.dependencies) { item.dependencies.map(x => this.dependencies.push(new ReferenceTypeSourceBaseDependencyEditorModel().fromModel(x))); } + if (item.dependencies) { item.dependencies.map(x => this.dependencies.push(new ReferenceTypeSourceBaseDependencyEditorModel(this.validationErrorModel).fromModel(x))); } } return this; } @@ -377,8 +377,7 @@ export class ReferenceTypeSourceBaseConfigurationEditorModel implements Referenc url: [{ value: this.url, disabled: disabled }, context.getValidation('url').validators], results: this.results.buildForm({ - rootPath: `results.`, - //context: context.getValidation('results') + rootPath: `${rootPath}results.`, }), paginationPath: [{ value: this.paginationPath, disabled: disabled }, context.getValidation('paginationPath').validators], contentType: [{ value: this.contentType, disabled: disabled }, context.getValidation('contentType').validators], @@ -394,7 +393,7 @@ export class ReferenceTypeSourceBaseConfigurationEditorModel implements Referenc (item, index) => new QueryConfigEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `queries[${index}].` + rootPath: `${rootPath}queries[${index}].` }), context.getValidation('queries') ) ), @@ -403,7 +402,7 @@ export class ReferenceTypeSourceBaseConfigurationEditorModel implements Referenc (item, index) => new ReferenceTypeStaticOptionEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `options[${index}].` + rootPath: `${rootPath}options[${index}].` }), context.getValidation('options') ) ), @@ -412,7 +411,7 @@ export class ReferenceTypeSourceBaseConfigurationEditorModel implements Referenc (item, index) => new ReferenceTypeSourceBaseDependencyEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `dependencies[${index}].` + rootPath: `${rootPath}dependencies[${index}].` }), context.getValidation('dependencies') ) ) @@ -512,7 +511,7 @@ export class ResultsConfigurationEditorModel implements ResultsConfigurationPers fromModel(item: ResultsConfiguration): ResultsConfigurationEditorModel { this.resultsArrayPath = item.resultsArrayPath; - if (item.fieldsMapping) { item.fieldsMapping.map(x => this.fieldsMapping.push(new ResultFieldsMappingConfigurationEditorModel().fromModel(x))); } + if (item.fieldsMapping) { item.fieldsMapping.map(x => this.fieldsMapping.push(new ResultFieldsMappingConfigurationEditorModel(this.validationErrorModel).fromModel(x))); } else { this.fieldsMapping.push(new ResultFieldsMappingConfigurationEditorModel().fromModel({ code: 'reference_id', responsePath: undefined })); this.fieldsMapping.push(new ResultFieldsMappingConfigurationEditorModel().fromModel({ code: 'label', responsePath: undefined })); @@ -541,7 +540,7 @@ export class ResultsConfigurationEditorModel implements ResultsConfigurationPers (item, index) => new ResultFieldsMappingConfigurationEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `fieldsMapping[${index}].` + rootPath: `${rootPath}fieldsMapping[${index}].` }), context.getValidation('fieldsMapping') ) ) @@ -901,7 +900,7 @@ export class ReferenceTypeSourceBaseDependencyEditorModel implements ReferenceTy this.referenceTypeCode = item.referenceTypeCode; this.key = item.key; this.required = item.required; - if (item.properties) { item.properties.map(x => this.properties.push(new DependencyPropertyEditorModel().fromModel(x))); } + if (item.properties) { item.properties.map(x => this.properties.push(new DependencyPropertyEditorModel(this.validationErrorModel).fromModel(x))); } return this; } @@ -928,7 +927,7 @@ export class ReferenceTypeSourceBaseDependencyEditorModel implements ReferenceTy (item, index) => new DependencyPropertyEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `properties[${index}].` + rootPath: `${rootPath}properties[${index}].` }), context.getValidation('properties') ) ), diff --git a/dmp-frontend/src/app/ui/admin/reference/editor/reference-editor.model.ts b/dmp-frontend/src/app/ui/admin/reference/editor/reference-editor.model.ts index 0e0a4fc1b..86c72904d 100644 --- a/dmp-frontend/src/app/ui/admin/reference/editor/reference-editor.model.ts +++ b/dmp-frontend/src/app/ui/admin/reference/editor/reference-editor.model.ts @@ -31,7 +31,7 @@ export class ReferenceEditorModel extends BaseEditorModel implements ReferencePe this.label = item.label; this.type = item.type; this.description = item.description; - if (item.definition) this.definition = new DefinitionEditorModel().fromModel(item.definition); + if (item.definition) this.definition = new DefinitionEditorModel(this.validationErrorModel).fromModel(item.definition); this.reference = item.reference; this.abbreviation = item.abbreviation; this.source = item.source; @@ -108,7 +108,7 @@ export class DefinitionEditorModel implements DefinitionPersist { public fromModel(item: Definition): DefinitionEditorModel { if (item) { - if (item.fields) { item.fields.map(x => this.fields.push(new FieldEditorModel().fromModel(x))); } + if (item.fields) { item.fields.map(x => this.fields.push(new FieldEditorModel(this.validationErrorModel).fromModel(x))); } } return this; } @@ -132,7 +132,7 @@ export class DefinitionEditorModel implements DefinitionPersist { (item, index) => new FieldEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `fields[${index}].` + rootPath: `${rootPath}fields[${index}].` }), context.getValidation('fields') ) ), diff --git a/dmp-frontend/src/app/ui/admin/reference/editor/reference-editor.resolver.ts b/dmp-frontend/src/app/ui/admin/reference/editor/reference-editor.resolver.ts index 3a2465f6f..87b7ba78e 100644 --- a/dmp-frontend/src/app/ui/admin/reference/editor/reference-editor.resolver.ts +++ b/dmp-frontend/src/app/ui/admin/reference/editor/reference-editor.resolver.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; -import { Reference } from '@app/core/model/reference/reference'; +import { Definition, Field, Reference } from '@app/core/model/reference/reference'; import { ReferenceService } from '@app/core/services/reference/reference.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; import { BaseEditorResolver } from '@common/base/base-editor.resolver'; @@ -28,6 +28,9 @@ export class ReferenceEditorResolver extends BaseEditorResolver { nameof(x => x.sourceType), nameof(x => x.createdAt), nameof(x => x.updatedAt), + [nameof(x => x.definition), nameof(x => x.fields), nameof(x => x.code)].join('.'), + [nameof(x => x.definition), nameof(x => x.fields), nameof(x => x.dataType)].join('.'), + [nameof(x => x.definition), nameof(x => x.fields), nameof(x => x.value)].join('.'), nameof(x => x.hash), nameof(x => x.isActive) ] diff --git a/dmp-frontend/src/app/ui/admin/tenant/editor/tenant-editor.model.ts b/dmp-frontend/src/app/ui/admin/tenant/editor/tenant-editor.model.ts index ec5775981..fc410e564 100644 --- a/dmp-frontend/src/app/ui/admin/tenant/editor/tenant-editor.model.ts +++ b/dmp-frontend/src/app/ui/admin/tenant/editor/tenant-editor.model.ts @@ -23,7 +23,7 @@ export class TenantEditorModel extends BaseEditorModel implements TenantPersist this.name = item.name; this.code = item.code; this.description = item.description; - if (item.config) this.config = new TenantConfigEditorModel().fromModel(item.config); + if (item.config) this.config = new TenantConfigEditorModel(this.validationErrorModel).fromModel(item.config); } return this; } @@ -37,7 +37,7 @@ export class TenantEditorModel extends BaseEditorModel implements TenantPersist code: [{ value: this.code, disabled: disabled }, context.getValidation('code').validators], description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators], config: this.config.buildForm({ - rootPath: `config.` + rootPath: `config.`, }), hash: [{ value: this.hash, disabled: disabled }, context.getValidation('hash').validators] }); @@ -107,8 +107,8 @@ export class TenantConfigEditorModel implements TenantConfigPersist { public fromModel(item: TenantConfig): TenantConfigEditorModel { if (item) { - if (item.deposit) this.deposit = new TenantDepositConfigEditorModel().fromModel(item.deposit); - if (item.fileTransformers) this.fileTransformers = new TenantFileTransformersConfigEditorModel().fromModel(item.fileTransformers); + if (item.deposit) this.deposit = new TenantDepositConfigEditorModel(this.validationErrorModel).fromModel(item.deposit); + if (item.fileTransformers) this.fileTransformers = new TenantFileTransformersConfigEditorModel(this.validationErrorModel).fromModel(item.fileTransformers); } return this; } @@ -128,10 +128,10 @@ export class TenantConfigEditorModel implements TenantConfigPersist { return this.formBuilder.group({ deposit: this.deposit.buildForm({ - rootPath: `deposit.` + rootPath: `${rootPath}deposit.` }), fileTransformers: this.fileTransformers.buildForm({ - rootPath: `fileTransformers.` + rootPath: `${rootPath}fileTransformers.` }), }); } @@ -161,7 +161,7 @@ export class TenantDepositConfigEditorModel implements TenantDepositConfigPersis public fromModel(item: TenantDepositConfig): TenantDepositConfigEditorModel { if (item) { - if (item.sources) { item.sources.map(x => this.sources.push(new TenantSourceEditorModel().fromModel(x))); } + if (item.sources) { item.sources.map(x => this.sources.push(new TenantSourceEditorModel(this.validationErrorModel).fromModel(x))); } } return this; } @@ -185,7 +185,7 @@ export class TenantDepositConfigEditorModel implements TenantDepositConfigPersis (item, index) => new TenantSourceEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `sources[${index}].` + rootPath: `${rootPath}sources[${index}].` }), context.getValidation('sources') ) ), @@ -233,7 +233,7 @@ export class TenantFileTransformersConfigEditorModel implements TenantFileTransf public fromModel(item: TenantFileTransformersConfig): TenantFileTransformersConfigEditorModel { if (item) { - if (item.sources) { item.sources.map(x => this.sources.push(new TenantSourceEditorModel().fromModel(x))); } + if (item.sources) { item.sources.map(x => this.sources.push(new TenantSourceEditorModel(this.validationErrorModel).fromModel(x))); } } return this; } @@ -257,7 +257,7 @@ export class TenantFileTransformersConfigEditorModel implements TenantFileTransf (item, index) => new TenantSourceEditorModel( this.validationErrorModel ).fromModel(item).buildForm({ - rootPath: `sources[${index}].` + rootPath: `${rootPath}sources[${index}].` }), context.getValidation('sources') ) ),