Subversion Repositories SmartDukaan

Rev

Rev 23172 | Rev 23362 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity.catalog;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import in.shop2020.model.v1.catalog.ItemType;

/**
 * This class basically contains item details
 * 
 * @author ashikali
 *
 */
@Entity
@Table(name="catalog.item", schema = "catalog")
public class Item implements Serializable{
        
        private static final long serialVersionUID = 1L;
        
        public Item() {
        }
        
        @Id
        @Column(name="id", columnDefinition = "int(11)")
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;
        
        @Column(name="brand", length = 100)
        private String brand;
        
        @Column(name = "model_name", length = 100)
        private String modelName;
        
        @Column(name = "model_number", length = 100)
        private String modelNumber;
        
        @Column(name = "color", length = 20)
        private String color;
        
        @Column(name="catalog_item_id")
        private int catalogItemId;
        
        @Enumerated(EnumType.STRING)
        @Column(name = "type")
        private ItemType type;
        
        @Column(name = "hsnCode")
        private String hsnCode;
        
        @Column(name = "sellingPrice")
        private float sellingPrice;
        
        public int getId() {
                return id;
        }
        public void setId(int id) {
                this.id = id;
        }
        public String getBrand() {
                return brand;
        }
        public void setBrand(String brand) {
                this.brand = brand;
        }
        public String getModelName() {
                return modelName;
        }
        public void setModelName(String modelName) {
                this.modelName = modelName;
        }
        public String getModelNumber() {
                return modelNumber;
        }
        public void setModelNumber(String modelNumber) {
                this.modelNumber = modelNumber;
        }
        public String getColor() {
                if(color != null && (color.startsWith("f_") || color.startsWith("f_"))){
                        return color.substring(2);
                }
                return color;
        }
        public void setColor(String color) {
                this.color = color;
        }
        
        public ItemType getType() {
                return type;
        }
        public void setType(ItemType type) {
                this.type = type;
        }
        
        public String getHsnCode() {
                return hsnCode;
        }
        public void setHsnCode(String hsnCode) {
                this.hsnCode = hsnCode;
        }
        
        public int getCatalogItemId() {
                return catalogItemId;
        }
        public void setCatalogItemId(int catalogItemId) {
                this.catalogItemId = catalogItemId;
        }
        
        public float getSellingPrice() {
                return sellingPrice;
        }
        
        public void setSellingPrice(float sellingPrice) {
                this.sellingPrice = sellingPrice;
        }
        
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + id;
                return result;
        }
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                Item other = (Item) obj;
                if (id != other.id)
                        return false;
                return true;
        }
        @Override
        public String toString() {
                return "Item [id=" + id + ", brand=" + brand + ", modelName=" + modelName + ", modelNumber=" + modelNumber
                                + ", color=" + color + ", catalogItemId=" + catalogItemId + ", type=" + type + ", hsnCode=" + hsnCode
                                + ", sellingPrice=" + sellingPrice + "]";
        }
    
}