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
|
GoalDefinition |
check(Identifier id,
PredicateDefinition goalPredicate) |
<T> Expression<T> |
constant(T constantValue) |
EqualDefinition<Expression,Expression<Object>> |
eq(Expression actual,
Object expected) |
EventDefinition |
event(Identifier id) |
StartTimerDefinition |
every(int interval,
TimeUnit intervalUnit)
creates a start timer with given interval and unit
|
<T> Expression |
expression(T expression) |
GoalDefinition |
goal(Identifier id)
create a goal definition with the given id.
|
Identifier |
id(Enum id) |
Identifier |
id(String id) |
TrueDefinition<Expression> |
isTrue(Expression actual) |
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(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.
|
InvokeDefinition |
method(Class<?> clazz) |
CallDefinition |
method(Object returnValueOfProxyInvocation) |
FlowPathDefinition |
on(Identifier id)
create a flow path for execution after of the given event id
|
<T extends Predicate> |
predicate(T predicate) |
Property |
property(Identifier id) |
<T> T |
property(Identifier id,
Class<T> clazz) |
PredicateBuilder<CallDefinition> |
resultOf(CallDefinition methodCall) |
<T> T |
service(Class<T> clazz)
create a service proxy to be user 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) |
protected AbstractEventDefinition |
startTimerEvent(AbstractEventDefinition event,
StartTimerDefinition startTimerDefinition) |
TaskDefinition |
task(Identifier id) |
TaskDefinition |
task(Identifier id,
Task callee)
create a task definition with the given task to be executed
Example:
|
<T> T |
val(Expression<T> expression)
add a parameter to the invocation arguments of a proxy method call definition.
|
FlowBuilderSupport |
withDefinition(FlowDefinition definition) |
protected FlowDefinition definition
protected ServiceCallInvocationSupport serviceCallInvocation
public FlowBuilderSupport withDefinition(FlowDefinition definition)
public Identifier id(Enum id)
public Identifier id(String id)
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 startTimerEvent(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 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 TaskDefinition task(Identifier id)
public 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 EventDefinition event(Identifier id)
public <T> Expression expression(T expression)
public <T> Expression<T> constant(T constantValue)
public Property property(Identifier id)
public <T> T property(Identifier id, Class<T> clazz)
public <T> T val(Expression<T> expression)
T - the type of the expressionexpression - the parameter expression to addpublic EqualDefinition<Expression,Expression<Object>> eq(Expression actual, Object expected)
public TrueDefinition<Expression> isTrue(Expression actual)
public <T extends Predicate> PredicateDefinition<T> predicate(T predicate)
public 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 PredicateBuilder<CallDefinition> resultOf(CallDefinition methodCall)
public 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 GoalDefinition check(Identifier id, PredicateDefinition goalPredicate)
Copyright © 2014. All rights reserved.