Guest User

Untitled

a guest
Jun 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. package org.sonatype.sisu.flow;
  2.  
  3. import org.drools.ruleflow.core.RuleFlowProcess;
  4. import org.drools.ruleflow.core.RuleFlowProcessFactory;
  5.  
  6. public class Flow
  7. {
  8. private RuleFlowProcessFactory factory;
  9. private int nodeCount = 2;
  10.  
  11. public Flow( String flowId )
  12. {
  13. factory = RuleFlowProcessFactory.createProcess( flowId );
  14. factory.name( flowId ).packageName("org.sonatype.release");
  15. factory.startNode(1).name("Start").done();
  16. }
  17.  
  18. public Flow action( SisuFlowAction action )
  19. {
  20. factory.actionNode(nodeCount).action( action ).done();
  21. factory.connection( nodeCount-1, nodeCount );
  22. nodeCount++;
  23. return this;
  24. }
  25.  
  26. public RuleFlowProcess flow()
  27. {
  28. factory.endNode(nodeCount).name("End").done();
  29. factory.connection( nodeCount-1, nodeCount );
  30. return factory.validate().getProcess();
  31. }
  32. }
Add Comment
Please, Sign In to add comment