KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > dataregistry > PartBean


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
30 import java.io.Serializable JavaDoc;
31 import java.math.BigDecimal JavaDoc;
32 import java.sql.Timestamp JavaDoc;
33 import java.util.Collection JavaDoc;
34 import javax.ejb.CreateException JavaDoc;
35 import javax.ejb.EntityBean JavaDoc;
36 import javax.ejb.EntityContext JavaDoc;
37
38 /**
39  * This is the bean class for the PartBean enterprise bean.
40  */

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

50     public void setEntityContext(EntityContext JavaDoc aContext) {
51         context = aContext;
52     }
53     
54     /**
55      * @see EntityBean#ejbActivate()
56      */

57     public void ejbActivate() {
58         
59     }
60     
61     /**
62      * @see EntityBean#ejbPassivate()
63      */

64     public void ejbPassivate() {
65         
66     }
67     
68     /**
69      * @see EntityBean#ejbRemove()
70      */

71     public void ejbRemove() {
72         
73     }
74     
75     /**
76      * @see EntityBean#unsetEntityContext()
77      */

78     public void unsetEntityContext() {
79         context = null;
80     }
81     
82     /**
83      * @see EntityBean#ejbLoad()
84      */

85     public void ejbLoad() {
86         
87     }
88     
89     /**
90      * @see EntityBean#ejbStore()
91      */

92     public void ejbStore() {
93         
94     }
95     // </editor-fold>
96

97     
98     public abstract String JavaDoc getPartNumber();
99     public abstract void setPartNumber(String JavaDoc partNumber);
100     
101     public abstract BigDecimal JavaDoc getRevision();
102     public abstract void setRevision(BigDecimal JavaDoc revision);
103     
104     public abstract String JavaDoc getDescription();
105     public abstract void setDescription(String JavaDoc description);
106     
107     public abstract Timestamp JavaDoc getRevisionDate();
108     public abstract void setRevisionDate(Timestamp JavaDoc revisionDate);
109     
110     public abstract PartLocal getBomPart();
111     public abstract void setBomPart(PartLocal partBean);
112     
113     public abstract Collection JavaDoc getPartBean1();
114     public abstract void setPartBean1(Collection JavaDoc partBean1);
115     
116     public abstract VendorPartLocal getVendorPartBean();
117     public abstract void setVendorPartBean(VendorPartLocal vendorPartBean);
118     
119     
120     public PartPK ejbCreate(String JavaDoc partNumber, BigDecimal JavaDoc revision, String JavaDoc description, Timestamp JavaDoc revisionDate, PartLocal partBean) throws CreateException JavaDoc {
121         if (partNumber == null) {
122             throw new CreateException JavaDoc("The field \"partNumber\" must not be null");
123         }
124         if (revision == null) {
125             throw new CreateException JavaDoc("The field \"revision\" must not be null");
126         }
127         if (revisionDate == null) {
128             throw new CreateException JavaDoc("The field \"revisionDate\" must not be null");
129         }
130         if (partBean == null) {
131             throw new CreateException JavaDoc("The field \"partBean\" must not be null");
132         }
133         
134         // TODO add additional validation code, throw CreateException if data is not valid
135
setPartNumber(partNumber);
136         setRevision(revision);
137         setDescription(description);
138         setRevisionDate(revisionDate);
139         
140         return null;
141     }
142     
143     public void ejbPostCreate(String JavaDoc partNumber, BigDecimal JavaDoc revision, String JavaDoc description, Timestamp JavaDoc revisionDate, PartLocal partBean) {
144         // TODO populate relationships here if appropriate
145
setBomPart(partBean);
146         
147     }
148     
149     
150
151     public abstract Serializable JavaDoc getDrawing();
152
153     public abstract void setDrawing(Serializable JavaDoc drawing);
154
155     public abstract String JavaDoc getSpecification();
156
157     public abstract void setSpecification(String JavaDoc specification);
158
159     public PartPK ejbCreate(String JavaDoc partNumber, int revision, String JavaDoc description, java.util.Date JavaDoc revisionDate, String JavaDoc specification, Serializable JavaDoc drawing) throws CreateException JavaDoc {
160         if (partNumber == null) {
161             throw new CreateException JavaDoc("The field \"partNumber\" must not be null");
162         }
163         if (revisionDate == null) {
164             throw new CreateException JavaDoc("The field \"revisionDate\" must not be null");
165         }
166
167         
168         // TODO add additional validation code, throw CreateException if data is not valid
169
setPartNumber(partNumber);
170         setRevision(new BigDecimal JavaDoc(revision));
171         setDescription(description);
172         setRevisionDate(new Timestamp JavaDoc(revisionDate.getTime()));
173         setSpecification(specification);
174         setDrawing(drawing);
175         
176         return null;
177     }
178
179     public void ejbPostCreate(String JavaDoc partNumber, int revision, String JavaDoc description, java.util.Date JavaDoc revisionDate, String JavaDoc specification, Serializable JavaDoc drawing) throws CreateException JavaDoc {
180         //TODO implement ejbPostCreate
181
}
182 }
183
Popular Tags