2018-01-17 13:03:51 +01:00
|
|
|
import { BaseErrorModel } from '../error/BaseErrorModel';
|
2018-01-17 11:11:58 +01:00
|
|
|
import { Serializable } from "../Serializable";
|
2018-01-17 13:03:51 +01:00
|
|
|
import { FormGenerator } from "../interfaces/FormGenerator";
|
|
|
|
import { FormGroup, FormBuilder } from "@angular/forms";
|
2018-05-28 11:50:42 +02:00
|
|
|
import { ValidationContext } from '../../utilities/validators/ValidationContext';
|
2018-01-17 13:03:51 +01:00
|
|
|
|
2018-05-28 11:50:42 +02:00
|
|
|
export enum ExternalDatasetType {
|
|
|
|
Source = 0,
|
|
|
|
Output = 1
|
|
|
|
}
|
2018-01-17 11:11:58 +01:00
|
|
|
|
2018-05-28 11:50:42 +02:00
|
|
|
export class ExternalDatasetModel implements Serializable<ExternalDatasetModel>, FormGenerator<FormGroup>{
|
2018-01-17 11:11:58 +01:00
|
|
|
|
2018-05-28 11:50:42 +02:00
|
|
|
public abbreviation: String;
|
|
|
|
public id: String;
|
|
|
|
public label: String;
|
|
|
|
public reference: String;
|
|
|
|
public errorModel: BaseErrorModel;
|
|
|
|
public type: ExternalDatasetType;
|
|
|
|
public info: String;
|
|
|
|
constructor(id?: string, abbreviation?: string, label?: string, reference?: string, info?: string, type?: ExternalDatasetType) {
|
|
|
|
this.id = id;
|
|
|
|
this.label = label;
|
|
|
|
this.abbreviation = abbreviation;
|
|
|
|
this.reference = reference;
|
|
|
|
this.info = info;
|
|
|
|
this.type = type;
|
|
|
|
}
|
|
|
|
fromJSONObject(item: any): ExternalDatasetModel {
|
|
|
|
this.abbreviation = item.abbreviation;
|
|
|
|
this.id = item.id;
|
|
|
|
this.label = item.label;
|
|
|
|
this.reference = item.reference;
|
|
|
|
this.type = item.type;
|
|
|
|
this.info = item.info
|
|
|
|
return this;
|
|
|
|
}
|
2018-01-17 13:03:51 +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],
|
|
|
|
abbreviation: [this.abbreviation],
|
|
|
|
label: [this.label],
|
|
|
|
reference: [this.reference],
|
|
|
|
type: [this.type],
|
|
|
|
info: [this.info]
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|