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

34 lines
1.1 KiB
TypeScript

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