Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package in.shop2020.serving.utils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Category implements Serializable {
        
        private static final long serialVersionUID = 1L;
        
        private long id;
        
        private String label;
        
        private String description;
        
        private long parentCategoryId;
        
        private List<Long> childrenCategoryIds;
        

        public Category(long newID) {
                this.setId(newID); 
        }
        
        public void setId(long id) {
                this.id = id;
        }

        public long getId() {
                return id;
        }
        
        /**
         * 
         * @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;
        }

        /**
         * @param parentCategory the parentCategory to set
         */
        public void setParentCategoryId(long parentCategoryId) {
                this.parentCategoryId = parentCategoryId;
        }

        /**
         * @return the parentCategory
         */
        public long getParentCategoryId() {
                return parentCategoryId;
        }

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

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

        /**
         * @return the childrenCategory
         */
        public List<Long> getChildrenCategoryIds() {
                return childrenCategoryIds;
        }
        
}