KickJava   Java API By Example, From Geeks To Geeks.

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


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

10 public abstract class LeagueBean implements javax.ejb.EntityBean JavaDoc, league.ejb.entity.LeagueLocalBusiness {
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.lang.String JavaDoc getNote();
75     public abstract void setNote(java.lang.String JavaDoc note);
76     
77     public abstract java.sql.Timestamp JavaDoc getStartDate();
78     public abstract void setStartDate(java.sql.Timestamp JavaDoc startDate);
79     
80     public abstract java.sql.Timestamp JavaDoc getEndDate();
81     public abstract void setEndDate(java.sql.Timestamp JavaDoc endDate);
82     
83     public abstract java.util.Collection JavaDoc getRound();
84     public abstract void setRound(java.util.Collection JavaDoc round);
85     
86     // </editor-fold>
87

88     public java.math.BigDecimal JavaDoc ejbCreate(java.math.BigDecimal JavaDoc id, java.lang.String JavaDoc name, java.lang.String JavaDoc note, java.sql.Timestamp JavaDoc startDate, java.sql.Timestamp JavaDoc endDate) throws javax.ejb.CreateException JavaDoc {
89         if (id == null) {
90             throw new javax.ejb.CreateException JavaDoc("The field \"id\" must not be null");
91         }
92         if (name == null) {
93             throw new javax.ejb.CreateException JavaDoc("The field \"name\" must not be null");
94         }
95         if (startDate == null) {
96             throw new javax.ejb.CreateException JavaDoc("The field \"startDate\" must not be null");
97         }
98         if (endDate == null) {
99             throw new javax.ejb.CreateException JavaDoc("The field \"endDate\" must not be null");
100         }
101         
102         // TODO add additional validation code, throw CreateException if data is not valid
103
setId(id);
104         setName(name);
105         setNote(note);
106         setStartDate(startDate);
107         setEndDate(endDate);
108         
109         return null;
110     }
111     
112     public void ejbPostCreate(java.math.BigDecimal JavaDoc id, java.lang.String JavaDoc name, java.lang.String JavaDoc note, java.sql.Timestamp JavaDoc startDate, java.sql.Timestamp JavaDoc endDate) {
113         // TODO populate relationships here if appropriate
114

115     }
116     
117     public java.math.BigDecimal JavaDoc ejbCreate(java.lang.String JavaDoc name, java.util.Date JavaDoc startDate, java.util.Date JavaDoc endDate, java.lang.String JavaDoc note) throws javax.ejb.CreateException JavaDoc {
118         //TODO implement ejbCreate
119
int id=0;
120         try {
121             Integer JavaDoc maxId=ejbSelectMaxId();
122             
123             if (maxId!=null) id=maxId.intValue()+1;
124         } catch (javax.ejb.FinderException JavaDoc e) {
125             throw new javax.ejb.CreateException JavaDoc();
126         }
127         setId(new java.math.BigDecimal JavaDoc(id));
128         setName(name);
129         setNote(note);
130         setStartDate(new java.sql.Timestamp JavaDoc(startDate.getTime()));
131         setEndDate(new java.sql.Timestamp JavaDoc(endDate.getTime()));
132         return null;
133     }
134     
135     public void ejbPostCreate(java.lang.String JavaDoc name, java.util.Date JavaDoc startDate, java.util.Date JavaDoc endDate, java.lang.String JavaDoc note) throws javax.ejb.CreateException JavaDoc {
136         //TODO implement ejbPostCreate
137
}
138     
139     public abstract java.lang.Integer JavaDoc ejbSelectMaxId() throws javax.ejb.FinderException JavaDoc;
140
141     public abstract java.util.Collection JavaDoc getTeams();
142
143     public abstract void setTeams(java.util.Collection JavaDoc teams);
144
145 }
146
Popular Tags