Search in sources :

Example 1 with ConstraintImpl

use of io.automatiko.engine.workflow.process.core.impl.ConstraintImpl in project automatiko-engine by automatiko-io.

the class ServerlessWorkflowFactory method splitConstraint.

public ConstraintImpl splitConstraint(String name, String type, String dialect, String constraint, int priority, boolean isDefault) {
    ConstraintImpl constraintImpl = new ConstraintImpl();
    constraintImpl.setName(name);
    constraintImpl.setType(type);
    constraintImpl.setDialect(dialect);
    constraintImpl.setConstraint(constraint);
    constraintImpl.setPriority(priority);
    constraintImpl.setDefault(isDefault);
    return constraintImpl;
}
Also used : ConstraintImpl(io.automatiko.engine.workflow.process.core.impl.ConstraintImpl)

Example 2 with ConstraintImpl

use of io.automatiko.engine.workflow.process.core.impl.ConstraintImpl in project automatiko-engine by automatiko-io.

the class StateNodeFactory method constraint.

public StateNodeFactory constraint(String connectionId, long nodeId, String type, String dialect, String constraint, int priority) {
    ConstraintImpl constraintImpl = new ConstraintImpl();
    constraintImpl.setName(connectionId);
    constraintImpl.setType(type);
    constraintImpl.setDialect(dialect);
    constraintImpl.setConstraint(constraint);
    constraintImpl.setPriority(priority);
    getStateNode().addConstraint(new ConnectionRef(connectionId, nodeId, CONNECTION_DEFAULT_TYPE), constraintImpl);
    return this;
}
Also used : ConstraintImpl(io.automatiko.engine.workflow.process.core.impl.ConstraintImpl) ConnectionRef(io.automatiko.engine.workflow.process.core.impl.ConnectionRef)

Example 3 with ConstraintImpl

use of io.automatiko.engine.workflow.process.core.impl.ConstraintImpl in project automatiko-engine by automatiko-io.

the class ConstraintHandler method end.

public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    Constrainable parent = (Constrainable) parser.getParent();
    Constraint constraint = new ConstraintImpl();
    final String toNodeIdString = element.getAttribute("toNodeId");
    String toType = element.getAttribute("toType");
    ConnectionRef connectionRef = null;
    if (toNodeIdString != null && toNodeIdString.trim().length() > 0) {
        int toNodeId = new Integer(toNodeIdString);
        if (toType == null || toType.trim().length() == 0) {
            toType = NodeImpl.CONNECTION_DEFAULT_TYPE;
        }
        connectionRef = new ConnectionRef(toNodeId, toType);
    }
    final String name = element.getAttribute("name");
    constraint.setName(name);
    final String priority = element.getAttribute("priority");
    if (priority != null && priority.length() != 0) {
        constraint.setPriority(new Integer(priority));
    }
    final String type = element.getAttribute("type");
    constraint.setType(type);
    final String dialect = element.getAttribute("dialect");
    constraint.setDialect(dialect);
    String text = ((Text) element.getChildNodes().item(0)).getWholeText();
    if (text != null) {
        text = text.trim();
        if ("".equals(text)) {
            text = null;
        }
    }
    constraint.setConstraint(text);
    parent.addConstraint(connectionRef, constraint);
    return null;
}
Also used : Constrainable(io.automatiko.engine.workflow.process.core.node.Constrainable) Constraint(io.automatiko.engine.workflow.process.core.Constraint) ConstraintImpl(io.automatiko.engine.workflow.process.core.impl.ConstraintImpl) Element(org.w3c.dom.Element) Text(org.w3c.dom.Text) ConnectionRef(io.automatiko.engine.workflow.process.core.impl.ConnectionRef) Constraint(io.automatiko.engine.workflow.process.core.Constraint)

Example 4 with ConstraintImpl

use of io.automatiko.engine.workflow.process.core.impl.ConstraintImpl in project automatiko-engine by automatiko-io.

the class ProcessHandler method buildConstraint.

private static Constraint buildConstraint(SequenceFlow connection, NodeImpl node) {
    if (connection.getExpression() == null) {
        return null;
    }
    Constraint constraint = new ConstraintImpl();
    String defaultConnection = (String) node.getMetaData("Default");
    if (defaultConnection != null && defaultConnection.equals(connection.getId())) {
        constraint.setDefault(true);
    }
    if (connection.getName() != null) {
        constraint.setName(connection.getName());
    } else {
        constraint.setName("");
    }
    if (connection.getType() != null) {
        constraint.setType(connection.getType());
    } else {
        constraint.setType("code");
    }
    if (connection.getLanguage() != null) {
        constraint.setDialect(connection.getLanguage());
    }
    if (connection.getExpression() != null) {
        constraint.setConstraint(connection.getExpression());
    }
    constraint.setPriority(connection.getPriority());
    return constraint;
}
Also used : Constraint(io.automatiko.engine.workflow.process.core.Constraint) ConstraintImpl(io.automatiko.engine.workflow.process.core.impl.ConstraintImpl)

Aggregations

ConstraintImpl (io.automatiko.engine.workflow.process.core.impl.ConstraintImpl)4 Constraint (io.automatiko.engine.workflow.process.core.Constraint)2 ConnectionRef (io.automatiko.engine.workflow.process.core.impl.ConnectionRef)2 Constrainable (io.automatiko.engine.workflow.process.core.node.Constrainable)1 Element (org.w3c.dom.Element)1 Text (org.w3c.dom.Text)1