KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > dataregistry > LineItemBean


1 /*
2  * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. U.S.
3  * Government Rights - Commercial software. Government users are subject
4  * to the Sun Microsystems, Inc. standard license agreement and
5  * applicable provisions of the FAR and its supplements. Use is subject
6  * to license terms.
7  *
8  * This distribution may include materials developed by third parties.
9  * Sun, Sun Microsystems, the Sun logo, Java and J2EE are trademarks
10  * or registered trademarks of Sun Microsystems, Inc. in the U.S. and
11  * other countries.
12  *
13  * Copyright (c) 2005 Sun Microsystems, Inc. Tous droits reserves.
14  *
15  * Droits du gouvernement americain, utilisateurs gouvernementaux - logiciel
16  * commercial. Les utilisateurs gouvernementaux sont soumis au contrat de
17  * licence standard de Sun Microsystems, Inc., ainsi qu'aux dispositions
18  * en vigueur de la FAR (Federal Acquisition Regulations) et des
19  * supplements a celles-ci. Distribue par des licences qui en
20  * restreignent l'utilisation.
21  *
22  * Cette distribution peut comprendre des composants developpes par des
23  * tierces parties. Sun, Sun Microsystems, le logo Sun, Java et J2EE
24  * sont des marques de fabrique ou des marques deposees de Sun
25  * Microsystems, Inc. aux Etats-Unis et dans d'autres pays.
26  */

27
28 package dataregistry;
29 import java.math.BigDecimal JavaDoc;
30 import java.util.logging.Level JavaDoc;
31 import java.util.logging.Logger JavaDoc;
32 import javax.ejb.*;
33
34 /**
35  * This is the bean class for the LineitemBean enterprise bean.
36  */

37 public abstract class LineItemBean implements EntityBean, LineItemLocalBusiness {
38     private EntityContext context;
39     
40     // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click on the + sign on the left to edit the code.">
41
// TODO Consider creating Transfer Object to encapsulate data
42
// TODO Review finder methods
43
/**
44      * @see EntityBean#setEntityContext(EntityContext)
45      */

46     public void setEntityContext(EntityContext aContext) {
47         context = aContext;
48     }
49     
50     /**
51      * @see EntityBean#ejbActivate()
52      */

53     public void ejbActivate() {
54         
55     }
56     
57     /**
58      * @see EntityBean#ejbPassivate()
59      */

60     public void ejbPassivate() {
61         
62     }
63     
64     /**
65      * @see EntityBean#ejbRemove()
66      */

67     public void ejbRemove() {
68         
69     }
70     
71     /**
72      * @see EntityBean#unsetEntityContext()
73      */

74     public void unsetEntityContext() {
75         context = null;
76     }
77     
78     /**
79      * @see EntityBean#ejbLoad()
80      */

81     public void ejbLoad() {
82         
83     }
84     
85     /**
86      * @see EntityBean#ejbStore()
87      */

88     public void ejbStore() {
89         
90     }
91     // </editor-fold>
92

93     
94     public abstract Integer JavaDoc getOrderId();
95     public abstract void setOrderId(Integer JavaDoc orderId);
96     
97     public abstract BigDecimal JavaDoc getItemId();
98     public abstract void setItemId(BigDecimal JavaDoc itemId);
99     
100     public abstract BigDecimal JavaDoc getQuantity();
101     public abstract void setQuantity(BigDecimal JavaDoc quantity);
102     
103     public abstract VendorPartLocal getVendorPartNumber();
104     public abstract void setVendorPartNumber(VendorPartLocal vendorPartNumber);
105     
106     
107     public LineItemPK ejbCreate(Integer JavaDoc orderId, BigDecimal JavaDoc itemId,
108             BigDecimal JavaDoc quantity, OrderLocal ordersBean,
109             VendorPartLocal vendorPartNumber) throws CreateException {
110         if (orderId == null) {
111             throw new CreateException("The field \"orderId\" must not be null");
112         }
113         if (itemId == null) {
114             throw new CreateException("The field \"itemId\" must not be null");
115         }
116         if (quantity == null) {
117             throw new CreateException("The field \"quantity\" must not be null");
118         }
119         if (ordersBean == null) {
120             throw new CreateException("The field \"ordersBean\" must not be null");
121         }
122         if (vendorPartNumber == null) {
123             throw new CreateException("The field \"vendorPartNumber\" must not be null");
124         }
125         
126         // TODO add additional validation code, throw CreateException if data is not valid
127
setOrderId(orderId);
128         setItemId(itemId);
129         setQuantity(quantity);
130         
131         return null;
132     }
133     
134     public void ejbPostCreate(Integer JavaDoc orderId, BigDecimal JavaDoc itemId, BigDecimal JavaDoc quantity, OrderLocal ordersBean, VendorPartLocal vendorPartNumber) {
135         // TODO populate relationships here if appropriate
136
setOrderBean(ordersBean);
137         setVendorPartNumber(vendorPartNumber);
138         
139     }
140     
141     public LineItemPK ejbCreate(OrderLocal ordersBean, BigDecimal JavaDoc quantity, VendorPartLocal vendorPartNumber) throws CreateException {
142         //TODO implement ejbCreate
143
if (quantity == null) {
144             throw new CreateException("The field \"quantity\" must not be null");
145         }
146         if (ordersBean == null) {
147             throw new CreateException("The field \"ordersBean\" must not be null");
148         }
149         if (vendorPartNumber == null) {
150             throw new CreateException("The field \"vendorPartNumber\" must not be null");
151         }
152         setOrderId(ordersBean.getOrderId());
153         setItemId(new BigDecimal JavaDoc(ordersBean.getNexId()));
154         setQuantity(quantity);
155
156         return null;
157     }
158     
159     public void ejbPostCreate(OrderLocal ordersBean, BigDecimal JavaDoc quantity, VendorPartLocal vendorPartNumber) throws CreateException {
160         //TODO implement ejbPostCreate
161
setOrderBean(ordersBean);
162         setVendorPartNumber(vendorPartNumber);
163     }
164
165     public abstract dataregistry.OrderLocal getOrderBean();
166
167     public abstract void setOrderBean(dataregistry.OrderLocal orderBean);
168
169 }
170
Popular Tags