src.app.core.model.component-task.model.ts Maven / Gradle / Ivy
import { Clonable, cloneAsPossible } from 'src/app/shared/clonable';
import { Strategy } from '@core/model/scenario';
import { areEquals } from '@shared';
export class ComponentTask implements Clonable {
constructor(
public name: string,
public implementation: Implementation,
public children: Array,
public parameters: Array = [],
public computedParameters: Array = [],
public tags: Array = [],
public strategy: Strategy,
public id?: string,
) {
}
public clone(): ComponentTask {
return new ComponentTask(
cloneAsPossible(this.name),
cloneAsPossible(this.implementation),
cloneAsPossible(this.children),
cloneAsPossible(this.parameters),
cloneAsPossible(this.computedParameters),
cloneAsPossible(this.tags),
cloneAsPossible(this.strategy),
cloneAsPossible(this.id));
}
}
export class Implementation implements Clonable {
static deserialize(jsonObject: any): Implementation {
if (jsonObject && jsonObject.identifier != null) {
return new Implementation(
jsonObject.identifier,
jsonObject.target,
jsonObject.hasTarget,
jsonObject.mapInputs ? jsonObject.mapInputs : [],
jsonObject.listInputs ? jsonObject.listInputs : [],
jsonObject.inputs ? jsonObject.inputs : [],
jsonObject.outputs ? jsonObject.outputs : [],
jsonObject.validations ? jsonObject.validations : [],
);
}
return null;
}
constructor(
public identifier: string,
public target: string,
public hasTarget: boolean,
public mapInputs: Array = [],
public listInputs: Array = [],
public inputs: Array = [],
public outputs: Array,
public validations: Array
) {
}
public clone(): Implementation {
return new Implementation(
cloneAsPossible(this.identifier),
cloneAsPossible(this.target),
cloneAsPossible(this.hasTarget),
cloneAsPossible(this.mapInputs),
cloneAsPossible(this.listInputs),
cloneAsPossible(this.inputs),
cloneAsPossible(this.outputs),
cloneAsPossible(this.validations)
);
}
}
export class KeyValue implements Clonable {
constructor(
public key: string,
public value: any
) {
}
public clone(): KeyValue {
return new KeyValue(
cloneAsPossible(this.key),
cloneAsPossible(this.value)
);
}
public equals(obj: KeyValue): boolean {
return obj
&& areEquals(this.key, obj.key)
&& areEquals(this.value, obj.value);
}
}
export class SimpleInput implements Clonable {
constructor(
public name: string,
public value: string,
public type?
) {
}
public clone(): SimpleInput {
return new SimpleInput(
cloneAsPossible(this.name),
cloneAsPossible(this.value),
cloneAsPossible(this.type)
);
}
}
export class ListInput implements Clonable {
constructor(
public name: string,
public values: Array
© 2015 - 2025 Weber Informatics LLC | Privacy Policy