2017-12-19 17:26:29 +01:00
|
|
|
import { Serializable } from "../Serializable";
|
2018-05-28 11:50:42 +02:00
|
|
|
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-09-04 11:36:18 +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-09-04 11:36:18 +02:00
|
|
|
constructor(id?: string, label?: string, abbreviation?: string, uri?: string, reference?: string
|
2018-05-28 11:50:42 +02:00
|
|
|
) {
|
|
|
|
this.id = id;
|
2018-09-04 11:36:18 +02:00
|
|
|
this.label = label;
|
|
|
|
this.abbreviation = abbreviation;
|
2018-05-28 11:50:42 +02:00
|
|
|
this.uri = uri;
|
2018-09-04 11:36:18 +02:00
|
|
|
this.reference = reference;
|
2018-05-28 11:50:42 +02:00
|
|
|
}
|
|
|
|
fromJSONObject(item: any): DataRepositoryModel {
|
|
|
|
this.id = item.id;
|
2018-09-04 11:36:18 +02:00
|
|
|
this.label = item.label;
|
|
|
|
this.abbreviation = item.abbreviation;
|
2018-05-28 11:50:42 +02:00
|
|
|
this.uri = item.uri;
|
|
|
|
this.info = item.info;
|
2018-09-04 11:36:18 +02:00
|
|
|
this.reference = item.pid;
|
2018-05-28 11:50:42 +02:00
|
|
|
return this;
|
|
|
|
}
|
2017-12-19 17:26:29 +01:00
|
|
|
|
2018-05-28 11:50:42 +02:00
|
|
|
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
|
|
|
return new FormBuilder().group({
|
|
|
|
id: [this.id],
|
2018-09-04 11:36:18 +02:00
|
|
|
label: [this.label],
|
|
|
|
abbreviation: [this.abbreviation],
|
2018-05-28 11:50:42 +02:00
|
|
|
uri: [this.uri],
|
2018-09-04 11:36:18 +02:00
|
|
|
info: [this.info],
|
|
|
|
reference: [this.reference]
|
2018-05-28 11:50:42 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|