KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > league > ejb > entity > GroupsBean


1 package league.ejb.entity;
2
3 import javax.ejb.*;
4
5 /**
6  * This is the bean class for the Groups enterprise bean.
7  * Created Mar 9, 2005 1:34:55 PM
8  * @author honza
9  */

10 public abstract class GroupsBean implements javax.ejb.EntityBean JavaDoc, league.ejb.entity.GroupsLocalBusiness {
11     private javax.ejb.EntityContext JavaDoc context;
12     
13     // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click on the + sign on the left to edit the code.">
14
// TODO Consider creating Transfer Object to encapsulate data
15
// TODO Review finder methods
16
/**
17      * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
18      */

19     public void setEntityContext(javax.ejb.EntityContext JavaDoc aContext) {
20         context = aContext;
21     }
22     
23     /**
24      * @see javax.ejb.EntityBean#ejbActivate()
25      */

26     public void ejbActivate() {
27         
28     }
29     
30     /**
31      * @see javax.ejb.EntityBean#ejbPassivate()
32      */

33     public void ejbPassivate() {
34         
35     }
36     
37     /**
38      * @see javax.ejb.EntityBean#ejbRemove()
39      */

40     public void ejbRemove() {
41         
42     }
43     
44     /**
45      * @see javax.ejb.EntityBean#unsetEntityContext()
46      */

47     public void unsetEntityContext() {
48         context = null;
49     }
50     
51     /**
52      * @see javax.ejb.EntityBean#ejbLoad()
53      */

54     public void ejbLoad() {
55         
56     }
57     
58     /**
59      * @see javax.ejb.EntityBean#ejbStore()
60      */

61     public void ejbStore() {
62         
63     }
64     // </editor-fold>
65

66     // <editor-fold desc="CMP fields and relationships.">
67

68     public abstract java.math.BigDecimal JavaDoc getId();
69     public abstract void setId(java.math.BigDecimal JavaDoc id);
70     
71     public abstract java.lang.String JavaDoc getName();
72     public abstract void setName(java.lang.String JavaDoc name);
73     
74     public abstract java.math.BigDecimal JavaDoc getPlace();
75     public abstract void setPlace(java.math.BigDecimal JavaDoc place);
76     
77     public abstract league.ejb.entity.RoundLocal getRoundId();
78     public abstract void setRoundId(league.ejb.entity.RoundLocal roundId);
79     
80     public abstract java.util.Collection JavaDoc getPlaceInGroup();
81     public abstract void setPlaceInGroup(java.util.Collection JavaDoc placeInGroup);
82     
83     // </editor-fold>
84

85     public java.math.BigDecimal JavaDoc ejbCreate(java.math.BigDecimal JavaDoc id, java.lang.String JavaDoc name, java.math.BigDecimal JavaDoc place, league.ejb.entity.RoundLocal roundId) throws javax.ejb.CreateException JavaDoc {
86         if (id == null) {
87             throw new javax.ejb.CreateException JavaDoc("The field \"id\" must not be null");
88         }
89         if (name == null) {
90             throw new javax.ejb.CreateException JavaDoc("The field \"name\" must not be null");
91         }
92         if (place == null) {
93             throw new javax.ejb.CreateException JavaDoc("The field \"place\" must not be null");
94         }
95         if (roundId == null) {
96             throw new javax.ejb.CreateException JavaDoc("The field \"roundId\" must not be null");
97         }
98         
99         // TODO add additional validation code, throw CreateException if data is not valid
100
setId(id);
101         setName(name);
102         setPlace(place);
103         
104         return null;
105     }
106     
107     public void ejbPostCreate(java.math.BigDecimal JavaDoc id, java.lang.String JavaDoc name, java.math.BigDecimal JavaDoc place, league.ejb.entity.RoundLocal roundId) {
108         // TODO populate relationships here if appropriate
109
setRoundId(roundId);
110         
111     }
112     
113     public java.math.BigDecimal JavaDoc ejbCreate(java.lang.String JavaDoc name, java.math.BigDecimal JavaDoc place, league.ejb.entity.RoundLocal roundId) throws javax.ejb.CreateException JavaDoc {
114         
115         if (name == null) {
116             throw new javax.ejb.CreateException JavaDoc("The field \"name\" must not be null");
117         }
118         if (place == null) {
119             throw new javax.ejb.CreateException JavaDoc("The field \"place\" must not be null");
120         }
121         if (roundId == null) {
122             throw new javax.ejb.CreateException JavaDoc("The field \"roundId\" must not be null");
123         }
124         
125         // TODO add additional validation code, throw CreateException if data is not valid
126
int id=0;
127         try {
128             Integer JavaDoc maxId=ejbSelectMaxId();
129             
130             if (maxId!=null) id=maxId.intValue()+1;
131         } catch (javax.ejb.FinderException JavaDoc e) {
132             throw new javax.ejb.CreateException JavaDoc();
133         }
134         setId(new java.math.BigDecimal JavaDoc(id));
135         setName(name);
136         setPlace(new java.math.BigDecimal JavaDoc(place.intValue()));
137         
138         return null;
139     }
140     
141     public void ejbPostCreate(java.lang.String JavaDoc name, java.math.BigDecimal JavaDoc place, league.ejb.entity.RoundLocal roundId) {
142         // TODO populate relationships here if appropriate
143
setRoundId(roundId);
144         
145     }
146     
147     public abstract java.lang.Integer JavaDoc ejbSelectMaxId() throws javax.ejb.FinderException JavaDoc;
148     
149 }
150
Popular Tags