|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| InvoiceItem.java | 0% | 66,7% | 80% | 61,5% |
|
||||||||||||||
| 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="invoiceitem" | |
| 24 | * | |
| 25 | * @author Carlos Sanchez | |
| 26 | * @version $Revision: 1.4 $ | |
| 27 | */ | |
| 28 | public class InvoiceItem extends Item { | |
| 29 | ||
| 30 | private BigDecimal price; | |
| 31 | ||
| 32 | private Collection invoices; | |
| 33 | ||
| 34 | /** | |
| 35 | * @param price | |
| 36 | * The price to set. | |
| 37 | */ | |
| 38 | 24 | public void setPrice(BigDecimal price) { |
| 39 | 24 | this.price = price; |
| 40 | } | |
| 41 | ||
| 42 | /** | |
| 43 | * @hibernate.property length="2" | |
| 44 | * | |
| 45 | * @return Returns the price. | |
| 46 | */ | |
| 47 | 32 | public BigDecimal getPrice() { |
| 48 | 32 | return price; |
| 49 | } | |
| 50 | ||
| 51 | /** | |
| 52 | * @param invoices The invoices to set. | |
| 53 | */ | |
| 54 | 22 | public void setInvoices(Collection invoices) { |
| 55 | 22 | this.invoices = invoices; |
| 56 | } | |
| 57 | ||
| 58 | /** | |
| 59 | * @hibernate.bag table="invoice_invoiceitem" lazy="true" order-by="invoice_id desc" | |
| 60 | * @hibernate.collection-key column="invoiceitem_id" | |
| 61 | * @hibernate.collection-many-to-many column="invoice_id" class="net.sf.oness.order.model.bo.Invoice" | |
| 62 | * | |
| 63 | * @return Returns the invoices. | |
| 64 | */ | |
| 65 | 23 | public Collection getInvoices() { |
| 66 | 23 | return invoices; |
| 67 | } | |
| 68 | ||
| 69 | /** | |
| 70 | * @return Returns the the latest version of the invoice. | |
| 71 | */ | |
| 72 | 0 | public Invoice getInvoice() { |
| 73 | 0 | Iterator iter = getInvoices().iterator(); |
| 74 | 0 | return iter.hasNext() ? (Invoice) iter.next() : null; |
| 75 | } | |
| 76 | ||
| 77 | } |
|
||||||||||