001: /*
002: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. U.S.
003: * Government Rights - Commercial software. Government users are subject
004: * to the Sun Microsystems, Inc. standard license agreement and
005: * applicable provisions of the FAR and its supplements. Use is subject
006: * to license terms.
007: *
008: * This distribution may include materials developed by third parties.
009: * Sun, Sun Microsystems, the Sun logo, Java and J2EE are trademarks
010: * or registered trademarks of Sun Microsystems, Inc. in the U.S. and
011: * other countries.
012: *
013: * Copyright (c) 2005 Sun Microsystems, Inc. Tous droits reserves.
014: *
015: * Droits du gouvernement americain, utilisateurs gouvernementaux - logiciel
016: * commercial. Les utilisateurs gouvernementaux sont soumis au contrat de
017: * licence standard de Sun Microsystems, Inc., ainsi qu'aux dispositions
018: * en vigueur de la FAR (Federal Acquisition Regulations) et des
019: * supplements a celles-ci. Distribue par des licences qui en
020: * restreignent l'utilisation.
021: *
022: * Cette distribution peut comprendre des composants developpes par des
023: * tierces parties. Sun, Sun Microsystems, le logo Sun, Java et J2EE
024: * sont des marques de fabrique ou des marques deposees de Sun
025: * Microsystems, Inc. aux Etats-Unis et dans d'autres pays.
026: */
027:
028: package dataregistry;
029:
030: import java.io.Serializable;
031: import java.math.BigDecimal;
032: import java.sql.Timestamp;
033: import java.util.Collection;
034: import javax.ejb.CreateException;
035: import javax.ejb.EntityBean;
036: import javax.ejb.EntityContext;
037:
038: /**
039: * This is the bean class for the PartBean enterprise bean.
040: */
041: public abstract class PartBean implements EntityBean, PartLocalBusiness {
042: private EntityContext context;
043:
044: // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click on the + sign on the left to edit the code.">
045: // TODO Consider creating Transfer Object to encapsulate data
046: // TODO Review finder methods
047: /**
048: * @see EntityBean#setEntityContext(EntityContext)
049: */
050: public void setEntityContext(EntityContext aContext) {
051: context = aContext;
052: }
053:
054: /**
055: * @see EntityBean#ejbActivate()
056: */
057: public void ejbActivate() {
058:
059: }
060:
061: /**
062: * @see EntityBean#ejbPassivate()
063: */
064: public void ejbPassivate() {
065:
066: }
067:
068: /**
069: * @see EntityBean#ejbRemove()
070: */
071: public void ejbRemove() {
072:
073: }
074:
075: /**
076: * @see EntityBean#unsetEntityContext()
077: */
078: public void unsetEntityContext() {
079: context = null;
080: }
081:
082: /**
083: * @see EntityBean#ejbLoad()
084: */
085: public void ejbLoad() {
086:
087: }
088:
089: /**
090: * @see EntityBean#ejbStore()
091: */
092: public void ejbStore() {
093:
094: }
095:
096: // </editor-fold>
097:
098: public abstract String getPartNumber();
099:
100: public abstract void setPartNumber(String partNumber);
101:
102: public abstract BigDecimal getRevision();
103:
104: public abstract void setRevision(BigDecimal revision);
105:
106: public abstract String getDescription();
107:
108: public abstract void setDescription(String description);
109:
110: public abstract Timestamp getRevisionDate();
111:
112: public abstract void setRevisionDate(Timestamp revisionDate);
113:
114: public abstract PartLocal getBomPart();
115:
116: public abstract void setBomPart(PartLocal partBean);
117:
118: public abstract Collection getPartBean1();
119:
120: public abstract void setPartBean1(Collection partBean1);
121:
122: public abstract VendorPartLocal getVendorPartBean();
123:
124: public abstract void setVendorPartBean(
125: VendorPartLocal vendorPartBean);
126:
127: public PartPK ejbCreate(String partNumber, BigDecimal revision,
128: String description, Timestamp revisionDate,
129: PartLocal partBean) throws CreateException {
130: if (partNumber == null) {
131: throw new CreateException(
132: "The field \"partNumber\" must not be null");
133: }
134: if (revision == null) {
135: throw new CreateException(
136: "The field \"revision\" must not be null");
137: }
138: if (revisionDate == null) {
139: throw new CreateException(
140: "The field \"revisionDate\" must not be null");
141: }
142: if (partBean == null) {
143: throw new CreateException(
144: "The field \"partBean\" must not be null");
145: }
146:
147: // TODO add additional validation code, throw CreateException if data is not valid
148: setPartNumber(partNumber);
149: setRevision(revision);
150: setDescription(description);
151: setRevisionDate(revisionDate);
152:
153: return null;
154: }
155:
156: public void ejbPostCreate(String partNumber, BigDecimal revision,
157: String description, Timestamp revisionDate,
158: PartLocal partBean) {
159: // TODO populate relationships here if appropriate
160: setBomPart(partBean);
161:
162: }
163:
164: public abstract Serializable getDrawing();
165:
166: public abstract void setDrawing(Serializable drawing);
167:
168: public abstract String getSpecification();
169:
170: public abstract void setSpecification(String specification);
171:
172: public PartPK ejbCreate(String partNumber, int revision,
173: String description, java.util.Date revisionDate,
174: String specification, Serializable drawing)
175: throws CreateException {
176: if (partNumber == null) {
177: throw new CreateException(
178: "The field \"partNumber\" must not be null");
179: }
180: if (revisionDate == null) {
181: throw new CreateException(
182: "The field \"revisionDate\" must not be null");
183: }
184:
185: // TODO add additional validation code, throw CreateException if data is not valid
186: setPartNumber(partNumber);
187: setRevision(new BigDecimal(revision));
188: setDescription(description);
189: setRevisionDate(new Timestamp(revisionDate.getTime()));
190: setSpecification(specification);
191: setDrawing(drawing);
192:
193: return null;
194: }
195:
196: public void ejbPostCreate(String partNumber, int revision,
197: String description, java.util.Date revisionDate,
198: String specification, Serializable drawing)
199: throws CreateException {
200: //TODO implement ejbPostCreate
201: }
202: }
|