|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| OrderItem.java | 50% | 100% | 100% | 94,1% |
|
||||||||||||||
| 1 | /* | |
| 2 | * Copyright 2004 Carlos Sanchez. | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 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 | 109 | public void setPrice(BigDecimal price) { |
| 39 | 109 | this.price = price; |
| 40 | } | |
| 41 | ||
| 42 | /** | |
| 43 | * @hibernate.property length="2" | |
| 44 | * | |
| 45 | * @return Returns the price. | |
| 46 | */ | |
| 47 | 677 | public BigDecimal getPrice() { |
| 48 | 677 | return price; |
| 49 | } | |
| 50 | ||
| 51 | /** | |
| 52 | * @param orders The orders to set. | |
| 53 | */ | |
| 54 | 110 | public void setOrders(Collection orders) { |
| 55 | 110 | 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 | 681 | public Collection getOrders() { |
| 66 | 681 | return orders; |
| 67 | } | |
| 68 | ||
| 69 | /** | |
| 70 | * @return Returns the the latest version of the order. | |
| 71 | */ | |
| 72 | 2 | public Order getOrder() { |
| 73 | 2 | Iterator iter = getOrders().iterator(); |
| 74 | 2 | return iter.hasNext() ? (Order) iter.next() : null; |
| 75 | } | |
| 76 | ||
| 77 | /** | |
| 78 | * @param deliveryDocketItems | |
| 79 | * The deliveryDocketItems to set. | |
| 80 | */ | |
| 81 | 110 | public void setDeliveryDocketItems(Collection deliveryDocketItems) { |
| 82 | 110 | 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 | 710 | public Collection getDeliveryDocketItems() { |
| 93 | 710 | return deliveryDocketItems; |
| 94 | } | |
| 95 | ||
| 96 | } |
|
||||||||||