Subversion Repositories SmartDukaan

Rev

Rev 23426 | Rev 24072 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21713 ashik.ali 1
package com.spice.profitmandi.dao.entity.catalog;
21552 ashik.ali 2
 
3
import java.io.Serializable;
4
 
5
import javax.persistence.Column;
6
import javax.persistence.Entity;
21614 kshitij.so 7
import javax.persistence.EnumType;
8
import javax.persistence.Enumerated;
21552 ashik.ali 9
import javax.persistence.GeneratedValue;
10
import javax.persistence.GenerationType;
11
import javax.persistence.Id;
12
import javax.persistence.Table;
13
 
21573 ashik.ali 14
import in.shop2020.model.v1.catalog.ItemType;
15
 
21552 ashik.ali 16
/**
17
 * This class basically contains item details
18
 * 
19
 * @author ashikali
20
 *
21
 */
22
@Entity
23
@Table(name="catalog.item", schema = "catalog")
24
public class Item implements Serializable{
25
 
26
	private static final long serialVersionUID = 1L;
27
 
28
	public Item() {
29
	}
30
 
31
	@Id
32
	@Column(name="id", columnDefinition = "int(11)")
33
	@GeneratedValue(strategy = GenerationType.IDENTITY)
34
	private int id;
35
 
21653 ashik.ali 36
	@Column(name="brand", length = 100)
21552 ashik.ali 37
	private String brand;
38
 
39
	@Column(name = "model_name", length = 100)
40
	private String modelName;
41
 
42
	@Column(name = "model_number", length = 100)
43
	private String modelNumber;
44
 
45
	@Column(name = "color", length = 20)
46
	private String color;
47
 
21898 kshitij.so 48
	@Column(name="catalog_item_id")
49
	private int catalogItemId;
50
 
23426 amit.gupta 51
	@Column(name="category")
52
	private int categoryId;
53
 
54
	public int getCategoryId() {
55
		return categoryId;
56
	}
57
	public void setCategoryId(int categoryId) {
58
		this.categoryId = categoryId;
59
	}
60
 
21614 kshitij.so 61
	@Enumerated(EnumType.STRING)
21573 ashik.ali 62
	@Column(name = "type")
63
	private ItemType type;
64
 
21917 ashik.ali 65
	@Column(name = "hsnCode")
21895 ashik.ali 66
	private String hsnCode;
67
 
22216 ashik.ali 68
	@Column(name = "sellingPrice")
23398 amit.gupta 69
	private Float sellingPrice;
22216 ashik.ali 70
 
21552 ashik.ali 71
	public int getId() {
72
		return id;
73
	}
74
	public void setId(int id) {
75
		this.id = id;
76
	}
77
	public String getBrand() {
78
		return brand;
79
	}
80
	public void setBrand(String brand) {
81
		this.brand = brand;
82
	}
83
	public String getModelName() {
84
		return modelName;
85
	}
86
	public void setModelName(String modelName) {
87
		this.modelName = modelName;
88
	}
89
	public String getModelNumber() {
90
		return modelNumber;
91
	}
92
	public void setModelNumber(String modelNumber) {
93
		this.modelNumber = modelNumber;
94
	}
95
	public String getColor() {
23362 amit.gupta 96
		if(color != null && (color.startsWith("f_") || color.startsWith("F_"))){
23361 amit.gupta 97
			return color.substring(2);
98
		}
21552 ashik.ali 99
		return color;
100
	}
101
	public void setColor(String color) {
102
		this.color = color;
103
	}
104
 
21573 ashik.ali 105
	public ItemType getType() {
106
		return type;
107
	}
108
	public void setType(ItemType type) {
109
		this.type = type;
110
	}
21895 ashik.ali 111
 
112
	public String getHsnCode() {
113
		return hsnCode;
114
	}
115
	public void setHsnCode(String hsnCode) {
116
		this.hsnCode = hsnCode;
117
	}
21898 kshitij.so 118
 
119
	public int getCatalogItemId() {
120
		return catalogItemId;
121
	}
122
	public void setCatalogItemId(int catalogItemId) {
123
		this.catalogItemId = catalogItemId;
124
	}
21924 ashik.ali 125
 
23398 amit.gupta 126
	public Float getSellingPrice() {
22216 ashik.ali 127
		return sellingPrice;
128
	}
22009 ashik.ali 129
 
23398 amit.gupta 130
	public void setSellingPrice(Float sellingPrice) {
22216 ashik.ali 131
		this.sellingPrice = sellingPrice;
132
	}
133
 
23398 amit.gupta 134
	public String getItemDescription(){
135
		StringBuilder itemString = new StringBuilder();
136
		if(this.getBrand() != null && !this.getBrand().isEmpty()){
137
			itemString.append(this.getBrand().trim());
138
		}
139
		itemString.append(" ");
140
		if(this.getModelName() != null && !this.getModelName().isEmpty()){
141
			itemString.append(this.getModelName().trim());
142
		}
143
		itemString.append(" ");
144
		if(this.getModelNumber() != null && !this.getModelNumber().isEmpty()){
145
			itemString.append(this.getModelNumber().trim());
146
		}
147
		itemString.append(" ");
148
		if(this.getColor() != null && !this.getColor().isEmpty()){
149
			itemString.append(this.getColor().trim());
150
		}
151
		return itemString.toString();
152
	}
153
 
23569 govind 154
	public String getItemDescriptionNoColor(){
155
		StringBuilder itemString = new StringBuilder();
156
		if(this.getBrand() != null && !this.getBrand().isEmpty()){
157
			itemString.append(this.getBrand().trim());
158
		}
159
		itemString.append(" ");
160
		if(this.getModelName() != null && !this.getModelName().isEmpty()){
161
			itemString.append(this.getModelName().trim());
162
		}
163
		itemString.append(" ");
164
		if(this.getModelNumber() != null && !this.getModelNumber().isEmpty()){
165
			itemString.append(this.getModelNumber().trim());
166
		}
167
		return itemString.toString();
168
	}
169
 
21602 ashik.ali 170
	@Override
21924 ashik.ali 171
	public int hashCode() {
172
		final int prime = 31;
173
		int result = 1;
174
		result = prime * result + id;
175
		return result;
176
	}
177
	@Override
178
	public boolean equals(Object obj) {
179
		if (this == obj)
180
			return true;
181
		if (obj == null)
182
			return false;
183
		if (getClass() != obj.getClass())
184
			return false;
185
		Item other = (Item) obj;
186
		if (id != other.id)
187
			return false;
188
		return true;
189
	}
190
	@Override
21602 ashik.ali 191
	public String toString() {
192
		return "Item [id=" + id + ", brand=" + brand + ", modelName=" + modelName + ", modelNumber=" + modelNumber
23172 ashik.ali 193
				+ ", color=" + color + ", catalogItemId=" + catalogItemId + ", type=" + type + ", hsnCode=" + hsnCode
194
				+ ", sellingPrice=" + sellingPrice + "]";
21602 ashik.ali 195
	}
21552 ashik.ali 196
 
197
}