01: /**
02: * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17: * USA
18: *
19: * Component of: Red Hat Application Server
20: *
21: * Initial Developers: Aizaz Ahmed
22: * Vivek Lakshmanan
23: * Andrew Overholt
24: * Matthew Wringe
25: *
26: */package olstore.dto;
27:
28: import java.io.Serializable;
29: import java.math.BigDecimal;
30:
31: import olstore.entity.ItemLocal;
32:
33: public class ShoppingCartItem implements Serializable {
34: private Integer itemId;
35: private String name;
36: private BigDecimal price;
37: private BigDecimal unitPrice;
38: // Should have been float, however, illegal input like strings in quantity
39: // text box result in the interpretation of such input as 0 and that has
40: // special meaning for the checkout system
41: // (suggests removal of the item) so in order to avoid such awkwardness
42: // quantity was converted to being a String.
43: private String quantity;
44:
45: public ShoppingCartItem() {
46: itemId = null;
47: name = null;
48: price = null;
49: quantity = null;
50: }
51:
52: public ShoppingCartItem(ItemLocal item) {
53: itemId = item.getItemId();
54: name = item.getName();
55: unitPrice = item.getPrice();
56: price = new BigDecimal(0);
57: }
58:
59: public String toString() {
60: return ("itemId=" + itemId + "\tname=" + name + "\tprice="
61: + price + "\tunitPrice=" + unitPrice + "\tquantity=" + quantity);
62:
63: }
64:
65: public Integer getItemId() {
66: return itemId;
67: }
68:
69: public String getName() {
70: return name;
71: }
72:
73: public void setName(String name) {
74: this .name = name;
75: }
76:
77: public BigDecimal getPrice() {
78: return price;
79: }
80:
81: public void setPrice(BigDecimal price) {
82: this .price = price;
83: }
84:
85: public String getQuantity() {
86: return quantity;
87: }
88:
89: public void setQuantity(String quantity) {
90: this.quantity = quantity;
91: }
92:
93: }
|