argos/dmp-frontend/src/app/models/dataRepositories/DataRepositoryModel.ts

44 lines
1.2 KiB
TypeScript
Raw Normal View History

2018-10-05 17:00:54 +02:00
import { Serializable } from '../Serializable';
import { ValidationContext } from '../../utilities/validators/ValidationContext';
import { FormBuilder, FormGroup } from '@angular/forms';
2017-12-19 17:26:29 +01:00
export class DataRepositoryModel implements Serializable<DataRepositoryModel> {
2018-10-05 17:00:54 +02:00
public id: string;
public label: string;
public abbreviation: string;
public uri: string;
public reference: string;
public info: string;
public created: Date;
public modified: Date;
2017-12-19 17:26:29 +01:00
2018-10-05 17:00:54 +02:00
constructor(id?: string, label?: string, abbreviation?: string, uri?: string, reference?: string
) {
this.id = id;
this.label = label;
this.abbreviation = abbreviation;
this.uri = uri;
this.reference = reference;
}
fromJSONObject(item: any): DataRepositoryModel {
this.id = item.id;
this.label = item.label;
this.abbreviation = item.abbreviation;
this.uri = item.uri;
this.info = item.info;
this.reference = item.pid;
return this;
}
2017-12-19 17:26:29 +01:00
2018-10-05 17:00:54 +02:00
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
return new FormBuilder().group({
id: [this.id],
label: [this.label],
abbreviation: [this.abbreviation],
uri: [this.uri],
info: [this.info],
reference: [this.reference]
});
}
2018-05-28 11:50:42 +02:00
}