Subversion Repositories SmartDukaan

Rev

Rev 43 | 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.MetaModelComponent;

/**
 * Part of definitions component of shop2020 Content Meta-model. Defines 
 * Bullet component.
 * 
 * @author naveen
 *
 */
public class BulletDefinition extends MetaModelComponent {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;
        
        /**
         * When defining a Bullet (i.e. creating an instance of BulletDefinition), 
         * editor can provide more details in plain text here. Primarily to guide
         * content developer. 
         */
        private String description;
        
        /**
         * Pointer to datatype definition
         */
        private long datatypeDefinitionID;
        
        /**
         * If set, makes the bullet take more than one value. e.g. 
         * Mobile phone "Color" is a mutli-value bullet, manufacturers provide 
         * multiple color options per model
         */
        private boolean isMultivalue;
        
        /**
         * True if values are learned
         */
        private boolean isLearned;
        
        /**
         * List of allowed Unit IDs
         */
        private List<Long> unitIDs;

        /**
         * 
         * @param datatypeDefinitionID 
         */
        public BulletDefinition(long datatypeDefinitionID) {
                this.datatypeDefinitionID = datatypeDefinitionID;
        }

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

        /**
         * @param datatypeDefinitionID the datatypeDefinitionID to set
         */
        public void setDatatypeDefinitionID(Long datatypeDefinitionID) {
                this.datatypeDefinitionID = datatypeDefinitionID;
        }

        /**
         * @return the datatypeDefinitionID
         */
        public Long getDatatypeDefinitionID() {
                return datatypeDefinitionID;
        }

        /**
         * 
         * @return isMultivalue
         */
        public boolean isMultivalue() {
                return this.isMultivalue;
        }
        
        /**
         * 
         * @param value
         */
        public void setMultivalue(boolean value) {
                this.isMultivalue = value;
        }

        /**
         * @param isLearned the isLearned to set
         */
        public void setLearned(boolean isLearned) {
                this.isLearned = isLearned;
        }

        /**
         * @return the isLearned
         */
        public boolean isLearned() {
                return isLearned;
        }

        /**
         * @param unitIDs the unitIDs to set
         */
        public void setUnitIDs(List<Long> unitIDs) {
                this.unitIDs = unitIDs;
        }
        
        /**
         * 
         * @param unitID
         */
        public void addUnitID(Long unitID) {
                if(this.unitIDs == null) {
                        this.unitIDs = new ArrayList<Long>();
                }
                
                this.unitIDs.add(unitID);
        }
        
        /**
         * @return the unitIDs
         */
        public List<Long> getUnitIDs() {
                return unitIDs;
        }

        /* (non-Javadoc)
         * @see java.lang.Object#toString()
         */
        @Override
        public String toString() {
                return "BulletDefinition [datatypeDefinitionID=" + datatypeDefinitionID
                                + ", description=" + description + ", isLearned=" + isLearned
                                + ", isMultivalue=" + isMultivalue + ", unitIDs=" + unitIDs
                                + "]";
        }

}