1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 package com.ivata.mask.web.demo.order;
52 import java.util.List;
53 import java.util.Vector;
54 import com.ivata.mask.web.demo.customer.CustomerDO;
55 import com.ivata.mask.web.demo.valueobject.DemoValueObject;
56 /***
57 * <p>
58 * Represents a single order of this imaginary system.
59 * </p>
60 *
61 * @author Colin MacLeod
62 * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
63 * @since ivata masks 0.2 (2004-05-20)
64 * @version $Revision: 1.4 $
65 */
66 public final class OrderDO extends DemoValueObject {
67 /***
68 * <p>
69 * List of order items being ordered.
70 * </p>
71 */
72 private List items = new Vector();
73 /***
74 * <p>
75 * Customer associated with this order.
76 * </p>
77 */
78 private CustomerDO customer;
79 /***
80 * <p>
81 * Construct a new order instance with no id.
82 * </p>
83 */
84 public OrderDO() {
85 super();
86 }
87 /***
88 * <p>
89 * Construct a new order instance with the given unique identifier.
90 * </p>
91 *
92 * @param idParam unique identifier of this product.
93 */
94 public OrderDO(final int idParam) {
95 super(idParam);
96 }
97 /***
98 * Each order had to be ordered by someone! This is the customer who placed
99 * the order.
100 * @return the customer who placed this order.
101 */
102 public CustomerDO getCustomer() {
103 return customer;
104 }
105 /***
106 * An order ain't nothing without some items being purchased. This
107 * <code>List</code> contains instances of <code>OrderItemDO</code>.
108 *
109 * @return <code>List</code> containing instances of
110 * <code>OrderItemDO</code>.
111 */
112 public List getItems() {
113 return items;
114 }
115 /***
116 * Sets the customer who made this order.
117 *
118 * @param customerDO customer who made this order.
119 */
120 public void setCustomer(final CustomerDO customerDO) {
121 customer = customerDO;
122 }
123 /***
124 * Set all of the items in the order as a list.
125 *
126 * @param list a <code>List</code> of {@link OrderItemDO} instances.
127 */
128 public void setItems(final List list) {
129 items = list;
130 }
131 /***
132 * For an order, this just returns {@link java.lang.Object#toString
133 * toString()}.
134 *
135 * @see com.ivata.mask.valueobject.ValueObject#getStringValue()
136 */
137 public String getDisplayValue() {
138 return toString();
139 }
140 }
141