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

44 lines
1.2 KiB
TypeScript

import { Serializable } from "../Serializable";
import { ValidationContext } from "../../utilities/validators/ValidationContext";
import { FormBuilder, FormGroup } from "@angular/forms";
export class DataRepositoryModel implements Serializable<DataRepositoryModel> {
public id: string;
public label: string;
public abbreviation: string;
public uri: string;
public reference: string;
public info: string;
public created: Date;
public modified: Date;
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;
}
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]
})
}
}