1 package com.ibatis.jpetstore.domain; 2 3 import java.io.Serializable ; 4 import java.math.BigDecimal ; 5 import java.util.ArrayList ; 6 import java.util.Date ; 7 import java.util.Iterator ; 8 import java.util.List ; 9 10 11 public class Order implements Serializable { 12 13 14 15 private int orderId; 16 private String username; 17 private Date orderDate; 18 private String shipAddress1; 19 private String shipAddress2; 20 private String shipCity; 21 private String shipState; 22 private String shipZip; 23 private String shipCountry; 24 private String billAddress1; 25 private String billAddress2; 26 private String billCity; 27 private String billState; 28 private String billZip; 29 private String billCountry; 30 private String courier; 31 private BigDecimal totalPrice; 32 private String billToFirstName; 33 private String billToLastName; 34 private String shipToFirstName; 35 private String shipToLastName; 36 private String creditCard; 37 private String expiryDate; 38 private String cardType; 39 private String locale; 40 private String status; 41 private List lineItems = new ArrayList (); 42 43 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 getUsername() { 54 return username; 55 } 56 57 public void setUsername(String username) { 58 this.username = username; 59 } 60 61 public Date getOrderDate() { 62 return orderDate; 63 } 64 65 public void setOrderDate(Date orderDate) { 66 this.orderDate = orderDate; 67 } 68 69 public String getShipAddress1() { 70 return shipAddress1; 71 } 72 73 public void setShipAddress1(String shipAddress1) { 74 this.shipAddress1 = shipAddress1; 75 } 76 77 public String getShipAddress2() { 78 return shipAddress2; 79 } 80 81 public void setShipAddress2(String shipAddress2) { 82 this.shipAddress2 = shipAddress2; 83 } 84 85 public String getShipCity() { 86 return shipCity; 87 } 88 89 public void setShipCity(String shipCity) { 90 this.shipCity = shipCity; 91 } 92 93 public String getShipState() { 94 return shipState; 95 } 96 97 public void setShipState(String shipState) { 98 this.shipState = shipState; 99 } 100 101 public String getShipZip() { 102 return shipZip; 103 } 104 105 public void setShipZip(String shipZip) { 106 this.shipZip = shipZip; 107 } 108 109 public String getShipCountry() { 110 return shipCountry; 111 } 112 113 public void setShipCountry(String shipCountry) { 114 this.shipCountry = shipCountry; 115 } 116 117 public String getBillAddress1() { 118 return billAddress1; 119 } 120 121 public void setBillAddress1(String billAddress1) { 122 this.billAddress1 = billAddress1; 123 } 124 125 public String getBillAddress2() { 126 return billAddress2; 127 } 128 129 public void setBillAddress2(String billAddress2) { 130 this.billAddress2 = billAddress2; 131 } 132 133 public String getBillCity() { 134 return billCity; 135 } 136 137 public void setBillCity(String billCity) { 138 this.billCity = billCity; 139 } 140 141 public String getBillState() { 142 return billState; 143 } 144 145 public void setBillState(String billState) { 146 this.billState = billState; 147 } 148 149 public String getBillZip() { 150 return billZip; 151 } 152 153 public void setBillZip(String billZip) { 154 this.billZip = billZip; 155 } 156 157 public String getBillCountry() { 158 return billCountry; 159 } 160 161 public void setBillCountry(String billCountry) { 162 this.billCountry = billCountry; 163 } 164 165 public String getCourier() { 166 return courier; 167 } 168 169 public void setCourier(String courier) { 170 this.courier = courier; 171 } 172 173 public BigDecimal getTotalPrice() { 174 return totalPrice; 175 } 176 177 public void setTotalPrice(BigDecimal totalPrice) { 178 this.totalPrice = totalPrice; 179 } 180 181 public String getBillToFirstName() { 182 return billToFirstName; 183 } 184 185 public void setBillToFirstName(String billToFirstName) { 186 this.billToFirstName = billToFirstName; 187 } 188 189 public String getBillToLastName() { 190 return billToLastName; 191 } 192 193 public void setBillToLastName(String billToLastName) { 194 this.billToLastName = billToLastName; 195 } 196 197 public String getShipToFirstName() { 198 return shipToFirstName; 199 } 200 201 public void setShipToFirstName(String shipFoFirstName) { 202 this.shipToFirstName = shipFoFirstName; 203 } 204 205 public String getShipToLastName() { 206 return shipToLastName; 207 } 208 209 public void setShipToLastName(String shipToLastName) { 210 this.shipToLastName = shipToLastName; 211 } 212 213 public String getCreditCard() { 214 return creditCard; 215 } 216 217 public void setCreditCard(String creditCard) { 218 this.creditCard = creditCard; 219 } 220 221 public String getExpiryDate() { 222 return expiryDate; 223 } 224 225 public void setExpiryDate(String expiryDate) { 226 this.expiryDate = expiryDate; 227 } 228 229 public String getCardType() { 230 return cardType; 231 } 232 233 public void setCardType(String cardType) { 234 this.cardType = cardType; 235 } 236 237 public String getLocale() { 238 return locale; 239 } 240 241 public void setLocale(String locale) { 242 this.locale = locale; 243 } 244 245 public String getStatus() { 246 return status; 247 } 248 249 public void setStatus(String status) { 250 this.status = status; 251 } 252 253 public void setLineItems(List lineItems) { 254 this.lineItems = lineItems; 255 } 256 257 public List getLineItems() { 258 return lineItems; 259 } 260 261 262 263 public void initOrder(Account account, Cart cart) { 264 265 username = account.getUsername(); 266 orderDate = new Date (); 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 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 |