KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > olstore > entity > OrderBean


1 /**
2  * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA
18  *
19  * Component of: Red Hat Application Server
20  *
21  * Initial Developers: Aizaz Ahmed
22  * Vivek Lakshmanan
23  * Andrew Overholt
24  * Matthew Wringe
25  *
26  */

27 /*
28  * OrderBean.java
29  *
30  * Created on Aug 16, 2004
31  *
32  */

33 package olstore.entity;
34
35 import javax.ejb.EntityBean;
36
37 import olstore.entity.ItemLocal;
38 import olstore.entity.UserLocal;
39
40 import java.math.BigDecimal;
41
42 /**
43  * @ejb.bean name="Order"
44  * description="This bean is used to store information about an order."
45  * type="CMP"
46  * schema="olstore_order"
47  * primkey-field="orderId"
48  * reentrant="false"
49  * cmp-version="2.x"
50  * view-type="local"
51  * local-jndi-name="OrderLocal_L"
52  *
53  * @ejb.transaction
54  * type="Required"
55  *
56  *--
57  * This is needed for JOnAS.
58  * If you are not using JOnAS you can safely remove the tags below.
59  * @jonas.bean ejb-name="Order"
60  * jndi-name="OrderLocal"
61  * @jonas.jdbc-mapping jndi-name="jdbc_1" jdbc-table-name="olstore_order"
62  * automatic-pk="true"
63  * --
64  *
65  * @ejb.persistence
66  *
67  * @ejb.finder
68  * query="SELECT OBJECT(a) FROM olstore_order as a"
69  * signature="java.util.Collection findAll()"
70  *
71  * @ejb.finder
72  * query="SELECT OBJECT(a) FROM olstore_order as a WHERE NOT (a.status = ?1)"
73  * signature="java.util.Collection findByStatus(java.lang.String status)"
74  *
75  * @ejb.finder
76  * query="SELECT OBJECT(a) FROM olstore_order as a WHERE a.orderId = ?1"
77  * signature="olstore.entity.Order findByPrimaryKey(java.lang.Integer orderId)"
78  *
79  *--
80  * This is needed for JOnAS.
81  * If you are not using JOnAS you can safely remove the tags below.
82  * @jonas.finder-method-jdbc-mapping method-name="findAll"
83  * jdbc-where-clause=""
84  * @jonas.jdbc-mapping jndi-name="jdbc_1"
85  * jdbc-table-name="olstore_order"
86  *
87  *--
88  *
89  **/

90
91 public abstract class OrderBean implements EntityBean {
92     
93     /**
94      * The ejbCreate method.
95      *
96      * @ejb.create-method
97      */

98     public java.lang.Integer ejbCreate(UserLocal user, ItemLocal item, Integer quantity, String status, String dateReceived, BigDecimal pricePaid) throws javax.ejb.CreateException {
99         setQuantity (quantity);
100         setStatus (status);
101         setDateReceived (dateReceived);
102         setPricePaid (pricePaid);
103         
104         return null;
105     }
106     
107     /**
108      * The container invokes this method immediately after it calls ejbCreate.
109      *
110      */

111     public void ejbPostCreate(UserLocal user, ItemLocal item, Integer quantity, String status, String dateReceived, BigDecimal pricePaid) throws javax.ejb.CreateException {
112         setUser (user);
113         setItem(item);
114     }
115     
116     /**
117      * Returns the orderId
118      * @return the orderId
119      *
120      * @ejb.persistent-field
121      * @ejb.persistence
122      * column-name="orderId"
123      * sql-type="INTEGER"
124      * @ejb.pk-field
125      * @ejb.interface-method
126      *
127      */

128     public abstract java.lang.Integer getOrderId();
129     
130     /**
131      * Sets the orderId
132      *
133      * @param java.lang.Integer the new orderId value
134      *
135      * @ejb.interface-method
136      */

137     public abstract void setOrderId(java.lang.Integer orderId);
138     
139     /**
140      * Returns the quantity
141      * @return the quantity
142      *
143      * @ejb.persistent-field
144      * @ejb.persistence
145      * column-name="quantity"
146      * sql-type="INTEGER"
147      *
148      * @ejb.interface-method
149      *
150      */

151     public abstract java.lang.Integer getQuantity();
152     
153     /**
154      * Sets the quantity
155      *
156      * @param java.lang.Integer the new quantity value
157      *
158      * @ejb.interface-method
159      */

160     public abstract void setQuantity(java.lang.Integer quantity);
161     
162     /**
163      * Returns the status
164      * @return the status
165      *
166      * @ejb.persistent-field
167      * @ejb.persistence
168      * column-name="status"
169      * sql-type="VARCHAR"
170      *
171      * @ejb.interface-method
172      *
173      */

174     public abstract java.lang.String getStatus();
175     
176     /**
177      * Sets the status
178      *
179      * @param java.lang.String the new status value
180      *
181      * @ejb.interface-method
182      */

183     public abstract void setStatus(java.lang.String status);
184     
185     /**
186      * Returns the dateReceived
187      * @return the dateReceived
188      *
189      * @ejb.persistent-field
190      * @ejb.persistence
191      * column-name="dateReceived"
192      * sql-type="VARCHAR"
193      *
194      * @ejb.interface-method
195      *
196      */

197     public abstract java.lang.String getDateReceived();
198     
199     /**
200      * Sets the dateReceived
201      *
202      * @param java.lang.String the new dateReceived value
203      *
204      * @ejb.interface-method
205      */

206     public abstract void setDateReceived(java.lang.String dateReceived);
207     
208     /**
209      * Returns the pricePaid
210      * @return the pricePaid
211      *
212      * @ejb.persistent-field
213      * @ejb.persistence
214      * column-name="pricePaid"
215      * sql-type="NUMERIC"
216      *
217      * @ejb.interface-method
218      *
219      */

220     public abstract BigDecimal getPricePaid();
221     
222     /**
223      * Sets the pricePaid
224      *
225      * @param java.lang.Float the new pricePaid value
226      *
227      * @ejb.interface-method
228      */

229     public abstract void setPricePaid(BigDecimal pricePaid);
230     
231     /**
232      * Returns the User for this Order
233      *
234      * @return the User for this Order
235      *
236      * @ejb.relation
237      * name="User-Order"
238      * role-name="Order-has-a-User"
239      * target-ejb="User"
240      * @ejb.interface-method
241      *
242      */

243     
244     public abstract UserLocal getUser();
245     public abstract void setUser (UserLocal user);
246     
247     /**
248      * Returns the item for this Order
249      *
250      * @return the item for this Order
251      *
252      * @ejb.relation
253      * name="Order-Item"
254      * role-name="Order-has-many-Items"
255      * target-ejb="Item"
256      * target-multiple="yes"
257      *
258      * @ejb.interface-method
259      */

260     
261     public abstract ItemLocal getItem();
262     public abstract void setItem (ItemLocal user);
263     
264 }
265
Popular Tags