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