View Javadoc
1   package ejava.examples.ejbwar.inventory.bo;
2   
3   import java.util.ArrayList;
4   
5   import java.util.List;
6   
7   import javax.xml.bind.annotation.XmlAccessType;
8   import javax.xml.bind.annotation.XmlAccessorType;
9   import javax.xml.bind.annotation.XmlAttribute;
10  import javax.xml.bind.annotation.XmlElement;
11  import javax.xml.bind.annotation.XmlRootElement;
12  import javax.xml.bind.annotation.XmlType;
13  
14  import ejava.examples.ejbwar.inventory.bo.InventoryRepresentation;
15  
16  /**
17   * This class is used to represent a collection of products to/from the 
18   * server. It also contains some of the collection metadata.
19   */
20  @XmlRootElement(name="products", namespace=InventoryRepresentation.NAMESPACE)
21  @XmlType(name="Products", namespace=InventoryRepresentation.NAMESPACE)
22  @XmlAccessorType(XmlAccessType.PROPERTY)
23  
24  public class Products extends InventoryRepresentation {
25  	private static final long serialVersionUID = 8409120005599383060L;
26  	private int offset;
27  	private int limit;
28  	private List<Product> products=new ArrayList<Product>();
29  	
30  	public Products() {}
31  	public Products(List<Product> products, int offset, int limit) {
32  		this.products = products;
33  		this.offset = offset;
34  		this.limit = limit;
35  	}
36  	
37  	@XmlAttribute
38  	public int getOffset() {
39  		return offset;
40  	}
41  	public void setOffset(int offset) {
42  		this.offset = offset;
43  	}
44  	
45  	@XmlAttribute
46  	public int getLimit() {
47  		return limit;
48  	}
49  	public void setLimit(int limit) {
50  		this.limit = limit;
51  	}
52  	
53  	@XmlAttribute
54  	public int getCount() {
55  		return products.size();
56  	}
57  	public void setCount(int count) {}
58  	
59  	
60  	@XmlElement
61  	public List<Product> getProducts() {
62  		return products;
63  	}
64  	public void setProducts(List<Product> products) {
65  		this.products = products;
66  	}
67  	
68  	
69  }