Subversion Repositories SmartDukaan

Rev

Rev 1061 | Details | Compare with Previous | 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;
4802 amit.gupta 34
 
35
	/**
36
	 * Whether this category is comparable
37
	 */
51 naveen 38
 
4802 amit.gupta 39
	private boolean comparable;
51 naveen 40
	/**
4802 amit.gupta 41
	 * If this category has accessories
42
	 */
43
	private boolean hasAccessories;
44
 
45
 
46
	public void setComparable(boolean comparable) {
47
		this.comparable = comparable;
48
	}
49
 
50
	public boolean isComparable() {
51
		return this.comparable;
52
	}
53
 
54
	public boolean isHasAccessories() {
55
		return hasAccessories;
56
	}
57
 
58
	public void setHasAccessories(boolean hasAccessories) {
59
		this.hasAccessories = hasAccessories;
60
	}
61
 
62
	/**
51 naveen 63
	 * List CategorySlideDefintion objects that define while slides define the 
64
	 * category
65
	 */
10 shop2020 66
	private List<CategorySlideDefinition> categorySlideDefintions;
51 naveen 67
 
68
	/**
69
	 * Parent category
70
	 */
10 shop2020 71
	private Category parentCategory;
51 naveen 72
 
73
	/**
74
	 * List of childrent categories
75
	 */
10 shop2020 76
	private List<Category> childrenCategory;
77
 
78
	/**
51 naveen 79
	 *  
80
	 * @param newID Unique identifier for the category
10 shop2020 81
	 */
82
	public Category(long newID) {
83
		super(newID);
84
	}
85
 
86
	/**
87
	 * 
88
	 * @return label
89
	 */
90
	public String getLabel() {
91
		return this.label;
92
	}
93
 
94
	/**
95
	 * 
51 naveen 96
	 * @param label to set
10 shop2020 97
	 */
98
	public void setLabel(String value) {
99
		this.label = value;
100
	}
101
 
102
	/**
103
	 * 
51 naveen 104
	 * @return description 
10 shop2020 105
	 */
106
	public String getDescription() {
107
		return this.description;
108
	}
109
 
110
	/**
111
	 * 
51 naveen 112
	 * @param description to set
10 shop2020 113
	 */
114
	public void setDescription(String value) {
115
		this.description = value;
116
	}
117
 
118
	/**
119
	 * @return the categorySlideDefintions
120
	 */
121
	public List<CategorySlideDefinition> getCategorySlideDefintions() {
122
		return categorySlideDefintions;
123
	}
124
 
125
	/**
126
	 * @param categorySlideDefintions the categorySlideDefintions to set
127
	 */
128
	public void setCategorySlideDefintions(
129
			List<CategorySlideDefinition> categorySlideDefintions) {
130
		this.categorySlideDefintions = categorySlideDefintions;
131
	}
132
 
133
	/**
51 naveen 134
	 * Convenient method to add new CategorySlideDefintion objects
10 shop2020 135
	 * 
136
	 * @param categoryDefinition
137
	 */
138
	public void addCategorySlideDefintion(CategorySlideDefinition categoryDefinition) {
139
		if(this.categorySlideDefintions == null) {
140
			this.categorySlideDefintions = new ArrayList<CategorySlideDefinition>();
141
		}
142
		this.categorySlideDefintions.add(categoryDefinition);
143
	}
144
 
145
	/**
146
	 * @param parentCategory the parentCategory to set
147
	 */
148
	public void setParentCategory(Category parentCategory) {
149
		this.parentCategory = parentCategory;
150
	}
151
 
152
	/**
153
	 * @return the parentCategory
154
	 */
155
	public Category getParentCategory() {
156
		return parentCategory;
157
	}
158
 
159
	/**
160
	 * @param childrenCategory the childrenCategory to set
161
	 */
162
	public void setChildrenCategory(List<Category> childrenCategory) {
163
		this.childrenCategory = childrenCategory;
164
	}
165
 
166
	/**
51 naveen 167
	 * Convenient method to add new children categories 
168
	 * 
10 shop2020 169
	 * @param childrenCategory the childrenCategory to set
170
	 */
171
	public void addChild(Category child) {
172
		if(this.childrenCategory == null) {
173
			this.childrenCategory = new ArrayList<Category>();
174
		}
175
		this.childrenCategory.add(child);
176
	}
177
 
178
	/**
179
	 * @return the childrenCategory
180
	 */
181
	public List<Category> getChildrenCategory() {
182
		return childrenCategory;
183
	}
184
 
185
	/* (non-Javadoc)
186
	 * @see java.lang.Object#toString()
187
	 */
188
	@Override
189
	public String toString() {
190
		/*
191
		return "Category [categorySlideDefintions=" + categorySlideDefintions
192
				+ ", childrenCategory=" + childrenCategory + ", description="
193
				+ description + ", label=" + label + ", parentCategory="
194
				+ parentCategory + "]";
195
		*/
196
		return "Category [categorySlideDefintions=" + categorySlideDefintions
197
		+ ", id=" + id + ", description=" + description + ", label=" + label + "]";
198
	}
199
 
200
}