title: Java "workflow" design
body: <p>I'd like to ask about designing "workflow merging". I've got several workflows that aren't very similar to each other. However, sometimes I want to combine them modifying them very slightly. 
  Let me give you an example :</p>
  
  <blockquote>
    <h3>Workflow 1 - Trip</h3>
    
    <p>A1 (pack the bag) -> A2 (leave the house) -> A3
    (catch the bus) -> A4 ...</p>
    
    <h3>Workflow 2 - Daily plant watering</h3>
    
    <p>B1 (turn the water on) -> B2 (leave the house) -> B3 (water the plants) -> B4 (enter the house) -> B5 (turn the water off)</p>
  </blockquote>
  
  <p>On Sunday, I want to go for a trip and I need to water the plants too. So I want to create something like <strong>A1 -> B1 to B5 -> A2...</strong> . I also want to have possibility to tell my friend to finish the watering, which would be something like <strong>A1 -> B1 to B2 -> C1 (pass the task to a friend) -> A3</strong> ...
  As you can see, the flow is straightforward - there are no forks and joins in it and I don't need such functionality. All I need is to create a linear list of commands with possibility to merge them together easily. All fragments of code are Java methods at the moment (and I'd like to make them something like atomic flows).</p>
  
  <p>The main goal of my approach should be avoiding typing the same code over and over again. The flow may have hundreds of steps. I'd like to make a statement like <strong>Execute flow A, but instead of running A2 and A3, execute B2 to B6 and continue with A</strong>.</p>
  
  <p>I've got two major questions : </p>
  
  <ul>
  <li>Is there any framework that already supports this? If there is, isn't it too complex for my purpose?</li>
  <li>If not, what would be the best way to implement such thing?</li>
  </ul>
  
  <p>Note : Can you please specify what is so unclear about my question?</p>