43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { Serializable } from "../Serializable";
|
|
import { ValidationContext } from "../../utilities/validators/ValidationContext";
|
|
import { FormBuilder, FormGroup } from "@angular/forms";
|
|
|
|
export class ServiceModel implements Serializable<ServiceModel> {
|
|
public id: String;
|
|
public abbreviation: String;
|
|
public definition: String;
|
|
public uri: String;
|
|
public label: String;
|
|
public reference: String;
|
|
|
|
constructor(id?: String, abbreviation?: String, definition?: String, uri?: String, label?: String, reference?: String) {
|
|
this.id = id;
|
|
this.abbreviation = abbreviation;
|
|
this.definition = definition;
|
|
this.uri = uri;
|
|
this.label = label;
|
|
this.reference = reference;
|
|
}
|
|
fromJSONObject(item: any): ServiceModel {
|
|
this.id = item.id;
|
|
this.abbreviation = item.abbreviation;
|
|
this.definition = item.definition;
|
|
this.uri = item.uri;
|
|
this.label = item.label;
|
|
this.reference = item.reference;
|
|
|
|
return this;
|
|
}
|
|
|
|
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
|
return new FormBuilder().group({
|
|
id: [this.id],
|
|
abbreviation: [this.abbreviation],
|
|
label: [this.label],
|
|
reference: [this.reference],
|
|
uri: [this.uri],
|
|
definition: [this.definition]
|
|
})
|
|
}
|
|
}
|