Subversion Repositories SmartDukaan

Rev

Rev 10 | Rev 323 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * 
 */
package in.shop2020.metamodel.definitions;

import java.util.ArrayList;
import java.util.List;

import in.shop2020.metamodel.util.ReusableMetaModelComponent;

/**
 * Category class is the center of all definition classes. Represents product 
 * categories in shop2020 online product catalog. Other classes under 
 * definitions package define different elements of a Category.
 * 
 * @author naveen
 *
 */
public class Category extends ReusableMetaModelComponent {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;
        
        /**
         * Editor provided intuitive label for the category
         */
        private String label;
        
        /**
         * Editor's comments
         */
        private String description;
        
        /**
         * List CategorySlideDefintion objects that define while slides define the 
         * category
         */
        private List<CategorySlideDefinition> categorySlideDefintions;
        
        /**
         * Parent category
         */
        private Category parentCategory;
        
        /**
         * List of childrent categories
         */
        private List<Category> childrenCategory;
        
        /**
         *  
         * @param newID Unique identifier for the category
         */
        public Category(long newID) {
                super(newID);
        }
        
        /**
         * 
         * @return label
         */
        public String getLabel() {
                return this.label;
        }
        
        /**
         * 
         * @param label to set
         */
        public void setLabel(String value) {
                this.label = value;
        }

        /**
         * 
         * @return description 
         */
        public String getDescription() {
                return this.description;
        }
        
        /**
         * 
         * @param description to set
         */
        public void setDescription(String value) {
                this.description = value;
        }

        /**
         * @return the categorySlideDefintions
         */
        public List<CategorySlideDefinition> getCategorySlideDefintions() {
                return categorySlideDefintions;
        }

        /**
         * @param categorySlideDefintions the categorySlideDefintions to set
         */
        public void setCategorySlideDefintions(
                        List<CategorySlideDefinition> categorySlideDefintions) {
                this.categorySlideDefintions = categorySlideDefintions;
        }
        
        /**
         * Convenient method to add new CategorySlideDefintion objects
         * 
         * @param categoryDefinition
         */
        public void addCategorySlideDefintion(CategorySlideDefinition categoryDefinition) {
                if(this.categorySlideDefintions == null) {
                        this.categorySlideDefintions = new ArrayList<CategorySlideDefinition>();
                }
                this.categorySlideDefintions.add(categoryDefinition);
        }

        /**
         * @param parentCategory the parentCategory to set
         */
        public void setParentCategory(Category parentCategory) {
                this.parentCategory = parentCategory;
        }

        /**
         * @return the parentCategory
         */
        public Category getParentCategory() {
                return parentCategory;
        }

        /**
         * @param childrenCategory the childrenCategory to set
         */
        public void setChildrenCategory(List<Category> childrenCategory) {
                this.childrenCategory = childrenCategory;
        }

        /**
         * Convenient method to add new children categories 
         * 
         * @param childrenCategory the childrenCategory to set
         */
        public void addChild(Category child) {
                if(this.childrenCategory == null) {
                        this.childrenCategory = new ArrayList<Category>();
                }
                this.childrenCategory.add(child);
        }

        /**
         * @return the childrenCategory
         */
        public List<Category> getChildrenCategory() {
                return childrenCategory;
        }

        /* (non-Javadoc)
         * @see java.lang.Object#toString()
         */
        @Override
        public String toString() {
                /*
                return "Category [categorySlideDefintions=" + categorySlideDefintions
                                + ", childrenCategory=" + childrenCategory + ", description="
                                + description + ", label=" + label + ", parentCategory="
                                + parentCategory + "]";
                */
                return "Category [categorySlideDefintions=" + categorySlideDefintions
                + ", id=" + id + ", description=" + description + ", label=" + label + "]";
        }
        
}