use of io.automatiko.engine.api.workflow.Tags in project automatiko-engine by automatiko-io.
the class AbstractProcessInstance method buildTags.
protected Tags buildTags() {
return new Tags() {
Collection<String> values = ((WorkflowProcessInstanceImpl) processInstance()).getTags().stream().map(t -> t.getValue()).collect(Collectors.toList());
@Override
public Collection<String> values() {
return values;
}
@Override
public boolean remove(String id) {
WorkflowProcessInstanceImpl pi = (WorkflowProcessInstanceImpl) processInstance();
boolean removed = pi.removedTag(id);
removeOnFinish();
return removed;
}
@Override
public Tag get(String id) {
WorkflowProcessInstanceImpl pi = (WorkflowProcessInstanceImpl) processInstance();
return pi.getTags().stream().filter(t -> t.getId().equals(id)).findFirst().orElse(null);
}
@Override
public void add(String value) {
WorkflowProcessInstanceImpl pi = (WorkflowProcessInstanceImpl) processInstance();
pi.addTag(value);
removeOnFinish();
}
@Override
public Collection<Tag> get() {
WorkflowProcessInstanceImpl pi = (WorkflowProcessInstanceImpl) processInstance();
return pi.getTags();
}
};
}
Aggregations