All Downloads are FREE. Search and download functionalities are using the official Maven repository.

brainslug.flow.execution.instance.InstanceSelector Maven / Gradle / Ivy

The newest version!
package brainslug.flow.execution.instance;

import brainslug.flow.definition.Identifier;
import brainslug.flow.expression.EqualsExpression;
import brainslug.flow.expression.Property;
import brainslug.flow.expression.Value;
import brainslug.util.Option;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class InstanceSelector implements FlowInstanceSelector {
    Identifier instanceId;
    Identifier definitionId;
    List, Value>> properties = new ArrayList, Value>>();

    @Override
    public Option instanceId() {
        return Option.of(instanceId);
    }

    @Override
    public Option definitionId() {
        return Option.of(definitionId);
    }

    @Override
    public Collection, Value>> properties() {
      return properties;
    }

    public InstanceSelector withInstanceId(Identifier instanceId) {
        this.instanceId = instanceId;
        return this;
    }

    public InstanceSelector withDefinitionId(Identifier definitionId) {
        this.definitionId = definitionId;
        return this;
    }

    public InstanceSelector withProperty(Property property, Value value) {
        properties.add(new EqualsExpression, Value>(property, value));
        return this;
    }

    public InstanceSelector withProperty(Identifier id, String value) {
        properties.add(new EqualsExpression, Value>(new Property(id, String.class), new Value(value)));
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy