1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.oness.order.model.bo;
17
18 import java.math.BigDecimal;
19 import java.util.Collection;
20 import java.util.Iterator;
21
22 /***
23 * @hibernate.class table="orderitem"
24 *
25 * @author Carlos Sanchez
26 * @version $Revision: 1.6 $
27 */
28 public class OrderItem extends Item {
29
30 private BigDecimal price;
31
32 private Collection orders, deliveryDocketItems;
33
34 /***
35 * @param price
36 * The price to set.
37 */
38 public void setPrice(BigDecimal price) {
39 this.price = price;
40 }
41
42 /***
43 * @hibernate.property length="2"
44 *
45 * @return Returns the price.
46 */
47 public BigDecimal getPrice() {
48 return price;
49 }
50
51 /***
52 * @param orders The orders to set.
53 */
54 public void setOrders(Collection orders) {
55 this.orders = orders;
56 }
57
58 /***
59 * @hibernate.bag table="order_orderitem" lazy="true" order-by="order_id desc"
60 * @hibernate.collection-key column="orderitem_id"
61 * @hibernate.collection-many-to-many column="order_id" class="net.sf.oness.order.model.bo.Order"
62 *
63 * @return Returns the orders.
64 */
65 public Collection getOrders() {
66 return orders;
67 }
68
69 /***
70 * @return Returns the the latest version of the order.
71 */
72 public Order getOrder() {
73 Iterator iter = getOrders().iterator();
74 return iter.hasNext() ? (Order) iter.next() : null;
75 }
76
77 /***
78 * @param deliveryDocketItems
79 * The deliveryDocketItems to set.
80 */
81 public void setDeliveryDocketItems(Collection deliveryDocketItems) {
82 this.deliveryDocketItems = deliveryDocketItems;
83 }
84
85 /***
86 * @hibernate.bag table="orderitem_deliverydocketitem" lazy="true" inverse="true"
87 * @hibernate.collection-key column="orderitem_id"
88 * @hibernate.collection-many-to-many column="deliverydocketitem_id" class="net.sf.oness.order.model.bo.DeliveryDocketItem"
89 *
90 * @return Returns the deliveryDocketItems.
91 */
92 public Collection getDeliveryDocketItems() {
93 return deliveryDocketItems;
94 }
95
96 }