パターンNo.4 exclusive choice

f:id:wkzk:20060918091707j:image
で、xmlはこれ↓



  
   
  
  
   
  
  
   
   
   
    #{scenario==1}
   
   
    #{scenario==2}
   
  
  
   
  
  
   
    
   
   
  
  
   
  
  

で、実装はこれ。

public class ExclusiveChoiceTest extends TestCase {

  public void testExclusiveChoice() throws Exception {

   // Extract a process definition from the processdefinition.xml file.
   FileInputStream fis = new FileInputStream("processes/exclusiveChoice.par/processdefinition.xml");
   ProcessDefinition processDefinition = ProcessDefinition.parseXmlInputStream(fis);

   // Create an instance of the process definition.
   ProcessInstance instance = new ProcessInstance(processDefinition);

   ContextInstance ci = (ContextInstance) instance.getInstance( ContextInstance.class );
   instance.signal();
   Token root = instance.getRootToken();

   assertSame( processDefinition.getNode("state1"), root.getNode() );
	    
      ci.setVariable( "scenario", new Integer(2) );
   root.signal();	    
   assertSame( processDefinition.getNode("c"), root.getNode() );
	    
  }

}

気になること

  1. conditionの記述は、jPDL ELというJSP/JSF EL Likeの独自なもの。S2,Tape,WWみたく、OGNLの選択肢は無かったのかなぁ。。
  2. GPD(ダイアグラム)からcondition記述ができない(XML直接記述)
  3. DI*AOP適用してActionをフレームワーク依存のないようにもできるけど、やるんだったらGPDも改良しないと.
  4. XORがわかったほうが絵的にうれしいけどなぁ。