Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
10 shop2020 1
/**
2
 * 
3
 */
4
package in.shop2020.metamodel.definitions;
5
 
6
import java.util.ArrayList;
7
import java.util.List;
8
 
9
import in.shop2020.metamodel.util.ReusableMetaModelComponent;
10
 
11
/**
51 naveen 12
 * Category class is the center of all definition classes. Represents product 
13
 * categories in shop2020 online product catalog. Other classes under 
14
 * definitions package define different elements of a Category.
10 shop2020 15
 * 
16
 * @author naveen
17
 *
18
 */
19
public class Category extends ReusableMetaModelComponent {
20
	/**
21
	 * 
22
	 */
23
	private static final long serialVersionUID = 1L;
51 naveen 24
 
25
	/**
26
	 * Editor provided intuitive label for the category
27
	 */
10 shop2020 28
	private String label;
51 naveen 29
 
30
	/**
31
	 * Editor's comments
32
	 */
10 shop2020 33
	private String description;
51 naveen 34
 
35
	/**
36
	 * List CategorySlideDefintion objects that define while slides define the 
37
	 * category
38
	 */
10 shop2020 39
	private List<CategorySlideDefinition> categorySlideDefintions;
51 naveen 40
 
41
	/**
42
	 * Parent category
43
	 */
10 shop2020 44
	private Category parentCategory;
51 naveen 45
 
46
	/**
47
	 * List of childrent categories
48
	 */
10 shop2020 49
	private List<Category> childrenCategory;
50
 
51
	/**
51 naveen 52
	 *  
53
	 * @param newID Unique identifier for the category
10 shop2020 54
	 */
55
	public Category(long newID) {
56
		super(newID);
57
	}
58
 
59
	/**
60
	 * 
61
	 * @return label
62
	 */
63
	public String getLabel() {
64
		return this.label;
65
	}
66
 
67
	/**
68
	 * 
51 naveen 69
	 * @param label to set
10 shop2020 70
	 */
71
	public void setLabel(String value) {
72
		this.label = value;
73
	}
74
 
75
	/**
76
	 * 
51 naveen 77
	 * @return description 
10 shop2020 78
	 */
79
	public String getDescription() {
80
		return this.description;
81
	}
82
 
83
	/**
84
	 * 
51 naveen 85
	 * @param description to set
10 shop2020 86
	 */
87
	public void setDescription(String value) {
88
		this.description = value;
89
	}
90
 
91
	/**
92
	 * @return the categorySlideDefintions
93
	 */
94
	public List<CategorySlideDefinition> getCategorySlideDefintions() {
95
		return categorySlideDefintions;
96
	}
97
 
98
	/**
99
	 * @param categorySlideDefintions the categorySlideDefintions to set
100
	 */
101
	public void setCategorySlideDefintions(
102
			List<CategorySlideDefinition> categorySlideDefintions) {
103
		this.categorySlideDefintions = categorySlideDefintions;
104
	}
105
 
106
	/**
51 naveen 107
	 * Convenient method to add new CategorySlideDefintion objects
10 shop2020 108
	 * 
109
	 * @param categoryDefinition
110
	 */
111
	public void addCategorySlideDefintion(CategorySlideDefinition categoryDefinition) {
112
		if(this.categorySlideDefintions == null) {
113
			this.categorySlideDefintions = new ArrayList<CategorySlideDefinition>();
114
		}
115
		this.categorySlideDefintions.add(categoryDefinition);
116
	}
117
 
118
	/**
119
	 * @param parentCategory the parentCategory to set
120
	 */
121
	public void setParentCategory(Category parentCategory) {
122
		this.parentCategory = parentCategory;
123
	}
124
 
125
	/**
126
	 * @return the parentCategory
127
	 */
128
	public Category getParentCategory() {
129
		return parentCategory;
130
	}
131
 
132
	/**
133
	 * @param childrenCategory the childrenCategory to set
134
	 */
135
	public void setChildrenCategory(List<Category> childrenCategory) {
136
		this.childrenCategory = childrenCategory;
137
	}
138
 
139
	/**
51 naveen 140
	 * Convenient method to add new children categories 
141
	 * 
10 shop2020 142
	 * @param childrenCategory the childrenCategory to set
143
	 */
144
	public void addChild(Category child) {
145
		if(this.childrenCategory == null) {
146
			this.childrenCategory = new ArrayList<Category>();
147
		}
148
		this.childrenCategory.add(child);
149
	}
150
 
151
	/**
152
	 * @return the childrenCategory
153
	 */
154
	public List<Category> getChildrenCategory() {
155
		return childrenCategory;
156
	}
157
 
158
	/* (non-Javadoc)
159
	 * @see java.lang.Object#toString()
160
	 */
161
	@Override
162
	public String toString() {
163
		/*
164
		return "Category [categorySlideDefintions=" + categorySlideDefintions
165
				+ ", childrenCategory=" + childrenCategory + ", description="
166
				+ description + ", label=" + label + ", parentCategory="
167
				+ parentCategory + "]";
168
		*/
169
		return "Category [categorySlideDefintions=" + categorySlideDefintions
170
		+ ", id=" + id + ", description=" + description + ", label=" + label + "]";
171
	}
172
 
173
}