View Javadoc

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.inventory.model.product.bo;
17  
18  import java.util.Collection;
19  
20  import net.sf.oness.common.model.bo.AbstractBusinessObject;
21  
22  /***
23   * @hibernate.class table="barcode"
24   * 
25   * @author Carlos Sanchez
26   * @version $Revision: 1.4 $
27   */
28  public class BarCode extends AbstractBusinessObject {
29  
30      private String number;
31  
32      private Collection products;
33  
34      /***
35       * @param number
36       *            The number to set.
37       */
38      public void setNumber(String number) {
39          this.number = number;
40      }
41  
42      /***
43       * @hibernate.property not-null="true"
44       * 
45       * @return Returns the number.
46       */
47      public String getNumber() {
48          return number;
49      }
50  
51      /***
52       * @return Returns the latest version of the product.
53       */
54      public Product getProduct() {
55          return (Product) getProducts().iterator().next();
56      }
57  
58      /***
59       * @param products
60       *            The products to set.
61       */
62      public void setProducts(Collection products) {
63          this.products = products;
64      }
65  
66      /***
67       * @hibernate.bag table="product_barcode" lazy="true" inverse="true" order-by="product_id desc"
68       * @hibernate.collection-key column="barcode_id"
69       * @hibernate.collection-many-to-many column="product_id" class="net.sf.oness.inventory.model.product.bo.Product"
70       * 
71       * @return Returns the products.
72       */
73      public Collection getProducts() {
74          return products;
75      }
76  
77  }