KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibatis > jpetstore > domain > Order


1 package com.ibatis.jpetstore.domain;
2
3 import java.io.Serializable JavaDoc;
4 import java.math.BigDecimal JavaDoc;
5 import java.util.ArrayList JavaDoc;
6 import java.util.Date JavaDoc;
7 import java.util.Iterator JavaDoc;
8 import java.util.List JavaDoc;
9
10
11 public class Order implements Serializable JavaDoc {
12
13   /* Private Fields */
14
15   private int orderId;
16   private String JavaDoc username;
17   private Date JavaDoc orderDate;
18   private String JavaDoc shipAddress1;
19   private String JavaDoc shipAddress2;
20   private String JavaDoc shipCity;
21   private String JavaDoc shipState;
22   private String JavaDoc shipZip;
23   private String JavaDoc shipCountry;
24   private String JavaDoc billAddress1;
25   private String JavaDoc billAddress2;
26   private String JavaDoc billCity;
27   private String JavaDoc billState;
28   private String JavaDoc billZip;
29   private String JavaDoc billCountry;
30   private String JavaDoc courier;
31   private BigDecimal JavaDoc totalPrice;
32   private String JavaDoc billToFirstName;
33   private String JavaDoc billToLastName;
34   private String JavaDoc shipToFirstName;
35   private String JavaDoc shipToLastName;
36   private String JavaDoc creditCard;
37   private String JavaDoc expiryDate;
38   private String JavaDoc cardType;
39   private String JavaDoc locale;
40   private String JavaDoc status;
41   private List JavaDoc lineItems = new ArrayList JavaDoc();
42
43   /* JavaBeans Properties */
44
45   public int getOrderId() {
46     return orderId;
47   }
48
49   public void setOrderId(int orderId) {
50     this.orderId = orderId;
51   }
52
53   public String JavaDoc getUsername() {
54     return username;
55   }
56
57   public void setUsername(String JavaDoc username) {
58     this.username = username;
59   }
60
61   public Date JavaDoc getOrderDate() {
62     return orderDate;
63   }
64
65   public void setOrderDate(Date JavaDoc orderDate) {
66     this.orderDate = orderDate;
67   }
68
69   public String JavaDoc getShipAddress1() {
70     return shipAddress1;
71   }
72
73   public void setShipAddress1(String JavaDoc shipAddress1) {
74     this.shipAddress1 = shipAddress1;
75   }
76
77   public String JavaDoc getShipAddress2() {
78     return shipAddress2;
79   }
80
81   public void setShipAddress2(String JavaDoc shipAddress2) {
82     this.shipAddress2 = shipAddress2;
83   }
84
85   public String JavaDoc getShipCity() {
86     return shipCity;
87   }
88
89   public void setShipCity(String JavaDoc shipCity) {
90     this.shipCity = shipCity;
91   }
92
93   public String JavaDoc getShipState() {
94     return shipState;
95   }
96
97   public void setShipState(String JavaDoc shipState) {
98     this.shipState = shipState;
99   }
100
101   public String JavaDoc getShipZip() {
102     return shipZip;
103   }
104
105   public void setShipZip(String JavaDoc shipZip) {
106     this.shipZip = shipZip;
107   }
108
109   public String JavaDoc getShipCountry() {
110     return shipCountry;
111   }
112
113   public void setShipCountry(String JavaDoc shipCountry) {
114     this.shipCountry = shipCountry;
115   }
116
117   public String JavaDoc getBillAddress1() {
118     return billAddress1;
119   }
120
121   public void setBillAddress1(String JavaDoc billAddress1) {
122     this.billAddress1 = billAddress1;
123   }
124
125   public String JavaDoc getBillAddress2() {
126     return billAddress2;
127   }
128
129   public void setBillAddress2(String JavaDoc billAddress2) {
130     this.billAddress2 = billAddress2;
131   }
132
133   public String JavaDoc getBillCity() {
134     return billCity;
135   }
136
137   public void setBillCity(String JavaDoc billCity) {
138     this.billCity = billCity;
139   }
140
141   public String JavaDoc getBillState() {
142     return billState;
143   }
144
145   public void setBillState(String JavaDoc billState) {
146     this.billState = billState;
147   }
148
149   public String JavaDoc getBillZip() {
150     return billZip;
151   }
152
153   public void setBillZip(String JavaDoc billZip) {
154     this.billZip = billZip;
155   }
156
157   public String JavaDoc getBillCountry() {
158     return billCountry;
159   }
160
161   public void setBillCountry(String JavaDoc billCountry) {
162     this.billCountry = billCountry;
163   }
164
165   public String JavaDoc getCourier() {
166     return courier;
167   }
168
169   public void setCourier(String JavaDoc courier) {
170     this.courier = courier;
171   }
172
173   public BigDecimal JavaDoc getTotalPrice() {
174     return totalPrice;
175   }
176
177   public void setTotalPrice(BigDecimal JavaDoc totalPrice) {
178     this.totalPrice = totalPrice;
179   }
180
181   public String JavaDoc getBillToFirstName() {
182     return billToFirstName;
183   }
184
185   public void setBillToFirstName(String JavaDoc billToFirstName) {
186     this.billToFirstName = billToFirstName;
187   }
188
189   public String JavaDoc getBillToLastName() {
190     return billToLastName;
191   }
192
193   public void setBillToLastName(String JavaDoc billToLastName) {
194     this.billToLastName = billToLastName;
195   }
196
197   public String JavaDoc getShipToFirstName() {
198     return shipToFirstName;
199   }
200
201   public void setShipToFirstName(String JavaDoc shipFoFirstName) {
202     this.shipToFirstName = shipFoFirstName;
203   }
204
205   public String JavaDoc getShipToLastName() {
206     return shipToLastName;
207   }
208
209   public void setShipToLastName(String JavaDoc shipToLastName) {
210     this.shipToLastName = shipToLastName;
211   }
212
213   public String JavaDoc getCreditCard() {
214     return creditCard;
215   }
216
217   public void setCreditCard(String JavaDoc creditCard) {
218     this.creditCard = creditCard;
219   }
220
221   public String JavaDoc getExpiryDate() {
222     return expiryDate;
223   }
224
225   public void setExpiryDate(String JavaDoc expiryDate) {
226     this.expiryDate = expiryDate;
227   }
228
229   public String JavaDoc getCardType() {
230     return cardType;
231   }
232
233   public void setCardType(String JavaDoc cardType) {
234     this.cardType = cardType;
235   }
236
237   public String JavaDoc getLocale() {
238     return locale;
239   }
240
241   public void setLocale(String JavaDoc locale) {
242     this.locale = locale;
243   }
244
245   public String JavaDoc getStatus() {
246     return status;
247   }
248
249   public void setStatus(String JavaDoc status) {
250     this.status = status;
251   }
252
253   public void setLineItems(List JavaDoc lineItems) {
254     this.lineItems = lineItems;
255   }
256
257   public List JavaDoc getLineItems() {
258     return lineItems;
259   }
260
261   /* Public Methods */
262
263   public void initOrder(Account account, Cart cart) {
264
265     username = account.getUsername();
266     orderDate = new Date JavaDoc();
267
268     shipToFirstName = account.getFirstName();
269     shipToLastName = account.getLastName();
270     shipAddress1 = account.getAddress1();
271     shipAddress2 = account.getAddress2();
272     shipCity = account.getCity();
273     shipState = account.getState();
274     shipZip = account.getZip();
275     shipCountry = account.getCountry();
276
277     billToFirstName = account.getFirstName();
278     billToLastName = account.getLastName();
279     billAddress1 = account.getAddress1();
280     billAddress2 = account.getAddress2();
281     billCity = account.getCity();
282     billState = account.getState();
283     billZip = account.getZip();
284     billCountry = account.getCountry();
285
286     totalPrice = cart.getSubTotal();
287
288     creditCard = "999 9999 9999 9999";
289     expiryDate = "12/03";
290     cardType = "Visa";
291     courier = "UPS";
292     locale = "CA";
293     status = "P";
294
295
296     Iterator JavaDoc i = cart.getAllCartItems();
297     while (i.hasNext()) {
298       CartItem cartItem = (CartItem) i.next();
299       addLineItem(cartItem);
300     }
301
302   }
303
304   public void addLineItem(CartItem cartItem) {
305     LineItem lineItem = new LineItem(lineItems.size() + 1, cartItem);
306     addLineItem(lineItem);
307   }
308
309   public void addLineItem(LineItem lineItem) {
310     lineItems.add(lineItem);
311   }
312
313
314 }
315
Popular Tags