Skip to content

Files

Latest commit

596d76f · Jun 23, 2019

History

History

sample06

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Dec 25, 2018
Jan 27, 2019
Feb 2, 2019
Dec 25, 2018
Jun 23, 2019

If sample

Illustrates how to implement an If decision within your workflow.

public class IfWorkflow implements Workflow<MyData> {

    @Override
    public void build(WorkflowBuilder<MyData> builder) {        
        builder
            .startsWith(Hello.class)                          
            .If(data -> data.value1 > 2)
                .Do(then -> then
                    .startsWith(PrintMessage.class)
                        .input((step, data) -> step.message = "Value is greater than 2")
                    .then(PrintMessage.class)
                        .input((step, data) -> step.message = "Doing something...")
                )
            .If(data -> data.value1 == 5)
                .Do(then -> then
                    .startsWith(PrintMessage.class)
                        .input((step, data) -> step.message = "Value is 5")
                    .then(PrintMessage.class)
                        .input((step, data) -> step.message = "Doing something...")
                )
            .then(Goodbye.class);        
    }
	...    
}