1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.oness.inventory.model.product.bo;
17
18 import java.math.BigDecimal;
19 import java.util.Collection;
20 import java.util.Iterator;
21
22 import net.sf.oness.common.model.bo.AbstractBusinessObject;
23
24 /***
25 * @hibernate.class table="price"
26 *
27 * @author Carlos Sanchez
28 * @version $Revision: 1.5 $
29 */
30 public class Price extends AbstractBusinessObject {
31
32 private BigDecimal amount;
33
34 private Collection products;
35
36 private Collection fares;
37
38 /***
39 * @param amount
40 * The amount to set.
41 */
42 public void setAmount(BigDecimal amount) {
43 this.amount = amount;
44 }
45
46 /***
47 * @hibernate.property length="2"
48 *
49 * @return Returns the amount.
50 */
51 public BigDecimal getAmount() {
52 return amount;
53 }
54
55 /***
56 * @return Returns the the latest version of product.
57 */
58 public Product getProduct() {
59 Iterator iter = getProducts().iterator();
60 return iter.hasNext() ? (Product) iter.next() : null;
61 }
62
63 /***
64 * @param products
65 * The products to set.
66 */
67 public void setProducts(Collection products) {
68 this.products = products;
69 }
70
71 /***
72 * @hibernate.bag table="product_price" lazy="true" order-by="product_id desc"
73 * @hibernate.collection-key column="price_id"
74 * @hibernate.collection-many-to-many column="product_id" class="net.sf.oness.inventory.model.product.bo.Product"
75 *
76 * @return Returns the products.
77 */
78 public Collection getProducts() {
79 return products;
80 }
81
82 /***
83 * @return Returns the the latest version of fare.
84 */
85 public Fare getFare() {
86 Iterator iter = getFares().iterator();
87 return iter.hasNext() ? (Fare) iter.next() : null;
88 }
89
90 /***
91 * @param fares
92 * The fares to set.
93 */
94 public void setFares(Collection fares) {
95 this.fares = fares;
96 }
97
98 /***
99 * @hibernate.bag table="fare_price" lazy="true" order-by="fare_id desc"
100 * @hibernate.collection-key column="price_id"
101 * @hibernate.collection-many-to-many column="fare_id" class="net.sf.oness.inventory.model.product.bo.Fare"
102 *
103 * @return Returns the fares.
104 */
105 public Collection getFares() {
106 return fares;
107 }
108
109 }