2023-12-06 22:10:01 +01:00
import { UntypedFormBuilder , UntypedFormGroup , Validators } from "@angular/forms" ;
import { DescriptionStatus } from "@app/core/common/enum/description-status" ;
import { Description , DescriptionField , DescriptionFieldPersist , DescriptionPersist , DescriptionReference , DescriptionReferencePersist , PropertyDefinition , PropertyDefinitionPersist } from "@app/core/model/description/description" ;
import { ReferencePersist } from "@app/core/model/reference/reference" ;
import { BaseEditorModel } from "@common/base/base-form-editor-model" ;
import { BackendErrorValidator } from '@common/forms/validation/custom-validator' ;
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model' ;
import { Validation , ValidationContext } from '@common/forms/validation/validation-context' ;
import { Guid } from "@common/types/guid" ;
export class DescriptionEditorModel extends BaseEditorModel implements DescriptionPersist {
label : string ;
dmpId : Guid ;
dmpDescriptionTemplateId : Guid ;
descriptionTemplateId : Guid ;
status : DescriptionStatus ;
description : string ;
properties : DescriptionPropertyDefinitionEditorModel ;
tags : string [ ] ;
references : DescriptionReferenceEditorModel [ ] ;
permissions : string [ ] ;
public validationErrorModel : ValidationErrorModel = new ValidationErrorModel ( ) ;
protected formBuilder : UntypedFormBuilder = new UntypedFormBuilder ( ) ;
constructor ( ) { super ( ) ; }
public fromModel ( item : Description ) : DescriptionEditorModel {
if ( item ) {
super . fromModel ( item ) ;
this . label = item . label ;
this . dmpId = item . dmp ? . id ;
this . dmpDescriptionTemplateId = item . dmpDescriptionTemplate ? . id ;
this . descriptionTemplateId = item . descriptionTemplate ? . id ;
this . status = item . status ;
this . description = item . description ;
this . tags = item . descriptionTags ? . map ( x = > x . tag ? . label ) ;
this . properties = new DescriptionPropertyDefinitionEditorModel ( ) . fromModel ( item . properties ) ;
//if (item.references) { item.references.map(x => this.references.push(new DescriptionReferenceEditorModel().fromModel(x))); }
}
return this ;
}
buildForm ( context : ValidationContext = null , disabled : boolean = false ) : UntypedFormGroup {
if ( context == null ) { context = this . createValidationContext ( ) ; }
return this . formBuilder . group ( {
id : [ { value : this.id , disabled : disabled } , context . getValidation ( 'id' ) . validators ] ,
label : [ { value : this.label , disabled : disabled } , context . getValidation ( 'label' ) . validators ] ,
dmpId : [ { value : this.dmpId , disabled : disabled } , context . getValidation ( 'dmpId' ) . validators ] ,
dmpDescriptionTemplateId : [ { value : this.dmpDescriptionTemplateId , disabled : disabled } , context . getValidation ( 'dmpDescriptionTemplateId' ) . validators ] ,
descriptionTemplateId : [ { value : this.descriptionTemplateId , disabled : disabled } , context . getValidation ( 'descriptionTemplateId' ) . validators ] ,
status : [ { value : this.status , disabled : disabled } , context . getValidation ( 'status' ) . validators ] ,
description : [ { value : this.description , disabled : disabled } , context . getValidation ( 'description' ) . validators ] ,
tags : [ { value : this.tags , disabled : disabled } , context . getValidation ( 'tags' ) . validators ] ,
properties : this.properties.buildForm ( {
rootPath : ` properties. `
} ) ,
hash : [ { value : this.hash , disabled : disabled } , context . getValidation ( 'hash' ) . validators ]
} ) ;
}
createValidationContext ( ) : ValidationContext {
const baseContext : ValidationContext = new ValidationContext ( ) ;
const baseValidationArray : Validation [ ] = new Array < Validation > ( ) ;
baseValidationArray . push ( { key : 'id' , validators : [ BackendErrorValidator ( this . validationErrorModel , 'id' ) ] } ) ;
baseValidationArray . push ( { key : 'label' , validators : [ Validators . required , BackendErrorValidator ( this . validationErrorModel , 'label' ) ] } ) ;
baseValidationArray . push ( { key : 'dmpId' , validators : [ Validators . required , BackendErrorValidator ( this . validationErrorModel , 'dmpId' ) ] } ) ;
baseValidationArray . push ( { key : 'dmpDescriptionTemplateId' , validators : [ Validators . required , BackendErrorValidator ( this . validationErrorModel , 'dmpDescriptionTemplateId' ) ] } ) ;
baseValidationArray . push ( { key : 'descriptionTemplateId' , validators : [ Validators . required , BackendErrorValidator ( this . validationErrorModel , 'descriptionTemplateId' ) ] } ) ;
baseValidationArray . push ( { key : 'status' , validators : [ Validators . required , BackendErrorValidator ( this . validationErrorModel , 'status' ) ] } ) ;
baseValidationArray . push ( { key : 'description' , validators : [ Validators . required , BackendErrorValidator ( this . validationErrorModel , 'description' ) ] } ) ;
baseValidationArray . push ( { key : 'tags' , validators : [ Validators . required , BackendErrorValidator ( this . validationErrorModel , 'tags' ) ] } ) ;
baseValidationArray . push ( { key : 'hash' , validators : [ ] } ) ;
baseContext . validation = baseValidationArray ;
return baseContext ;
}
}
export class DescriptionPropertyDefinitionEditorModel implements PropertyDefinitionPersist {
fields : DescriptionFieldEditorModel [ ] = [ ] ;
protected formBuilder : UntypedFormBuilder = new UntypedFormBuilder ( ) ;
constructor (
public validationErrorModel : ValidationErrorModel = new ValidationErrorModel ( )
) { }
public fromModel ( item : PropertyDefinition ) : DescriptionPropertyDefinitionEditorModel {
if ( item ) {
if ( item . fields ) { item . fields . map ( x = > this . fields . push ( new DescriptionFieldEditorModel ( ) . fromModel ( x ) ) ) ; }
}
return this ;
}
buildForm ( params ? : {
context? : ValidationContext ,
disabled? : boolean ,
rootPath? : string
} ) : UntypedFormGroup {
let { context = null , disabled = false , rootPath } = params ? ? { }
if ( context == null ) {
context = DescriptionPropertyDefinitionEditorModel . createValidationContext ( {
validationErrorModel : this.validationErrorModel ,
rootPath
} ) ;
}
2023-12-20 08:20:38 +01:00
const formGroup = this . formBuilder . group ( { } ) ;
( this . fields ? ? [ ] ) . map (
( item , index ) = > formGroup . addControl ( item . key , new DescriptionFieldEditorModel (
this . validationErrorModel
) . fromModel ( item ) . buildForm ( {
rootPath : ` ${ rootPath } fields[ ${ index } ]. `
} ) ) , context . getValidation ( 'fields' )
)
return formGroup ;
// return this.formBuilder.group({
// fields: this.formBuilder.array(
// (this.fields ?? []).map(
// (item, index) => new DescriptionFieldEditorModel(
// this.validationErrorModel
// ).fromModel(item).buildForm({
// rootPath: `${rootPath}fields[${index}].`
// }), context.getValidation('fields')
// )
// )
// });
2023-12-06 22:10:01 +01:00
}
static createValidationContext ( params : {
rootPath? : string ,
validationErrorModel : ValidationErrorModel
} ) : ValidationContext {
const { rootPath = '' , validationErrorModel } = params ;
const baseContext : ValidationContext = new ValidationContext ( ) ;
const baseValidationArray : Validation [ ] = new Array < Validation > ( ) ;
baseValidationArray . push ( { key : 'fields' , validators : [ BackendErrorValidator ( validationErrorModel , ` ${ rootPath } fields ` ) ] } ) ;
baseContext . validation = baseValidationArray ;
return baseContext ;
}
}
export class DescriptionFieldEditorModel implements DescriptionFieldPersist {
key? : string ;
value : string ;
protected formBuilder : UntypedFormBuilder = new UntypedFormBuilder ( ) ;
constructor (
public validationErrorModel : ValidationErrorModel = new ValidationErrorModel ( )
) { }
public fromModel ( item : DescriptionField ) : DescriptionFieldEditorModel {
if ( item ) {
this . key = item . key ;
this . value = item . value ;
}
return this ;
}
buildForm ( params ? : {
context? : ValidationContext ,
disabled? : boolean ,
rootPath? : string
} ) : UntypedFormGroup {
let { context = null , disabled = false , rootPath } = params ? ? { }
if ( context == null ) {
context = DescriptionFieldEditorModel . createValidationContext ( {
validationErrorModel : this.validationErrorModel ,
rootPath
} ) ;
}
return this . formBuilder . group ( {
key : [ { value : this.key , disabled : disabled } , context . getValidation ( 'key' ) . validators ] ,
value : [ { value : this.value , disabled : disabled } , context . getValidation ( 'value' ) . validators ]
} ) ;
}
static createValidationContext ( params : {
rootPath? : string ,
validationErrorModel : ValidationErrorModel
} ) : ValidationContext {
const { rootPath = '' , validationErrorModel } = params ;
const baseContext : ValidationContext = new ValidationContext ( ) ;
const baseValidationArray : Validation [ ] = new Array < Validation > ( ) ;
baseValidationArray . push ( { key : 'key' , validators : [ BackendErrorValidator ( validationErrorModel , ` ${ rootPath } key ` ) ] } ) ;
baseValidationArray . push ( { key : 'value' , validators : [ Validators . required , BackendErrorValidator ( validationErrorModel , ` ${ rootPath } value ` ) ] } ) ;
baseContext . validation = baseValidationArray ;
return baseContext ;
}
}
export class DescriptionReferenceEditorModel implements DescriptionReferencePersist {
id : Guid ;
reference? : ReferencePersist ;
hash : string ;
protected formBuilder : UntypedFormBuilder = new UntypedFormBuilder ( ) ;
constructor (
public validationErrorModel : ValidationErrorModel = new ValidationErrorModel ( )
) { }
fromModel ( item : DescriptionReference ) : DescriptionReferenceEditorModel {
this . id = item . id ;
this . reference = item . reference ;
this . hash = item . hash ;
return this ;
}
buildForm ( params ? : {
context? : ValidationContext ,
disabled? : boolean ,
rootPath? : string
} ) : UntypedFormGroup {
let { context = null , disabled = false , rootPath } = params ? ? { }
if ( context == null ) {
context = DescriptionReferenceEditorModel . createValidationContext ( {
validationErrorModel : this.validationErrorModel ,
rootPath
} ) ;
}
return this . formBuilder . group ( {
id : [ { value : this.id , disabled : disabled } , context . getValidation ( 'id' ) . validators ] ,
reference : [ { value : this.reference , disabled : disabled } , context . getValidation ( 'reference' ) . validators ] ,
hash : [ { value : this.hash , disabled : disabled } , context . getValidation ( 'hash' ) . validators ]
} ) ;
}
static createValidationContext ( params : {
rootPath? : string ,
validationErrorModel : ValidationErrorModel
} ) : ValidationContext {
const { rootPath = '' , validationErrorModel } = params ;
const baseContext : ValidationContext = new ValidationContext ( ) ;
const baseValidationArray : Validation [ ] = new Array < Validation > ( ) ;
baseValidationArray . push ( { key : 'id' , validators : [ BackendErrorValidator ( validationErrorModel , ` ${ rootPath } id ` ) ] } ) ;
baseValidationArray . push ( { key : 'reference' , validators : [ BackendErrorValidator ( validationErrorModel , ` ${ rootPath } reference ` ) ] } ) ;
baseValidationArray . push ( { key : 'hash' , validators : [ ] } ) ;
baseContext . validation = baseValidationArray ;
return baseContext ;
}
}
// export class DescriptionEditorModel {
// public id: string;
// public label: string;
// public profile: DescriptionProfileModel;
// public uri: String;
// public status: number;
// public description: String;
// public services: ExternalServiceEditorModel[] = [];
// public registries: ExternalRegistryEditorModel[] = [];
// public dataRepositories: ExternalDataRepositoryEditorModel[] = [];
// public tags: ExternalTagEditorModel[] = [];
// public externalDescriptions: ExternalDescriptionEditorModel[] = [];
// public dmp: DmpModel;
// public dmpSectionIndex: number;
// public descriptionProfileDefinition: DescriptionDescriptionFormEditorModel;
// public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
// public isProfileLatestVersion: Boolean;
// public modified: Date;
// fromModel(item: DescriptionModel): DescriptionEditorModel {
// this.id = item.id;
// this.label = item.label;
// this.profile = item.profile;
// this.uri = item.uri;
// this.status = item.status;
// this.description = item.description;
// if (item.services) { this.services = item.services.map(x => new ExternalServiceEditorModel().fromModel(x)); }
// if (item.registries) { this.registries = item.registries.map(x => new ExternalRegistryEditorModel().fromModel(x)); }
// if (item.dataRepositories) { this.dataRepositories = item.dataRepositories.map(x => new ExternalDataRepositoryEditorModel().fromModel(x)); }
// if (item.externalDescriptions) { this.externalDescriptions = item.externalDescriptions.map(x => new ExternalDescriptionEditorModel().fromModel(x)); }
// this.dmp = item.dmp;
// this.dmpSectionIndex = item.dmpSectionIndex;
// if (item.descriptionProfileDefinition) { this.descriptionProfileDefinition = new DescriptionDescriptionFormEditorModel().fromModel(item.descriptionProfileDefinition); }
// if (item.tags) { this.tags = item.tags.map(x => new ExternalTagEditorModel().fromModel(x)); }
// this.isProfileLatestVersion = item.isProfileLatestVersion;
// this.modified = new Date(item.modified);
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// if (context == null) { context = this.createValidationContext(); }
// const formBuilder = new UntypedFormBuilder();
// const formGroup = formBuilder.group({
// id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
// label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
// uri: [{ value: this.uri, disabled: disabled }, context.getValidation('uri').validators],
// status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators],
// description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
// dmp: [{ value: this.dmp, disabled: disabled }, context.getValidation('dmp').validators],
// dmpSectionIndex: [{ value: this.dmpSectionIndex, disabled: disabled }, context.getValidation('dmpSectionIndex').validators],
// //externalDescriptions: [{ value: this.externalDescriptions, disabled: disabled }, context.getValidation('externalDescriptions').validators],
// tags: [{ value: this.tags, disabled: disabled }, context.getValidation('tags').validators],
// //registries: [{ value: this.registries, disabled: disabled }, context.getValidation('registries').validators],
// //dataRepositories: [{ value: this.dataRepositories, disabled: disabled }, context.getValidation('dataRepositories').validators],
// //services: [{ value: this.services, disabled: disabled }, context.getValidation('services').validators],
// profile: [{ value: this.profile, disabled: disabled }, context.getValidation('profile').validators],
// modified: [{value: this.modified, disabled: disabled}, context.getValidation('modified').validators]
// });
// const externalDescriptionsFormArray = new Array<UntypedFormGroup>();
// //if (this.externalDescriptions && this.externalDescriptions.length > 0) {
// this.externalDescriptions.forEach(item => {
// externalDescriptionsFormArray.push(item.buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// });
// // } else {
// // //externalDescriptionsFormArray.push(new ExternalDescriptionModel().buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// // }
// formGroup.addControl('externalDescriptions', formBuilder.array(externalDescriptionsFormArray));
// // const tagsFormArray = new Array<FormGroup>();
// // if (this.tags && this.tags.length > 0) {
// // this.tags.forEach(item => {
// // tagsFormArray.push(item.buildForm(context.getValidation('tags').descendantValidations, disabled));
// // });
// // } else {
// // //externalDescriptionsFormArray.push(new ExternalDescriptionModel().buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// // }
// // formGroup.addControl('tags', formBuilder.array(tagsFormArray));
// const registriesFormArray = new Array<UntypedFormGroup>();
// //if (this.registries && this.registries.length > 0) {
// this.registries.forEach(item => {
// registriesFormArray.push(item.buildForm(context.getValidation('registries').descendantValidations, disabled));
// });
// // } else {
// // //externalDescriptionsFormArray.push(new ExternalDescriptionModel().buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// // }
// formGroup.addControl('registries', formBuilder.array(registriesFormArray));
// const dataRepositoriesFormArray = new Array<UntypedFormGroup>();
// //if (this.dataRepositories && this.dataRepositories.length > 0) {
// this.dataRepositories.forEach(item => {
// dataRepositoriesFormArray.push(item.buildForm(context.getValidation('dataRepositories').descendantValidations, disabled));
// });
// // } else {
// // //externalDescriptionsFormArray.push(new ExternalDescriptionModel().buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// // }
// formGroup.addControl('dataRepositories', formBuilder.array(dataRepositoriesFormArray));
// const servicesFormArray = new Array<UntypedFormGroup>();
// // if (this.services && this.services.length > 0) {
// this.services.forEach(item => {
// servicesFormArray.push(item.buildForm(context.getValidation('services').descendantValidations, disabled));
// });
// // } else {
// // //externalDescriptionsFormArray.push(new ExternalDescriptionModel().buildForm(context.getValidation('externalDescriptions').descendantValidations, disabled));
// // }
// formGroup.addControl('services', formBuilder.array(servicesFormArray));
// // const tagsFormArray = new Array<FormGroup>();
// // this.tags.forEach(item => {
// // tagsFormArray.push(item.buildForm(context.getValidation('tags').descendantValidations, disabled));
// // });
// // formGroup.addControl('tags', formBuilder.array(tagsFormArray));
// if (this.descriptionProfileDefinition) { formGroup.addControl('descriptionProfileDefinition', this.descriptionProfileDefinition.buildForm()); }
// // formGroup.addControl('profile', this.profile.buildForm());
// return formGroup;
// }
// createValidationContext(): ValidationContext {
// const baseContext: ValidationContext = new ValidationContext();
// baseContext.validation.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] });
// baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] });
// baseContext.validation.push({ key: 'profile', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'profile')] });
// baseContext.validation.push({ key: 'uri', validators: [BackendErrorValidator(this.validationErrorModel, 'uri')] });
// baseContext.validation.push({ key: 'status', validators: [BackendErrorValidator(this.validationErrorModel, 'status')] });
// baseContext.validation.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] });
// baseContext.validation.push({ key: 'services', validators: [BackendErrorValidator(this.validationErrorModel, 'services')] });
// baseContext.validation.push({ key: 'registries', validators: [BackendErrorValidator(this.validationErrorModel, 'registries')] });
// baseContext.validation.push({ key: 'dataRepositories', validators: [BackendErrorValidator(this.validationErrorModel, 'dataRepositories')] });
// baseContext.validation.push({ key: 'externalDescriptions', validators: [BackendErrorValidator(this.validationErrorModel, 'externalDescriptions')] });
// baseContext.validation.push({ key: 'dmp', validators: [BackendErrorValidator(this.validationErrorModel, 'dmp')] });
// baseContext.validation.push({ key: 'dmpSectionIndex', validators: [BackendErrorValidator(this.validationErrorModel, 'dmpSectionIndex')] });
// baseContext.validation.push({ key: 'descriptionProfileDefinition', validators: [BackendErrorValidator(this.validationErrorModel, 'descriptionProfileDefinition')] });
// baseContext.validation.push({ key: 'tags', validators: [BackendErrorValidator(this.validationErrorModel, 'descriptionProfileDefinition')] });
// baseContext.validation.push({ key: 'modified', validators: []});
// return baseContext;
// }
// }
// export class ExternalTagEditorModel {
// public abbreviation: String;
// public definition: String;
// public id: String;
// public name: String;
// public reference: String;
// public uri: String;
// constructor(id?: String, name?: String) {
// this.id = id;
// this.name = name;
// }
// fromModel(item: TagModel): ExternalTagEditorModel {
// this.id = item.id;
// this.name = item.name;
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// return new UntypedFormBuilder().group({
// id: [this.id],
// name: [this.name]
// });
// }
// }
// export class ExternalServiceEditorModel {
// public id: String;
// public abbreviation: String;
// public definition: String;
// public uri: String;
// public label: String;
// public reference: String;
// public source: String;
// constructor(abbreviation?: String, definition?: String, id?: String, label?: String, reference?: String, uri?: String, source?: String) {
// this.id = id;
// this.abbreviation = abbreviation;
// this.definition = definition;
// this.uri = uri;
// this.label = label;
// this.reference = reference;
// this.source = source;
// }
// fromModel(item: ServiceModel): ExternalServiceEditorModel {
// this.id = item.id;
// this.abbreviation = item.abbreviation;
// this.definition = item.definition;
// this.uri = item.uri;
// this.label = item.label;
// this.reference = item.reference;
// this.source = item.source;
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// return new UntypedFormBuilder().group({
// id: [this.id],
// abbreviation: [this.abbreviation],
// label: [this.label, Validators.required],
// reference: [this.reference],
// uri: [this.uri, Validators.required],
// definition: [this.definition],
// source: [this.source]
// });
// }
// }
// export class ExternalRegistryEditorModel {
// public abbreviation: String;
// public definition: String;
// public id: String;
// public label: String;
// public reference: String;
// public uri: String;
// public source: String
// constructor(abbreviation?: String, definition?: String, id?: String, label?: String, reference?: String, uri?: String, source?: String) {
// this.abbreviation = abbreviation;
// this.definition = definition;
// this.id = id;
// this.label = label;
// this.reference = reference;
// this.uri = uri;
// this.source = source;
// }
// fromModel(item: RegistryModel): ExternalRegistryEditorModel {
// this.abbreviation = item.abbreviation;
// this.definition = item.definition;
// this.id = item.id;
// this.label = item.label;
// this.reference = item.pid ? item.pid : item.reference;
// this.uri = item.uri;
// this.source = item.source
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// return new UntypedFormBuilder().group({
// id: [this.id],
// abbreviation: [this.abbreviation],
// label: [this.label, Validators.required],
// reference: [this.reference],
// uri: [this.uri, Validators.required],
// definition: [this.definition],
// source: [this.source]
// });
// }
// }
// export class ExternalDescriptionEditorModel {
// public abbreviation: String;
// public id: String;
// public name: String;
// public reference: String;
// public type: ExternalDescriptionType;
// public info: String;
// public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
// public source: String;
// constructor(id?: string, abbreviation?: string, name?: string, reference?: string, source?: String, info?: string, type?: ExternalDescriptionType) {
// this.id = id;
// this.name = name;
// this.abbreviation = abbreviation;
// this.reference = reference;
// this.info = info;
// this.type = type;
// this.source = source;
// }
// fromModel(item: ExternalDescriptionModel): ExternalDescriptionEditorModel {
// this.abbreviation = item.abbreviation;
// this.id = item.id;
// this.name = item.name;
// this.reference = item.reference;
// this.type = item.type;
// this.info = item.info;
// this.source = item.source;
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// return new UntypedFormBuilder().group({
// id: [this.id],
// abbreviation: [this.abbreviation],
// name: [this.name, Validators.required],
// reference: [this.reference],
// type: [this.type],
// info: [this.info],
// source: [this.source]
// });
// }
// }
// export class ExternalDataRepositoryEditorModel {
// public id: string;
// public name: string;
// public abbreviation: string;
// public uri: string;
// public reference: string;
// public info: string;
// public created: Date;
// public modified: Date;
// public source: string;
// constructor(id?: string, name?: string, abbreviation?: string, uri?: string, reference?: string, source?: string) {
// this.id = id;
// this.name = name;
// this.abbreviation = abbreviation;
// this.uri = uri;
// this.reference = reference;
// this.source = source;
// }
// fromModel(item: DataRepositoryModel): ExternalDataRepositoryEditorModel {
// this.id = item.id;
// this.name = item.name;
// this.abbreviation = item.abbreviation;
// this.uri = item.uri;
// this.info = item.info;
// this.reference = item.pid;
// this.source = item.source;
// return this;
// }
// buildForm(context: ValidationContext = null, disabled: boolean = false): UntypedFormGroup {
// return new UntypedFormBuilder().group({
// id: [this.id],
// name: [this.name, [Validators.required]],
// abbreviation: [this.abbreviation],
// uri: [this.uri, [Validators.required]],
// info: [this.info],
// reference: [this.reference],
// source: [this.source]
// });
// }
// }
// // export class TagModel implements Serializable<TagModel> {
// // public id: string;
// // public name: string;
// // constructor(id?: string, name?: string) {
// // this.id = id;
// // this.name = name;
// // }
// // fromJSONObject(item: any): TagModel {
// // this.id = item.id;
// // this.name = item.name;
// // return this;
// // }
// // buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
// // return new FormBuilder().group({
// // id: [this.id],
// // name: [this.name]
// // });
// // }
// // }