KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > entity > BnNodeBean


1 package hero.entity;
2
3 import hero.interfaces.BnNodeLightValue;
4 import hero.interfaces.BnNodePK;
5 import hero.interfaces.BnNodeValue;
6 import hero.interfaces.BnProjectLocal;
7 import hero.interfaces.BnNodePerformerAssignLocal;
8 import hero.interfaces.BnRoleLocal;
9 import hero.interfaces.BnUserLocal;
10 import hero.interfaces.InvalidValueException;
11 import hero.util.BonitaServiceLocator;
12 import hero.util.BonitaServiceException;
13
14 import java.util.ArrayList JavaDoc;
15 import java.util.Date JavaDoc;
16 import java.util.Collection JavaDoc;
17
18 import javax.ejb.CreateException JavaDoc;
19 import javax.ejb.EJBException JavaDoc;
20 import javax.ejb.EntityBean JavaDoc;
21 import javax.ejb.EntityContext JavaDoc;
22 import javax.ejb.RemoveException JavaDoc;
23
24 /**
25  * The Entity bean represents a BnUser
26  *
27  * @author Fran?s Charoy
28  * @version $Revision: 1.12 $
29  *
30  * @ejb:bean name="BnNode"
31  * display-name="BnNode Entity"
32  * type="CMP"
33  * jndi-name="ejb/hero/BnNode"
34  * local-jndi-name="ejb/hero/BnNode_L"
35  * view-type="both"
36  * cmp-version="2.x"
37  * reentrant="true"
38  *
39  *
40  * @ejb:transaction type="Supports"
41  *
42  *
43  * @ejb.pk method-intf="both"
44  *
45  * @jonas.bean
46  * ejb-name="BnNode"
47  * jndi-name="ejb/hero/BnNode"
48  * lock-policy="container-read-committed"
49  * @jonas.jdbc-mapping
50  * jndi-name="bonita"
51  * jdbc-table-name="BnNode"
52  *
53  * @jonas.shared false
54  *
55  * @ejb:finder signature="java.util.Collection findAll()"
56  * query="SELECT object(n) FROM BnNode n"
57  * transaction-type="Supports"
58  *
59  * @ejb:finder signature="hero.interfaces.BnNode findByName(java.lang.String pName, java.lang.String projectId )" view-type="both" result-type-mapping="Remote"
60  * query="SELECT OBJECT(n) FROM BnNode n WHERE n.name = ?1 AND n.bnProject.id = ?2"
61  * transaction-type="Supports"
62  * @ejb:finder signature="hero.interfaces.BnNodeLocal findByName(java.lang.String pName, java.lang.String projectId )" view-type="both" result-type-mapping="Local"
63  * query="SELECT OBJECT(n) FROM BnNode n WHERE n.name = ?1 AND n.bnProject.id = ?2"
64  * transaction-type="Supports"
65  *
66  * @ejb.finder
67  * signature="Collection findUserReady(java.lang.String projectId, java.lang.String userName)"
68  * view-type="local" result-type-mapping="Local"
69  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n, BnProject AS p, IN (p.bnUsers) AS u, IN (u.bnRoles) AS r
70  * WHERE n.bnProject.id = ?1
71  * AND (n.state = 1 OR n.state =3)
72  * AND u.name = ?2
73  * AND r.id = n.bnRole.id"
74  * transaction-type="Supports"
75  *
76  * @ejb.finder
77  * signature="Collection findUserExecuting(java.lang.String projectId, java.lang.String userName)"
78  * view-type="local" result-type-mapping="Local"
79  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n
80  * WHERE n.bnProject.id = ?1
81  * AND (n.state = 5 OR n.state =6)
82  * AND n.executor = ?2"
83  * transaction-type="Supports"
84  *
85  * @ejb.finder
86  * signature="Collection findUserReadyAllProjects(java.lang.String userName)"
87  * view-type="local" result-type-mapping="Local"
88  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n, BnProject AS p, IN (p.bnUsers) AS u, IN (u.bnRoles) AS r
89  * WHERE u.name = ?1
90  * AND (n.state = 1 OR n.state =3)
91  * AND r.id = n.bnRole.id"
92  * transaction-type="Supports"
93  *
94  * @ejb.finder
95  * signature="Collection findUserExecutingAllProjects(java.lang.String userName)"
96  * view-type="local" result-type-mapping="Local"
97  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n
98  * WHERE n.executor = ?1
99  * AND (n.state = 5 OR n.state =6)"
100  * transaction-type="Supports"
101  *
102  * @ejb.finder
103  * signature="Collection findUserTerminatedAllProjects(java.lang.String userName)"
104  * view-type="local" result-type-mapping="Local"
105  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n
106  * WHERE n.executor = ?1
107  * AND n.state = 10"
108  * transaction-type="Supports"
109  *
110  * @ejb.finder
111  * signature="Collection findUserReadyAllProjectsByProperty(java.lang.String userName, java.lang.String key, java.lang.String value)"
112  * view-type="local" result-type-mapping="Local"
113  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n, BnProject AS p, IN (p.bnProperties) AS prop, IN (p.bnUsers) AS u, IN (u.bnRoles) AS r
114  * WHERE u.name = ?1
115  * AND prop.theKey = ?2
116  * AND prop.theValue = ?3
117  * AND (prop.bnProject.name = n.bnProject.name)
118  * AND (n.state = 1 OR n.state =3)
119  * AND r.id = n.bnRole.id"
120  * transaction-type="Supports"
121  *
122  * @ejb.finder
123  * signature="Collection findUserReadyAllActivitiesByProperty(java.lang.String userName, java.lang.String key, java.lang.String value)"
124  * view-type="local" result-type-mapping="Local"
125  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n, BnProject AS p, IN (n.bnProperties) AS prop, IN (p.bnUsers) AS u, IN (u.bnRoles) AS r
126  * WHERE u.name = ?1
127  * AND prop.theKey = ?2
128  * AND prop.theValue = ?3
129  * AND (n.state = 1 OR n.state =3)
130  * AND r.id = n.bnRole.id"
131  * transaction-type="Supports"
132  *
133  *
134  * @ejb.finder
135  * signature="Collection findUserReadyAllProjectsByTwoPropertiesAND(java.lang.String userName, java.lang.String key1, java.lang.String value1, java.lang.String key2, java.lang.String value2)"
136  * view-type="local" result-type-mapping="Local"
137  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n, BnProject AS p, BnProjectProperty AS prop1, BnProjectProperty AS prop2, IN (p.bnUsers) AS u, IN (u.bnRoles) AS r
138  * WHERE u.name = ?1
139  * AND prop1.theKey = ?2
140  * AND prop1.theValue = ?3
141  * AND prop2.theKey = ?4
142  * AND prop2.theValue = ?5
143  * AND (prop1.bnProject.name = n.bnProject.name)
144  * AND (prop2.bnProject.name = n.bnProject.name)
145  * AND (n.state = 1 OR n.state =3)
146  * AND r.id = n.bnRole.id"
147  * transaction-type="Supports"
148  *
149  * @ejb.finder
150  * signature="Collection findUserReadyAllProjectsByTwoPropertiesOR(java.lang.String userName, java.lang.String key1, java.lang.String value1, java.lang.String key2, java.lang.String value2)"
151  * view-type="local" result-type-mapping="Local"
152  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n, BnProject AS p, BnProjectProperty AS prop1, BnProjectProperty AS prop2, IN (p.bnUsers) AS u, IN (u.bnRoles) AS r
153  * WHERE u.name = ?1
154  * AND ((prop1.theKey = ?2 AND prop1.theValue = ?3) OR (prop2.theKey = ?4 AND prop2.theValue = ?5))
155  * AND (prop1.bnProject.name = n.bnProject.name)
156  * AND (prop2.bnProject.name = n.bnProject.name)
157  * AND (n.state = 1 OR n.state =3)
158  * AND r.id = n.bnRole.id"
159  * transaction-type="Supports"
160  *
161   * @ejb.finder
162  * signature="Collection findUserReadyAllProjectsByThreePropertiesAND(java.lang.String userName, java.lang.String key1, java.lang.String value1, java.lang.String key2, java.lang.String value2, java.lang.String key3, java.lang.String value3)"
163  * view-type="local" result-type-mapping="Local"
164  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n, BnProject AS p, BnProjectProperty AS prop1, BnProjectProperty AS prop2, BnProjectProperty AS prop3, IN (p.bnUsers) AS u, IN (u.bnRoles) AS r
165  * WHERE u.name = ?1
166  * AND prop1.theKey = ?2
167  * AND prop1.theValue = ?3
168  * AND prop2.theKey = ?4
169  * AND prop2.theValue = ?5
170  * AND prop3.theKey = ?6
171  * AND prop3.theValue = ?7
172  * AND (prop1.bnProject.name = n.bnProject.name)
173  * AND (prop2.bnProject.name = n.bnProject.name)
174  * AND (prop3.bnProject.name = n.bnProject.name)
175  * AND (n.state = 1 OR n.state =3)
176  * AND r.id = n.bnRole.id"
177  * transaction-type="Supports"
178  *
179  * @ejb.finder
180  * signature="Collection findUserReadyAllProjectsByThreePropertiesOR(java.lang.String userName, java.lang.String key1, java.lang.String value1, java.lang.String key2, java.lang.String value2, java.lang.String key3, java.lang.String value3)"
181  * view-type="local" result-type-mapping="Local"
182  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n, BnProject AS p, BnProjectProperty AS prop1, BnProjectProperty AS prop2, BnProjectProperty AS prop3, IN (p.bnUsers) AS u, IN (u.bnRoles) AS r
183  * WHERE u.name = ?1
184  * AND ((prop1.theKey = ?2 AND prop1.theValue = ?3) OR (prop2.theKey = ?4 AND prop2.theValue = ?5) OR (prop3.theKey = ?6 AND prop3.theValue = ?7))
185  * AND (prop1.bnProject.name = n.bnProject.name)
186  * AND (prop2.bnProject.name = n.bnProject.name)
187  * AND (prop3.bnProject.name = n.bnProject.name)
188  * AND (n.state = 1 OR n.state =3)
189  * AND r.id = n.bnRole.id"
190  * transaction-type="Supports"
191  *
192  *
193  * @ejb.finder
194  * signature="Collection findUserExecutingAllProjectsByProperty(java.lang.String userName, java.lang.String key, java.lang.String value)"
195  * view-type="local" result-type-mapping="Local"
196  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n, BnProject AS p, IN (p.bnProperties) AS prop
197  * WHERE n.executor = ?1
198  * AND prop.theKey = ?2
199  * AND prop.theValue = ?3
200  * AND (prop.bnProject.name = n.bnProject.name)
201  * AND (n.state = 5 OR n.state =6)"
202  * transaction-type="Supports"
203  *
204  * @ejb.finder
205  * signature="Collection findAdminActivities (java.lang.String userName, java.lang.String role ,java.lang.String instance, java.lang.String cooperative)"
206  * view-type="local" result-type-mapping="Local"
207  * query="SELECT DISTINCT OBJECT(n) FROM BnNode AS n, BnProject AS p, IN (p.bnRoles) as pr,IN (p.bnUsers) AS u, IN (u.bnRoles) r
208  * WHERE u.name = ?1
209  * AND r.name = ?2
210  * AND (p.type = ?3 OR p.type = ?4)
211  * AND n.bnProject.id = p.id"
212  * transaction-type="Supports"
213  *
214  *
215  * @ejb.value-object
216  * match="*"
217  * name="BnNode"
218  *
219  * @ejb.value-object
220  * match="light"
221  * name="BnNodeLight"
222  *
223  *
224  * @jboss:table-name table-name="BnNode"
225  *
226  * @jboss:create-table create="true"
227  *
228  * @jboss:remove-table remove="false"
229  *
230  **/

231 public abstract class BnNodeBean
232    implements EntityBean JavaDoc
233 {
234    
235    // -------------------------------------------------------------------------
236
// Members
237
// -------------------------------------------------------------------------
238

239    public EntityContext JavaDoc mContext;
240    
241    // -------------------------------------------------------------------------
242
// Methods
243
// -------------------------------------------------------------------------
244

245
246    // -------------------------------------------------------------------------
247
// Properties (Getters/Setters)
248
// -------------------------------------------------------------------------
249

250    /**
251    * Retrieve the BnNode's id.
252    *
253    * @return Returns an int representing the id of this BnNode.
254    *
255    * @ejb:pk-field
256    * @ejb.value-object
257    * match="light"
258    *
259    * @ejb:interface-method view-type="local"
260    * @ejb:persistence column-name="id"
261    * @jonas.cmp-field-jdbc-mapping
262    * field-name="id"
263    * jdbc-field-name="id"
264    * key-jdbc-name="fk_node"
265    * @ejb:transaction type="Supports"
266    **/

267    public abstract String JavaDoc getId();
268    
269    /**
270    * Set the BnNode's id.
271    *
272    * @param pId The id of this BnNode. Is set at creation time.
273    * @ejb:transaction type="Required"
274    **/

275    public abstract void setId( String JavaDoc pId );
276    
277    /**
278    * Retrieve the BnNode's type.
279    *
280    * @return Returns an int representing the type of this BnNode.
281    *
282    * @ejb:interface-method view-type="both"
283    * @ejb.value-object
284    * match="light"
285    *
286    * @ejb:persistence column-name="type"
287    * @ejb:transaction type="Supports"
288    **/

289    public abstract int getType();
290    
291    /**
292    * Set the BnNode's type.
293    *
294    * @param pType The type of this BnNode. Is set at creation time.
295    * @ejb:interface-method view-type="both"
296    * @ejb:transaction type="Required"
297    **/

298    public abstract void setType( int pType );
299
300    /**
301    * Retrieve the BnNode's state.
302    *
303    * @return Returns an int representing the state of this BnNode.
304    *
305    * @ejb:interface-method view-type="both"
306    * @ejb.value-object
307    * match="light"
308    *
309    * @ejb:persistence column-name="state"
310    * @ejb:transaction type="Supports"
311    **/

312    public abstract int getState();
313    
314    /**
315    * Set the BnNode's state.
316    *
317    * @param pState The type of this BnNode. Is set at creation time.
318    * @ejb:interface-method view-type="both"
319    * @ejb:transaction type="Required"
320    **/

321    public abstract void setState( int pState );
322
323    /**
324    * Retrieve the BnNode's anticipation mode.
325    *
326    * @return Returns a boolean indicating if the node is anticipable
327    *
328    * @ejb:interface-method view-type="both"
329    * @ejb.value-object
330    * match="light"
331    *
332    * @ejb:persistence column-name="anticipable"
333    * @ejb:transaction type="Supports"
334    **/

335    public abstract boolean getAnticipable();
336    
337    /**
338    * Set the BnNode's Anticipable mode.
339    *
340    * @param pAnticipate The mode of this BnNode.
341    * @ejb:interface-method view-type="both"
342    * @ejb:transaction type="Required"
343    **/

344    public abstract void setAnticipable( boolean pAnticipable);
345
346    /**
347    * Retrieve the BnNode's Name.
348    *
349    * @return Returns an int representing the Name of this BnNode.
350    *
351    * @ejb:interface-method view-type="both"
352    * @ejb.value-object
353    * match="light"
354    *
355    * @ejb:persistence column-name="name"
356    * @ejb:transaction type="Supports"
357    **/

358    public abstract String JavaDoc getName();
359    
360    /**
361    * Set the BnNode's Name.
362    *
363    * @param pName The Name of this BnNode. Is set at creation time.
364    * @ejb:transaction type="Required"
365    **/

366    public abstract void setName( String JavaDoc pName );
367
368    /**
369    * Retrieve the BnNode's Description.
370    *
371    * @return Returns the description of the node
372    *
373    * @ejb:interface-method view-type="both"
374    * @ejb.value-object
375    * match="light"
376    *
377    * @ejb:persistence column-name="description"
378    * @ejb:transaction type="Supports"
379    **/

380    public abstract String JavaDoc getDescription();
381    
382    /**
383    * Set the BnNode's Description.
384    *
385    * @param pDescription The Description of this BnNode.
386    * @ejb:interface-method view-type="both"
387    * @ejb:transaction type="Required"
388    **/

389    public abstract void setDescription( String JavaDoc pDescription );
390
391    /**
392    * Retrieve the BnNode's activityPerformer.
393    *
394    * @return Returns the activityPerformer of the node
395    *
396    * @ejb:interface-method view-type="both"
397    * @ejb.value-object
398    * match="light"
399    *
400    * @ejb:persistence column-name="activityPerformer"
401    * @ejb:transaction type="Supports"
402    **/

403    public abstract String JavaDoc getActivityPerformer();
404    
405    /**
406    * Set the BnNode's activityPerformer.
407    *
408    * @param pActivityPerformer The ActivityPerformer of this BnNode.
409    * @ejb:interface-method view-type="both"
410    * @ejb:transaction type="Required"
411    **/

412    public abstract void setActivityPerformer( String JavaDoc pActivityPerformer );
413    
414
415    /**
416    * Retrieve the BnNode's Transition type.
417    *
418    * @return Returns the description of the node
419    *
420    * @ejb:interface-method view-type="local"
421    *
422    * @ejb:persistence column-name="transition"
423    * @ejb:transaction type="Supports"
424    **/

425    public abstract NodeState getTransition();
426    
427    /**
428    * Set the BnNode's Transition
429    *
430    * @param transition The Transition of this BnNode.
431    * @ejb:interface-method view-type="local"
432    * @ejb:transaction type="Required"
433    **/

434    public abstract void setTransition( NodeState transition );
435
436
437    /**
438    * Retrieve the BnNode's Activation type.
439    *
440    * @return Returns the description of the node
441    *
442    * @ejb:interface-method view-type="local"
443    *
444    * @ejb:persistence column-name="activation"
445    * @ejb:transaction type="Supports"
446    **/

447    public abstract EdgeState getActivation();
448    
449    /**
450    * Set the BnNode's Activation
451    *
452    * @param activation The Activation of this BnNode.
453    * @ejb:interface-method view-type="local"
454    * @ejb:transaction type="Required"
455    **/

456    public abstract void setActivation( EdgeState activation );
457
458    /**
459    * Retrieve the BnNode's StartDate.
460    *
461    * @return Returns the start date of the node
462    *
463    * @ejb:interface-method view-type="both"
464    * @ejb.value-object
465    * match="light"
466    *
467    * @ejb:persistence column-name="startdate"
468    * @ejb:transaction type="Supports"
469    **/

470    public abstract Date JavaDoc getStartDate();
471    
472    /**
473    * Set the BnNode's StartDate.
474    *
475    * @param pStartDate The StartDate of this BnNode.
476    * @ejb:interface-method view-type="both"
477    * @ejb:transaction type="Required"
478    **/

479    public abstract void setStartDate( Date JavaDoc pStartDate );
480
481    /**
482    * Retrieve the BnNode's EndDate.
483    *
484    * @return Returns the end date of the node
485    *
486    * @ejb:interface-method view-type="both"
487    * @ejb.value-object
488    * match="light"
489    *
490    * @ejb:persistence column-name="enddate"
491    * @ejb:transaction type="Supports"
492    **/

493    public abstract Date JavaDoc getEndDate();
494    
495    /**
496    * Set the BnNode's EndDate.
497    *
498    * @param pEndDate The end date of this BnNode.
499    * @ejb:interface-method view-type="both"
500    * @ejb:transaction type="Required"
501    **/

502    public abstract void setEndDate( Date JavaDoc pEndDate );
503  
504    /**
505     * Retrieve the BnNode's Deadlines.
506     *
507     * @return Returns the collection of deadlines of the node
508     *
509     * @ejb:interface-method view-type="both"
510     * @ejb.value-object
511     * match="light"
512     *
513     * @ejb:persistence column-name="deadlines"
514     * @ejb:transaction type="Supports"
515     **/

516     public abstract Collection JavaDoc getDeadlines();
517     
518     /**
519     * Set the BnNode's Deadlines.
520     *
521     * @param pDeadlines The Collection of Deadlines of this BnNode.
522     * @ejb:interface-method view-type="both"
523     * @ejb:transaction type="Required"
524     **/

525     public abstract void setDeadlines( Collection JavaDoc pDeadlines );
526     
527     /**
528      * Retrieve the BnNode's RelativeDeadlines.
529      *
530      * @return Returns the collection of relative deadlines of the node
531      *
532      * @ejb:interface-method view-type="both"
533      * @ejb.value-object
534      * match="light"
535      *
536      * @ejb:persistence column-name="relativedeadlines"
537      * @ejb:transaction type="Supports"
538      **/

539      public abstract Collection JavaDoc getRelativeDeadlines();
540      
541      /**
542      * Set the BnNode's Relative Deadlines.
543      *
544      * @param pDeadlines The Collection of Relative Deadlines of this BnNode.
545      * @ejb:interface-method view-type="both"
546      * @ejb:transaction type="Required"
547      **/

548      public abstract void setRelativeDeadlines( Collection JavaDoc pDeadlines );
549     
550
551     /** Retrieve the BnNode's Creator.
552      * @return Returns the node creator
553      *
554      * @ejb:interface-method view-type="both"
555      * @ejb.value-object
556      * match="light"
557      *
558      * @ejb:persistence column-name="creator"
559      * @ejb:transaction type="Supports"
560      **/

561     public abstract String JavaDoc getCreator();
562     
563     /**
564      * Set the BnNode's Creator.
565      *
566      * @param pCreator The creator of this BnNode.
567      * @ejb:interface-method view-type="local"
568      * @ejb:transaction type="Required"
569      **/

570     public abstract void setCreator( String JavaDoc pCreator );
571     
572     /** Retrieve the BnNode's Executor.
573      * @return Returns the node executor
574      *
575      * @ejb:interface-method view-type="both"
576      * @ejb.value-object
577      * match="light"
578      *
579      * @ejb:persistence column-name="executor"
580      * @ejb:transaction type="Supports"
581      **/

582
583     public abstract String JavaDoc getExecutor();
584     
585     /**
586      * Set the BnNode's Executor.
587      *
588      * @ejb:interface-method view-type="local"
589      * @param pCreator The creator of this BnNode. Is set at creation time.
590      * @ejb:transaction type="Required"
591      **/

592     public abstract void setExecutor( String JavaDoc pExecutor );
593
594     /** Retrieve the BnNode's BnRole.
595      *
596      * @return Returns a String representing the ole associated to the BnNode.
597      * @ejb:interface-method view-type="local"
598      * @ejb:relation name="NodeRole" role-name="has-role" cascade-delete="yes"
599      * @ejb:value-object match="*"
600      * relation="external"
601      * aggregate="hero.interfaces.BnRoleValue"
602      * aggregate-name="BnRole"
603      * @jboss:auto-key-fields
604      * @jonas:automatic-pk="true"
605      * @ejb:transaction type="Supports"
606      **/

607     public abstract BnRoleLocal getBnRole();
608     
609     /**
610      * Set the BnNode's Creator.
611      *
612      * @param pCreator The creator of this BnNode. Is set at creation time.
613      * @ejb:interface-method view-type="local"
614      * @ejb:transaction type="Required"
615      **/

616     public abstract void setBnRole(BnRoleLocal role);
617
618     /** Retrieve the performerAssign for the node.
619      *
620      * @return Returns the node performerAssign.
621      * @ejb:interface-method view-type="both"
622      * @ejb:relation name="performerAssign-node" node-name="node2performerAssign"
623      * @jboss:auto-key-fields
624      * @ejb:value-object match="*"
625      * relation="external"
626      * aggregate="hero.interfaces.BnNodePerformerAssignValue"
627      * aggregate-name="BnNodePerformerAssign"
628      * @ejb:transaction type="Supports"
629      **/

630    public abstract BnNodePerformerAssignLocal getBnNodePerformerAssign() ;
631
632    /**
633     * Set the Nodes of this performerAssign
634     *
635     * @param pPerformerAssign performerAssign of the node
636     * @ejb:transaction type="Required"
637     **/

638    public abstract void setBnNodePerformerAssign( BnNodePerformerAssignLocal pPerformerAssign);
639
640     /**
641      * @return the project of the BnNode
642      * @ejb:interface-method view-type="local"
643      * @ejb:relation name="Nodes" role-name="is-node-of" cascade-delete="yes"
644      * @ejb:value-object match="*"
645      * relation="external"
646      * aggregate="hero.interfaces.BnProjectLightValue"
647      * aggregate-name="BnProject"
648      * @jboss:auto-key-fields
649      * @jonas:automatic-pk="true"
650      * @ejb:transaction type="Supports"
651      *
652      **/

653     public abstract BnProjectLocal getBnProject();
654
655    /**
656    * Set the BnProject Name.
657    *
658    * @param pName The Name of this BnNode. Is set at creation time.
659    * @ejb:interface-method view-type="local"
660    * @ejb:transaction type="Required"
661    **/

662     public abstract void setBnProject(BnProjectLocal pProject);
663
664     /**
665      * @return the outgoing edges of the node
666      * @ejb:interface-method view-type="local"
667      * @ejb:relation name="InBnNode" role-name="has-edges-in" target-multiple="yes"
668      * @jboss:auto-key-fields
669      * @jonas:automatic-pk="true"
670      * @ejb:transaction type="Supports"
671      *
672      **/

673     public abstract Collection JavaDoc getOutBnEdges();
674
675    /**
676    * Set the Outgoing edges of the node
677    *
678    * @param pEdges the outgoing edges of the node
679    * @ejb:transaction type="Required"
680    **/

681     public abstract void setOutBnEdges(Collection JavaDoc pEdges);
682
683     /**
684      * @return the ingoing edges of the node
685      * @ejb:interface-method view-type="local"
686      * @ejb:relation name="OutBnNode" role-name="has-edges-out" target-multiple="yes"
687      * @jboss:auto-key-fields
688      * @jonas:automatic-pk="true"
689      * @ejb:transaction type="Supports"
690      *
691      **/

692     public abstract Collection JavaDoc getInBnEdges();
693
694    /**
695    * Set the Ingoing edges of the node
696    *
697    * @param pEdges the ingoing edges of the node
698    * @ejb:interface-method view-type="local"
699    * @ejb:transaction type="Required"
700    **/

701     public abstract void setInBnEdges(Collection JavaDoc pEdges);
702     
703     /**
704      * @return the ingoing AgentEdges of the node
705      * @ejb:interface-method view-type="local"
706      * @ejb:relation name="OutNodeInAgentEdge" role-name="has-edges-out" target-multiple="yes"
707      * @jboss:auto-key-fields
708      * @jonas:automatic-pk="true"
709      * @ejb:transaction type="Supports"
710      *
711      **/

712     public abstract Collection JavaDoc getInBnAgentEdges();
713     
714     /**
715      * Set the Ingoing AgentEdges of the node
716      *
717      * @param pAgentEdges the ingoing AgentEdges of the node
718      * @ejb:transaction type="Required"
719      **/

720     public abstract void setInBnAgentEdges(Collection JavaDoc pAgentEdges);
721
722     /**
723      * @return Return the creation date of the BnNode
724      * @ejb:interface-method view-type="both"
725      * @ejb:persistence column-name="creationdate"
726      * @ejb:transaction type="Supports"
727      * @ejb.value-object
728      * match="light"
729      *
730      **/

731     public abstract Date JavaDoc getCreationDate();
732
733     /**
734      * @param pDate the creation date of the BnNode
735      * @ejb:interface-method view-type="both"
736      * @ejb:transaction type="Required"
737      *
738      **/

739     public abstract void setCreationDate(Date JavaDoc pDate);
740     
741     /**
742      * @return the properties of the node
743      * @ejb:interface-method view-type="both"
744      * @ejb:relation name="nodeprp" role-name="is-property-of"
745      * @jboss:auto-key-fields
746      * @jonas:automatic-pk="true"
747      * @ejb.value-object
748      * match="normal"
749      * type="Collection"
750      * relation="external"
751      * aggregate="hero.interfaces.BnNodePropertyValue"
752      * aggregate-name="BnPropertie"
753      * members="hero.interfaces.BnNodePropertyLocal"
754      * members-name="BnPropertie"
755      * @ejb:transaction type="Supports"
756      *
757      **/

758     public abstract Collection JavaDoc getBnProperties();
759
760    /**
761    * Set the properties of the node
762    * @ejb:interface-method view-type="both"
763    * @param pPrp the outgoing edges of the node
764    * @ejb:transaction type="Required"
765    **/

766     public abstract void setBnProperties(Collection JavaDoc pPrp);
767
768    /**
769      * @return the Hooks of the node
770      * @ejb:interface-method view-type="both"
771      * @ejb:relation name="nodehook" role-name="is-hook-of"
772      * @jboss:auto-key-fields
773      * @jonas:automatic-pk="true"
774      * @ejb.value-object
775      * match="normal"
776      * type="Collection"
777      * relation="external"
778      * aggregate="hero.interfaces.BnNodeHookValue"
779      * aggregate-name="BnHook"
780      * members="hero.interfaces.BnNodeHookLocal"
781      * members-name="BnHook"
782      * @ejb:transaction type="Supports"
783      *
784      **/

785     public abstract Collection JavaDoc getBnHooks();
786
787    /**
788    * Set the Hooks of the node
789    * @ejb:interface-method view-type="both"
790    * @param pHook the outgoing edges of the node
791    * @ejb:transaction type="Required"
792    **/

793     public abstract void setBnHooks(Collection JavaDoc pHook);
794
795
796    /**
797      * @return the Hooks of the node
798      * @ejb:interface-method view-type="both"
799      * @ejb:relation name="nodeinterhook" role-name="is-interhook-of"
800      * @jboss:auto-key-fields
801      * @jonas:automatic-pk="true"
802      * @ejb.value-object
803      * match="normal"
804      * type="Collection"
805      * relation="external"
806      * aggregate="hero.interfaces.BnNodeInterHookValue"
807      * aggregate-name="BnInterHook"
808      * members="hero.interfaces.BnNodeInterHookLocal"
809      * members-name="BnInterHook"
810      * @ejb:transaction type="Supports"
811      *
812      **/

813     public abstract Collection JavaDoc getBnInterHooks();
814
815    /**
816    * Set the Hooks of the node
817    * @ejb:interface-method view-type="both"
818    * @param pHook the outgoing edges of the node
819    * @ejb:transaction type="Required"
820    **/

821     public abstract void setBnInterHooks(Collection JavaDoc pHook);
822
823     /**
824      * @ejb.interface-method
825      * @ejb:transaction type="Supports"
826      */

827     public abstract BnNodeValue getBnNodeValue();
828     
829     /**
830      * @ejb.interface-method
831      * @ejb:transaction type="Required"
832      */

833     public abstract void setBnNodeValue(BnNodeValue v);
834
835     /**
836      * @ejb.interface-method
837      * @ejb:transaction type="Supports"
838      */

839     public abstract BnNodeLightValue getBnNodeLightValue();
840     
841     /**
842      * @ejb.interface-method
843      * @ejb:transaction type="Required"
844      */

845     public abstract void setBnNodeLightValue(BnNodeLightValue v);
846     
847
848    /**
849      * @return true if the BnNode is executing
850      * @ejb.interface-method view-type="local"
851      * @ejb:transaction type="Supports"
852      */

853     public boolean isExecuting() {
854     return (this.getState()==hero.interfaces.Constants.Nd.EXECUTING ||
855         this.getState()==hero.interfaces.Constants.Nd.ANTICIPATING);
856     }
857
858    /**
859      * @return true if the BnNode is TErminated
860      * @ejb.interface-method view-type="local"
861      * @ejb:transaction type="Supports"
862      */

863     public boolean isTerminated() {
864     return (this.getState()==hero.interfaces.Constants.Nd.TERMINATED ||
865         this.getState()==hero.interfaces.Constants.Nd.FINISHED);
866     }
867
868    /**
869      * @return true if the BnNode is Cancelled
870      * @ejb.interface-method view-type="local"
871      * @ejb:transaction type="Supports"
872      */

873     public boolean isCancelled() {
874     return (this.getState()==hero.interfaces.Constants.Nd.DEAD);
875     }
876
877
878     
879    // -------------------------------------------------------------------------
880
// Framework Callbacks
881
// -------------------------------------------------------------------------
882

883    /**
884    * Create a BnNode based on the supplied BnNode Value Object.
885    *
886    *
887    * @throws InvalidValueException If one of the values are not correct,
888    * this will not roll back the transaction
889    * because the caller has the chance to
890    * fix the problem and try again
891    * @throws EJBException If no new unique ID could be retrieved this will
892    * rollback the transaction because there is no
893    * hope to try again
894    * @throws CreateException Because we have to do so (EJB spec.)
895    *
896    * @ejb:create-method view-type="both"
897    **/

898    public BnNodePK ejbCreate(BnNodeValue nd )
899       throws
900          InvalidValueException,
901          EJBException JavaDoc,
902          CreateException JavaDoc
903    {
904        setBnNodeValue(nd);
905        try {
906           BonitaServiceLocator serviceLocator = BonitaServiceLocator.getInstance();
907           this.setId(hero.interfaces.BnNodeUtil.generateGUID(this));
908           this.setDeadlines(new ArrayList JavaDoc());
909           this.setRelativeDeadlines(new ArrayList JavaDoc());
910         
911        } catch (BonitaServiceException e) {
912           throw new CreateException JavaDoc(e.getMessage());
913        }
914       // This is only possible in CMPs. Otherwise return a valid PK.
915
return null;
916    }
917
918    /**
919    * Create a BnNode based on the supplied Name and type.
920    *
921    *
922    * @throws InvalidValueException If one of the values are not correct,
923    * this will not roll back the transaction
924    * because the caller has the chance to
925    * fix the problem and try again
926    * @throws EJBException If no new unique ID could be retrieved this will
927    * rollback the transaction because there is no
928    * hope to try again
929    * @throws CreateException Because we have to do so (EJB spec.)
930    *
931    * @ejb:create-method view-type="both"
932    **/

933    public BnNodePK ejbCreate(String JavaDoc name, int type )
934       throws
935          InvalidValueException,
936          EJBException JavaDoc,
937          CreateException JavaDoc
938    {
939        this.setName(name);
940        this.setType(type);
941        this.setState(hero.interfaces.Constants.Nd.READY);
942        this.setAnticipable(true);
943        this.setTransition(NodeState.make(type,true));
944        this.setActivation(EdgeState.make(type));
945        this.setDeadlines(new ArrayList JavaDoc());
946        this.setRelativeDeadlines(new ArrayList JavaDoc());
947        this.setId(hero.interfaces.BnNodeUtil.generateGUID(this));
948        
949        // This is only possible in CMPs. Otherwise return a valid PK.
950
return null;
951    }
952    
953    public void setEntityContext( EntityContext JavaDoc lContext )
954    {
955       mContext = lContext;
956    }
957    
958    public void unsetEntityContext()
959    {
960       mContext = null;
961    }
962    
963    public void ejbActivate()
964    {
965    }
966    
967    public void ejbPassivate()
968    {
969    }
970    
971    public void ejbLoad()
972    {
973    }
974    
975    public void ejbStore()
976    {
977    }
978    
979    public void ejbRemove()
980       throws
981          RemoveException JavaDoc
982    {
983    }
984    
985 }
986
Popular Tags