public class FlowBuilderSupport extends Object
| Modifier and Type | Field and Description |
|---|---|
protected FlowDefinition |
definition |
protected ServiceCallInvocationSupport |
serviceCallInvocation |
| Constructor and Description |
|---|
FlowBuilderSupport() |
| Modifier and Type | Method and Description |
|---|---|
FlowPathDefinition |
after(Identifier id)
create a flow path for execution after of the node id
|
static GoalDefinition |
check(Predicate<?> goalPredicate) |
static GoalDefinition |
check(PredicateExpression goalPredicate) |
static <T> Value<T> |
constant(T value) |
static EqualsExpression<Expression,Value<Object>> |
eq(Expression actual,
Object expected) |
static EventDefinition |
event(Identifier id) |
StartTimerDefinition |
every(int interval,
TimeUnit intervalUnit)
creates a start timer with given interval and unit
|
static StringExpression |
expression(String expression) |
protected static String |
generateId() |
static GoalDefinition |
goal() |
static GoalDefinition |
goal(Identifier id)
create a goal definition with the given id.
|
static Identifier |
id() |
static Identifier |
id(Enum id) |
static Identifier |
id(String id) |
static EqualsExpression<Expression,Value<Boolean>> |
isTrue(Expression actual) |
FlowPathDefinition |
join(FlowNodeDefinition<?>... flowNodeDefinitions) |
FlowPathDefinition |
join(Identifier joinId,
FlowNodeDefinition<?>... flowNodeDefinitions) |
FlowPathDefinition |
join(Identifier joinId,
Identifier... ids)
create a flow path joining the execution after the given nodes
by introducing a new merge join to which the nodes connect.
|
FlowPathDefinition |
merge(FlowNodeDefinition<?>... nodeDefinitions) |
FlowPathDefinition |
merge(Identifier id,
FlowNodeDefinition<?>... nodeDefinitions) |
FlowPathDefinition |
merge(Identifier mergeId,
Identifier... ids)
create a flow path merging the execution after the given nodes
by introducing a new merge node to which the nodes connect.
|
static InvokeDefinition |
method(Class<?> clazz) |
CallDefinition |
method(Object returnValueOfProxyInvocation) |
FlowPathDefinition |
on(Identifier id)
create a flow path for execution after of the given event id
|
static <T extends Predicate> |
predicate(T predicate) |
static Property<?> |
property(Identifier id) |
static <T> Property<T> |
property(Identifier id,
Class<T> clazz) |
static ExpressionBuilder<Value<CallDefinition>> |
resultOf(CallDefinition methodCall) |
<T> T |
service(Class<T> clazz)
create a service proxy to be used for type-safe call definitions.
|
FlowPathDefinition |
start(AbstractEventDefinition event) |
FlowPathDefinition |
start(AbstractEventDefinition event,
StartTimerDefinition startTimerDefinition)
create a start event with the given event,
which will be started every interval with
the duration given in the timer definition.
|
FlowPathDefinition |
start(AbstractTaskDefinition task)
define task as first node in the flow
|
FlowPathDefinition |
start(Identifier startId)
create a start event with the given id.
|
FlowPathDefinition |
start(Identifier id,
AbstractTaskDefinition task,
StartTimerDefinition startTimerDefinition) |
FlowPathDefinition |
start(Identifier startId,
StartTimerDefinition startTimerDefinition)
create a start event with the given id,
which will be started every interval with
the duration given in the timer definition.
|
protected AbstractEventDefinition<?> |
startEvent(AbstractEventDefinition<?> event) |
static TaskDefinition |
task(Identifier id) |
static TaskDefinition |
task(Identifier id,
Task callee)
create a task definition with the given task to be executed
Example:
|
protected AbstractEventDefinition |
timerEvent(AbstractEventDefinition event,
StartTimerDefinition startTimerDefinition) |
<T> T |
value(Identifier id,
Class<T> clazz) |
<T> T |
value(Property<T> property) |
<T> T |
value(Property property,
Class<T> clazz) |
<T> T |
value(Value<T> value)
add a parameter to the invocation arguments of a proxy method call definition.
|
protected FlowDefinition definition
protected ServiceCallInvocationSupport serviceCallInvocation
public static Identifier id(Enum id)
public static Identifier id(String id)
public static Identifier id()
protected static String generateId()
public StartTimerDefinition every(int interval, TimeUnit intervalUnit)
interval - the intervalintervalUnit - the unitpublic FlowPathDefinition start(Identifier startId)
startId - the start event idpublic FlowPathDefinition start(Identifier startId, StartTimerDefinition startTimerDefinition)
startId - the start event idstartTimerDefinition - the timer definition defining the intervalpublic FlowPathDefinition start(AbstractEventDefinition event)
public FlowPathDefinition start(AbstractEventDefinition event, StartTimerDefinition startTimerDefinition)
event - the start event idstartTimerDefinition - the timer definition defining the intervalprotected AbstractEventDefinition<?> startEvent(AbstractEventDefinition<?> event)
protected AbstractEventDefinition timerEvent(AbstractEventDefinition event, StartTimerDefinition startTimerDefinition)
public FlowPathDefinition start(AbstractTaskDefinition task)
task - the taskpublic FlowPathDefinition start(Identifier id, AbstractTaskDefinition task, StartTimerDefinition startTimerDefinition)
public FlowPathDefinition after(Identifier id)
id - of the node to continue afterpublic FlowPathDefinition on(Identifier id)
id - of the event to continue afterpublic FlowPathDefinition merge(Identifier mergeId, Identifier... ids)
{@literal @}Override public void define() {
start(event(id(START)))
.choice(id(CHOICE))
.when(eq(constant(x) ,"test")).execute(task(id(TASK)))
.or()
.when(eq(constant(x), "test2")).execute(task(id(TASK2)));
merge(id(MERGE), id(TASK), id(TASK2))
.end(event(id(END)));
}
mergeId - the id of the new merge nodeids - of the nodes to be mergedpublic FlowPathDefinition merge(FlowNodeDefinition<?>... nodeDefinitions)
public FlowPathDefinition merge(Identifier id, FlowNodeDefinition<?>... nodeDefinitions)
public FlowPathDefinition join(Identifier joinId, Identifier... ids)
{@literal @}Override public void define() {
start(event(id(StartEvent)))
.parallel(id(Parallel))
.execute(task(id(SecondTask)))
.and()
.execute(task(id(ThirdTask)));
join(id(Join), id(SecondTask), id(ThirdTask))
.end(event(id(EndEvent2)));
}
joinId - the id of the new join nodeids - of the nodes to be mergedpublic FlowPathDefinition join(FlowNodeDefinition<?>... flowNodeDefinitions)
public FlowPathDefinition join(Identifier joinId, FlowNodeDefinition<?>... flowNodeDefinitions)
public static TaskDefinition task(Identifier id)
public static TaskDefinition task(Identifier id, Task callee)
{@literal @}Override
public void define() {
Task callee = new Task() {
{@literal @}Override
public void execute(ExecutionContext o) {
}
};
start(event(id("start")), every(5, TimeUnit.SECONDS))
.execute(task(id("task"), callee));
}
id - the task idcallee - the callee taskpublic static EventDefinition event(Identifier id)
public static StringExpression expression(String expression)
public static <T> Value<T> constant(T value)
public static Property<?> property(Identifier id)
public static <T> Property<T> property(Identifier id, Class<T> clazz)
public <T> T value(Identifier id, Class<T> clazz)
public <T> T value(Property<T> property)
public <T> T value(Value<T> value)
T - the type of the valuevalue - the parameter value to addpublic static EqualsExpression<Expression,Value<Object>> eq(Expression actual, Object expected)
public static EqualsExpression<Expression,Value<Boolean>> isTrue(Expression actual)
public static <T extends Predicate> PredicateExpression<T> predicate(T predicate)
public static InvokeDefinition method(Class<?> clazz)
public CallDefinition method(Object returnValueOfProxyInvocation)
public <T> T service(Class<T> clazz)
{@literal @}Override
public void define() {
TestService testService = service(TestService.class);
start(event(id(START)))
.execute(task(id(TASK)).call(method(testService.echo(testService.getString()))))
.end(event(id(END)));
}
T - the type of the interfaceclazz - the interface type to proxypublic static ExpressionBuilder<Value<CallDefinition>> resultOf(CallDefinition methodCall)
public static GoalDefinition goal(Identifier id)
{@literal @}Override
public void define() {
start(id("start"))
.execute(task(id("simpleTask"))
.retryAsync(true)
.goal(id("taskExecuted")))
.end(id("end"));
goal(id("taskExecuted")).check(predicate(new GoalPredicate<Void>() {
{@literal @}Override
public boolean isFulfilled(Void aVoid) {
return true;
}
}));
}
id - the goal idpublic static GoalDefinition goal()
public static GoalDefinition check(PredicateExpression goalPredicate)
public static GoalDefinition check(Predicate<?> goalPredicate)
Copyright © 2015. All rights reserved.