Rev 24264 | Rev 28401 | 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 com.spice.profitmandi.common.enumuration.ItemType;import in.shop2020.model.v1.catalog.status;/*** 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="status")@Enumerated(EnumType.ORDINAL)private status status;@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;@Column(name="category")private int categoryId;public int getCategoryId() {return categoryId;}public void setCategoryId(int categoryId) {this.categoryId = categoryId;}@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 String getColorNatural() {return this.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;}public String getItemDescription(){StringBuilder itemString = new StringBuilder();if(this.getBrand() != null && !this.getBrand().isEmpty()){itemString.append(this.getBrand().trim());}itemString.append(" ");if(this.getModelName() != null && !this.getModelName().isEmpty()){itemString.append(this.getModelName().trim());}if(this.getModelNumber() != null && !this.getModelNumber().isEmpty()){itemString.append(" ");itemString.append(this.getModelNumber().trim());}if(this.getColor() != null && !this.getColor().isEmpty() && !this.getColor().trim().equals("f_")){itemString.append(" ");itemString.append(this.getColor().trim());}return itemString.toString().replaceAll("\\s+", " ").trim();}public String getItemDescriptionNoColor(){StringBuilder itemString = new StringBuilder();if(this.getBrand() != null && !this.getBrand().isEmpty()){itemString.append(this.getBrand().trim());}itemString.append(" ");if(this.getModelName() != null && !this.getModelName().isEmpty()){itemString.append(this.getModelName().trim());}if(this.getModelNumber() != null && !this.getModelNumber().isEmpty()){itemString.append(" ");itemString.append(this.getModelNumber().trim());}return itemString.toString().replaceAll("\\s+", " ").trim();}@Overridepublic int hashCode() {final int prime = 31;int result = 1;result = prime * result + id;return result;}@Overridepublic 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;}@Overridepublic String toString() {return "Item [id=" + id + ", brand=" + brand + ", status=" + status + ", modelName=" + modelName+ ", modelNumber=" + modelNumber + ", color=" + color + ", catalogItemId=" + catalogItemId+ ", categoryId=" + categoryId + ", type=" + type + ", hsnCode=" + hsnCode + ", sellingPrice="+ sellingPrice + "]";}public status getStatus() {return status;}public void setStatus(status status) {this.status = status;}}