KickJava   Java API By Example, From Geeks To Geeks.

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


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

10 public abstract class RoundBean implements javax.ejb.EntityBean JavaDoc, league.ejb.entity.RoundLocalBusiness {
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.sql.Timestamp JavaDoc getStartDate();
75     public abstract void setStartDate(java.sql.Timestamp JavaDoc startDate);
76     
77     public abstract java.util.Collection JavaDoc getGroups();
78     public abstract void setGroups(java.util.Collection JavaDoc groups);
79     
80     public abstract league.ejb.entity.LeagueLocal getLeagueId();
81     public abstract void setLeagueId(league.ejb.entity.LeagueLocal leagueId);
82     
83     // </editor-fold>
84

85     public java.math.BigDecimal JavaDoc ejbCreate(java.math.BigDecimal JavaDoc id, java.lang.String JavaDoc name, java.sql.Timestamp JavaDoc startDate, league.ejb.entity.LeagueLocal leagueId) 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 (startDate == null) {
93             throw new javax.ejb.CreateException JavaDoc("The field \"startDate\" must not be null");
94         }
95         if (leagueId == null) {
96             throw new javax.ejb.CreateException JavaDoc("The field \"leagueId\" 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         setStartDate(startDate);
103         
104         return null;
105     }
106     
107     public void ejbPostCreate(java.math.BigDecimal JavaDoc id, java.lang.String JavaDoc name, java.sql.Timestamp JavaDoc startDate, league.ejb.entity.LeagueLocal leagueId) {
108         // TODO populate relationships here if appropriate
109
setLeagueId(leagueId);
110         
111     }
112
113     public abstract java.lang.Integer JavaDoc ejbSelectMaxId() throws javax.ejb.FinderException JavaDoc;
114
115     public java.math.BigDecimal JavaDoc ejbCreate(java.lang.String JavaDoc name, java.sql.Timestamp JavaDoc startDate, league.ejb.entity.LeagueLocal league) throws javax.ejb.CreateException JavaDoc {
116         int id=0;
117         try {
118             Integer JavaDoc maxId=ejbSelectMaxId();
119             
120             if (maxId!=null) id=maxId.intValue()+1;
121         } catch (javax.ejb.FinderException JavaDoc e) {
122             throw new javax.ejb.CreateException JavaDoc();
123         }
124         java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"round new id: "+String.valueOf(id));
125         setId(new java.math.BigDecimal JavaDoc(id));
126         setName(name);
127         setStartDate(startDate);
128         
129         return null;
130     }
131
132     public void ejbPostCreate(java.lang.String JavaDoc name, java.sql.Timestamp JavaDoc startDate, league.ejb.entity.LeagueLocal league) throws javax.ejb.CreateException JavaDoc {
133         setLeagueId(league);
134     }
135
136     public abstract java.sql.Timestamp JavaDoc ejbSelectMaxStartDate() throws javax.ejb.FinderException JavaDoc;
137
138    
139
140     public java.util.Date JavaDoc ejbHomeGetLastStartDate() {
141         try {
142             return ejbSelectMaxStartDate();
143         } catch (javax.ejb.FinderException JavaDoc e) {
144             return null;
145         }
146     }
147
148     public abstract java.util.Collection JavaDoc getMatches();
149
150     public abstract void setMatches(java.util.Collection JavaDoc matches);
151 }
152
Popular Tags