Search in sources :

Example 1 with TagInstance

use of io.automatiko.engine.workflow.base.instance.TagInstance in project automatiko-engine by automatiko-io.

the class WorkflowProcessInstanceImpl method evaluateTags.

public Collection<Tag> evaluateTags() {
    if (this.tags == null) {
        this.tags = new LinkedHashSet<Tag>();
    }
    Collection<Tag> evaluatedTags = new LinkedHashSet<Tag>();
    Collection<TagDefinition> tagDefinitions = ((Process) getProcess()).getTagDefinitions();
    for (TagDefinition def : tagDefinitions) {
        String tag = def.get(this, getVariables());
        if (tag != null) {
            Tag tagInstance = new TagInstance(def.getId(), tag);
            evaluatedTags.add(tagInstance);
            this.tags.remove(tagInstance);
        }
    }
    // append all remaining tasks that didn't have definition - added manually on the instance
    evaluatedTags.addAll(this.tags);
    // replace existing ones
    this.tags = evaluatedTags;
    return evaluatedTags;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) TagDefinition(io.automatiko.engine.workflow.base.core.TagDefinition) TagInstance(io.automatiko.engine.workflow.base.instance.TagInstance) WorkflowProcess(io.automatiko.engine.api.definition.process.WorkflowProcess) Process(io.automatiko.engine.workflow.base.core.Process) Tag(io.automatiko.engine.api.workflow.Tag)

Aggregations

WorkflowProcess (io.automatiko.engine.api.definition.process.WorkflowProcess)1 Tag (io.automatiko.engine.api.workflow.Tag)1 Process (io.automatiko.engine.workflow.base.core.Process)1 TagDefinition (io.automatiko.engine.workflow.base.core.TagDefinition)1 TagInstance (io.automatiko.engine.workflow.base.instance.TagInstance)1 LinkedHashSet (java.util.LinkedHashSet)1