KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > xml > elements > ActivitySets


1 /* ActivitySets.java
2  *
3  * Authors:
4  * Stefanovic Nenad chupo@iis.ns.ac.yu
5  * Bojanic Sasa sasaboy@neobee.net
6  * Puskas Vladimir vpuskas@eunet.yu
7  * Pilipovic Goran zboniek@uns.ac.yu
8  *
9  */

10
11 package org.enhydra.jawe.xml.elements;
12
13 import org.enhydra.jawe.xml.*;
14 import org.enhydra.jawe.xml.panels.*;
15
16 import java.util.*;
17
18 /**
19 * Represents a WfMC DTD element that has the similar name.
20 * This class is a collection of class {@link ActivitySet}
21 * instances.
22 */

23 public class ActivitySets extends XMLCollection {
24
25    /**
26    * Creates a new instance of the class.
27    * @param myWorkflow WorkflowProcess class that holds ActivitySets class.
28    */

29    public ActivitySets (WorkflowProcess myWorkflow) {
30       super (myWorkflow);
31    }
32
33    /**
34    * Generates a new element of the class which instances
35    * are members of collection of this class.
36    *
37    * return The generated instance of class that makes collection.
38    */

39    public XMLElement generateNewElement() {
40       ActivitySet as=new ActivitySet(this,(WorkflowProcess)myOwner);
41       as.setRequired(true);
42       return as;
43    }
44
45    /**
46    * Returns an ActivitySet specified by given ID.
47    *
48    * @param ID The ID attribute of wanted ActivitySet.
49    * @return An instance of ActivitySet class that has specified ID.
50    * If collection of activity sets does not contain wanted
51    * ActivitySet, the <tt>null</tt> is returned.
52    */

53    public ActivitySet getActivitySet (String JavaDoc ID) {
54       return (ActivitySet)super.getCollectionElement(ID);
55    }
56
57    /**
58    * Returns <tt>true</tt> if specified workflow process isn't referenced from
59    * any activity of subflow type.
60    */

61    protected boolean canRemoveWorkflow (WorkflowProcess toRemove) {
62       Iterator it=refCollectionElements.iterator();
63       while (it.hasNext()) {
64          ActivitySet as=(ActivitySet)it.next();
65          boolean cr=as.canRemoveWorkflow(toRemove);
66          if (cr==false) {
67             return false;
68          }
69       }
70       return true;
71    }
72
73    /**
74    * Returns <tt>true</tt> if specified participant isn't referenced to
75    * be a performer of activity.
76    */

77    protected boolean canRemoveParticipant (Participant toRemove) {
78       Iterator it=refCollectionElements.iterator();
79       while (it.hasNext()) {
80          ActivitySet as=(ActivitySet)it.next();
81          boolean cr=as.canRemoveParticipant(toRemove);
82          if (cr==false) {
83             return false;
84          }
85       }
86       return true;
87    }
88
89    /**
90    * Returns <tt>true</tt> if specified application isn't used as a tool
91    * of activity which type is Tool.
92    */

93    protected boolean canRemoveApplication (Application toRemove) {
94       Iterator it=refCollectionElements.iterator();
95       while (it.hasNext()) {
96          ActivitySet as=(ActivitySet)it.next();
97          boolean cr=as.canRemoveApplication(toRemove);
98          if (cr==false) {
99             return false;
100          }
101       }
102       return true;
103    }
104
105    /**
106    * Returns <tt>true</tt> if specified data field isn't used as
107    * actual parameter of activity which type is Tool or Subflow.
108    */

109    protected boolean canRemoveDataFieldOrFormalParameter (XMLCollectionElement toRemove) {
110       Iterator it=refCollectionElements.iterator();
111       while (it.hasNext()) {
112          ActivitySet as=(ActivitySet)it.next();
113          boolean cr=as.canRemoveDataFieldOrFormalParameter(toRemove);
114          if (cr==false) {
115             return false;
116          }
117       }
118       return true;
119    }
120
121    /**
122    * Returns <tt>true</tt> if specified data field or formal parameter is
123    * used in transition condition expression of any transition within
124    * every activity set transitions.
125    */

126    protected boolean isDataFieldOrFormalParameterUsedWithinTransitionConditions (
127          XMLCollectionElement toRemove) {
128       Iterator it=refCollectionElements.iterator();
129       while (it.hasNext()) {
130          ActivitySet as=(ActivitySet)it.next();
131          boolean inUse=as.isDataFieldOrFormalParameterUsedWithinTransitionConditions(toRemove);
132          if (inUse==true) {
133             return true;
134          }
135       }
136       return false;
137    }
138
139    /**
140    * Called by owner object after importing of XML file to do neccessary
141    * things on activities after importing of XML.
142    */

143    protected void afterImporting () {
144       Iterator it=refCollectionElements.iterator();
145       while (it.hasNext()) {
146          ActivitySet as=(ActivitySet)it.next();
147          as.afterImporting();
148       }
149    }
150
151    // First, the controlled panel must be created, and then the control panel
152
public XMLPanel getPanel () {
153       isReadOnly=true;
154       controlledPanel=new XMLTablePanel(this,"",false,false);
155       controlPanel=new XMLTableControlPanel(this,"",true,false);
156       return new XMLGroupPanel(this,new XMLPanel[]{
157          controlledPanel,controlPanel},toLabel(),XMLPanel.BOX_LAYOUT,
158          false,true);
159    }
160
161    /**
162    * Overrides parent method to be accessible within WorkflowManager.
163    */

164    public void decrementID () {
165       super.decrementID();
166    }
167
168    /**
169    * Overrides parent method to be accessible within ActivitySet.
170    */

171    protected void updateID (String JavaDoc someID) {
172       super.updateID(someID);
173    }
174
175 }
176
Popular Tags