export interface ActionOptions { description: string; actionType: string; actionParam: string; objectXpath: string; objectParams: string[]; frameIndex: number; } export interface ComponentOptions { id: string; createtimestamp: number; updatetimestamp: number; description: string; actions: ActionOptions[]; } export class ActionOptionsClass implements ActionOptions { description: string; actionType: string; actionParam: string; objectXpath: string; objectParams: string[]; frameIndex: number; constructor(actions?: any) { if (actions) { this.description = actions.description || ''; this.actionType = actions.actionType || ''; this.actionParam = actions.actionParam || ''; this.objectXpath = actions.objectXpath || ''; this.frameIndex = actions.frameIndex || 0; this.objectParams = []; if (actions.ObjectParam) { actions.ObjectParam.forEach((param: string) => { this.objectParams.push(param); }); } } else { this.description = ''; this.actionType = ''; this.actionParam = ''; this.objectXpath = ''; this.frameIndex = 0; this.objectParams = []; } } } export class ComponentOptionsClass implements ComponentOptions { id: string; createtimestamp: number; updatetimestamp: number; description: string; actions: ActionOptions[]; constructor(component?: any) { if (component) { this.id = component.id; this.createtimestamp = component.createtimestamp; this.updatetimestamp = component.updatetimestamp || 0; this.description = component.description; this.actions = []; if (component.actions) { component.actions.forEach((action: any) => { this.actions.push(new ActionOptionsClass(action)); }); } } else { this.id = ''; this.createtimestamp = (new Date()).getTime(); this.updatetimestamp = this.createtimestamp; this.description = ''; this.actions = []; } } }