View Javadoc
1   package ejava.examples.ejbwar.inventory.bo;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   
6   import javax.xml.bind.annotation.XmlAccessType;
7   import javax.xml.bind.annotation.XmlAccessorType;
8   import javax.xml.bind.annotation.XmlAttribute;
9   import javax.xml.bind.annotation.XmlElement;
10  import javax.xml.bind.annotation.XmlRootElement;
11  import javax.xml.bind.annotation.XmlType;
12  
13  import ejava.examples.ejbwar.inventory.bo.Category;
14  import ejava.examples.ejbwar.inventory.bo.InventoryRepresentation;
15  
16  /**
17   * This class is used to represent a collection of categories to/from the 
18   * server. It also contains some of the collection metadata.
19   */
20  @XmlRootElement(name="catageories", namespace=InventoryRepresentation.NAMESPACE)
21  @XmlType(name="Categories", namespace=InventoryRepresentation.NAMESPACE)
22  @XmlAccessorType(XmlAccessType.PROPERTY)
23  
24  public class Categories extends InventoryRepresentation {
25  	private static final long serialVersionUID = 8938786129503381169L;
26  	private int offset;
27  	private int limit;
28  	private List<Category> categories=new ArrayList<Category>();
29  	
30  	public Categories() {}
31  	public Categories(List<Category> categories, int offset, int limit) {
32  		this.categories = categories;
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 categories.size();
56  	}
57  	public void setCount(int count) {}
58  	
59  	
60  	@XmlElement
61  	public List<Category> getCategories() {
62  		return categories;
63  	}
64  	public void setCategories(List<Category> categories) {
65  		this.categories = categories;
66  	}
67  	
68  	
69  }