KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cmp2 > commerce > OrderBean


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.cmp2.commerce;
23
24 import java.util.Collection JavaDoc;
25 import java.util.Set JavaDoc;
26 import javax.ejb.CreateException JavaDoc;
27 import javax.ejb.EntityBean JavaDoc;
28 import javax.ejb.EntityContext JavaDoc;
29 import javax.ejb.FinderException JavaDoc;
30
31 import org.jboss.varia.autonumber.AutoNumberFactory;
32
33 public abstract class OrderBean implements EntityBean JavaDoc {
34    transient private EntityContext JavaDoc ctx;
35
36    public Long JavaDoc ejbCreate() throws CreateException JavaDoc {
37       setOrdernumber(new Long JavaDoc(AutoNumberFactory.getNextInteger("Order").longValue()));
38       return null;
39    }
40
41    public void ejbPostCreate() {
42    }
43
44    public Long JavaDoc ejbCreate(Long JavaDoc id) throws CreateException JavaDoc {
45       setOrdernumber(id);
46       return null;
47    }
48
49    public void ejbPostCreate(Long JavaDoc id) {
50    }
51
52    public abstract Long JavaDoc getOrdernumber();
53    public abstract void setOrdernumber(Long JavaDoc ordernumber);
54    
55    public abstract Card getCreditCard();
56    public abstract void setCreditCard(Card card);
57    
58    public abstract String JavaDoc getOrderStatus();
59    public abstract void setOrderStatus(String JavaDoc orderStatus);
60
61    public abstract Customer getCustomer();
62    public abstract void setCustomer(Customer c);
63
64    public abstract Collection JavaDoc getLineItems();
65    public abstract void setLineItems(Collection JavaDoc lineItems);
66    
67    public abstract Address getShippingAddress();
68    public abstract void setShippingAddress(Address shippingAddress);
69    
70    public abstract Address getBillingAddress();
71    public abstract void setBillingAddress(Address billingAddress);
72
73    public abstract Set JavaDoc ejbSelectOrdersShippedToCA() throws FinderException JavaDoc;
74    public abstract Set JavaDoc ejbSelectOrdersShippedToCA2() throws FinderException JavaDoc;
75    
76    public abstract Collection JavaDoc ejbSelectOrderShipToStates()
77          throws FinderException JavaDoc;
78    public abstract Collection JavaDoc ejbSelectOrderShipToStates2()
79          throws FinderException JavaDoc;
80
81    public abstract Set JavaDoc ejbSelectAddressesInCA() throws FinderException JavaDoc;
82    public abstract Set JavaDoc ejbSelectAddressesInCA2() throws FinderException JavaDoc;
83
84    public Set JavaDoc getOrdersShippedToCA() throws FinderException JavaDoc {
85       return ejbSelectOrdersShippedToCA();
86    }
87    
88    public Set JavaDoc getOrdersShippedToCA2() throws FinderException JavaDoc {
89       return ejbSelectOrdersShippedToCA2();
90    }
91    
92    public Collection JavaDoc getStatesShipedTo() throws FinderException JavaDoc {
93       return ejbSelectOrderShipToStates();
94    }
95    
96    public Collection JavaDoc getStatesShipedTo2() throws FinderException JavaDoc {
97       return ejbSelectOrderShipToStates2();
98    }
99    
100    public Set JavaDoc getAddressesInCA() throws FinderException JavaDoc {
101       return ejbSelectAddressesInCA();
102    }
103    
104    public Set JavaDoc getAddressesInCA2() throws FinderException JavaDoc {
105       return ejbSelectAddressesInCA2();
106    }
107
108    public Set JavaDoc ejbHomeGetStuff(String JavaDoc jbossQl, Object JavaDoc[] arguments)
109          throws FinderException JavaDoc {
110       return ejbSelectGeneric(jbossQl, arguments);
111    }
112
113    public Set JavaDoc ejbHomeSelectLazy(String JavaDoc jbossQl, Object JavaDoc[] arguments)
114          throws FinderException JavaDoc {
115       return ejbSelectLazy(jbossQl, arguments);
116    }
117
118    public abstract Set JavaDoc ejbSelectGeneric(String JavaDoc jbossQl, Object JavaDoc[] arguments)
119          throws FinderException JavaDoc;
120
121    public abstract Set JavaDoc ejbSelectLazy(String JavaDoc jbossQl, Object JavaDoc[] arguments)
122          throws FinderException JavaDoc;
123
124    public void setEntityContext(EntityContext JavaDoc ctx) { this.ctx = ctx; }
125    public void unsetEntityContext() { this.ctx = null; }
126    public void ejbActivate() { }
127    public void ejbPassivate() { }
128    public void ejbLoad() { }
129    public void ejbStore() { }
130    public void ejbRemove() { }
131 }
132
Popular Tags