View Javadoc

1   /*
2    * $Id: SwitchImpl.java,v 1.1 2004/12/15 14:18:13 patforna Exp $
3    *
4    * Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
5    * Berne University of Applied Sciences
6    * School of Engineering and Information Technology
7    * All rights reserved.
8    */
9   package bexee.model.activity.impl;
10  
11  import java.util.ArrayList;
12  import java.util.List;
13  
14  import bexee.core.ProcessController;
15  import bexee.core.ProcessInstance;
16  import bexee.model.BPELElementVisitor;
17  import bexee.model.StandardAttributes;
18  import bexee.model.activity.Activity;
19  import bexee.model.activity.Switch;
20  import bexee.model.elements.BpelCase;
21  
22  /***
23   * This is a default implementation of the Swich activity interface.
24   * 
25   * @author Patric Fornasier
26   * @author Pawel Kowalski
27   * @version $Revision: 1.1 $, $Date: 2004/12/15 14:18:13 $
28   */
29  public class SwitchImpl extends AbstractActivity implements Switch {
30  
31      private List bpelCases;
32  
33      private Activity otherwiseActivity;
34  
35      public SwitchImpl(StandardAttributes standardAttributes) {
36          super(standardAttributes);
37          bpelCases = new ArrayList();
38      }
39  
40      public void addCase(BpelCase bpelCase) {
41          bpelCases.add(bpelCase);
42      }
43  
44      public List getCases() {
45          return bpelCases;
46      }
47  
48      public void activity(Activity activity) {
49          setOtherwise(activity);
50      }
51  
52      public void setOtherwise(Activity activity) {
53          otherwiseActivity = activity;
54      }
55  
56      public Activity getOtherwise() {
57          return otherwiseActivity;
58      }
59  
60      public void accept(ProcessController controller, ProcessInstance instance)
61              throws Exception {
62          controller.process(this, instance);
63      }
64  
65      public void accept(BPELElementVisitor elementVisitor) {
66          elementVisitor.visit(this);
67      }
68  }