argos/dmp-admin/src/app/models/DataSetProfile/Rule.ts

34 lines
1.1 KiB
TypeScript
Raw Normal View History

import { BaseModel } from '../BaseModel';
2017-11-27 14:35:00 +01:00
import { FormGroup } from '@angular/forms';
import { FormGenerator } from '../interfaces/FormGenerator';
import { Serializable } from '../interfaces/Serializable';
2017-11-27 14:35:00 +01:00
export class Rule extends BaseModel implements Serializable<Rule>,FormGenerator<FormGroup>{
public sourceField:string;
2017-12-01 15:00:37 +01:00
public target:string;
public value: string;
public ruleType: string;
public ruleStyle: string;
public valueType: string;
2017-11-27 14:35:00 +01:00
fromJSONObject(item:any):Rule{
this.sourceField = item.sourceField;
2017-12-01 15:00:37 +01:00
this.target = item.target;
this.value = item.value;
this.ruleType = item.ruleType;
this.ruleStyle = item.ruleStyle;
this.valueType = item.valueType;
2017-11-27 14:35:00 +01:00
return this;
}
buildForm():FormGroup{
let formGroup = this.formBuilder.group({
sourceField: [this.sourceField],
2017-12-01 15:00:37 +01:00
target: [this.target],
ruleStyle: [this.ruleStyle],
value: [this.value],
ruleType: [this.ruleType],
valueType: [this.valueType]
2017-11-27 14:35:00 +01:00
});
return formGroup;
}
}