View Javadoc

1   /*
2    * $Id: FindCreateReceivesVisitor.java,v 1.1 2004/12/15 14:18:10 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;
10  
11  import java.util.ArrayList;
12  import java.util.List;
13  
14  import bexee.model.activity.Receive;
15  
16  /***
17   * This implementation of a BPELElementVisitor allows finding all Receive
18   * activities in a BPEL process with "createInstance=yes" attribute, i.e. all
19   * Receives which can cause the creation of a process instance.
20   * 
21   * @version $Revision: 1.1 $, $Date: 2004/12/15 14:18:10 $
22   * @author Patric Fornasier
23   * @author Pawel Kowalski
24   */
25  public class FindCreateReceivesVisitor extends AtomicActivityVisitor {
26  
27      private List creationReceives = null;
28  
29      /***
30       * Create a FindCreateReceivesVisitor instance.
31       */
32      public FindCreateReceivesVisitor() {
33          creationReceives = new ArrayList();
34      }
35  
36      //***************************************************/
37      // methods
38      //***************************************************/
39  
40      /***
41       * Return a list of all Receives in a process which may cause the creation
42       * of a process instance.
43       * 
44       * @return List of Receives.
45       */
46      public List getCreationReceives() {
47          return creationReceives;
48      }
49  
50      //***************************************************/
51      // bexee.model.BPELElementVisitor
52      //***************************************************/
53  
54      /***
55       * It only is necessary to traverse all <code>Receive</code> activities in
56       * order to discover all Receives which might initiate process instance
57       * creation.
58       */
59      public void visit(Receive receive) {
60          if (receive.isCreateInstance()) {
61              creationReceives.add(receive);
62          }
63      }
64  }