Subversion Repositories SmartDukaan

Rev

Rev 29707 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
29707 tejbeer 1
package com.spice.profitmandi.common.model;
2
 
3
public class CustomItemModel {
4
 
5
	private int itemId;
6
	private String brand;
7
	private String modelName;
8
	private String modelNumber;
9
	private String color;
29733 tejbeer 10
	private String type;
29707 tejbeer 11
 
12
	public CustomItemModel(int itemId, String brand, String modelName, String modelNumber, String color) {
13
		super();
14
		this.itemId = itemId;
15
		this.brand = brand;
16
		this.modelName = modelName;
17
		this.modelNumber = modelNumber;
18
		this.color = color;
19
 
20
	}
21
 
29733 tejbeer 22
	public String getType() {
23
		return type;
24
	}
25
 
26
	public void setType(String type) {
27
		this.type = type;
28
	}
29
 
29707 tejbeer 30
	public int getItemId() {
31
		return itemId;
32
	}
33
 
34
	public void setItemId(int itemId) {
35
		this.itemId = itemId;
36
	}
37
 
38
	public String getBrand() {
39
		return brand;
40
	}
41
 
42
	public void setBrand(String brand) {
43
		this.brand = brand;
44
	}
45
 
46
	public String getModelName() {
47
		return modelName;
48
	}
49
 
50
	public void setModelName(String modelName) {
51
		this.modelName = modelName;
52
	}
53
 
54
	public String getModelNumber() {
55
		return modelNumber;
56
	}
57
 
58
	public void setModelNumber(String modelNumber) {
59
		this.modelNumber = modelNumber;
60
	}
61
 
62
	public String getColor() {
63
		return color;
64
	}
65
 
66
	public void setColor(String color) {
67
		this.color = color;
68
	}
69
 
70
	public String getItemDescription() {
71
		StringBuilder itemString = new StringBuilder();
72
		if (this.getBrand() != null && !this.getBrand().isEmpty()) {
73
			itemString.append(this.getBrand().trim());
74
		}
75
		itemString.append(" ");
76
		if (this.getModelName() != null && !this.getModelName().isEmpty()) {
77
			itemString.append(this.getModelName().trim());
78
		}
79
		if (this.getModelNumber() != null && !this.getModelNumber().isEmpty()) {
80
			itemString.append(" ");
81
			itemString.append(this.getModelNumber().trim());
82
		}
83
		if (this.getColor() != null && !this.getColor().isEmpty() && !this.getColor().trim().equals("f_")) {
84
			itemString.append(" ");
85
			itemString.append(this.getColor().trim());
86
		}
87
		return itemString.toString().replaceAll("\\s+", " ").trim();
88
	}
89
 
90
	@Override
91
	public int hashCode() {
92
		final int prime = 31;
93
		int result = 1;
94
		result = prime * result + ((brand == null) ? 0 : brand.hashCode());
95
		result = prime * result + ((color == null) ? 0 : color.hashCode());
96
		result = prime * result + itemId;
97
		result = prime * result + ((modelName == null) ? 0 : modelName.hashCode());
98
		result = prime * result + ((modelNumber == null) ? 0 : modelNumber.hashCode());
99
		return result;
100
	}
101
 
102
	@Override
103
	public boolean equals(Object obj) {
104
		if (this == obj)
105
			return true;
106
		if (obj == null)
107
			return false;
108
		if (getClass() != obj.getClass())
109
			return false;
110
		CustomItemModel other = (CustomItemModel) obj;
111
		if (brand == null) {
112
			if (other.brand != null)
113
				return false;
114
		} else if (!brand.equals(other.brand))
115
			return false;
116
		if (color == null) {
117
			if (other.color != null)
118
				return false;
119
		} else if (!color.equals(other.color))
120
			return false;
121
		if (itemId != other.itemId)
122
			return false;
123
		if (modelName == null) {
124
			if (other.modelName != null)
125
				return false;
126
		} else if (!modelName.equals(other.modelName))
127
			return false;
128
		if (modelNumber == null) {
129
			if (other.modelNumber != null)
130
				return false;
131
		} else if (!modelNumber.equals(other.modelNumber))
132
			return false;
133
		return true;
134
	}
135
 
136
	@Override
137
	public String toString() {
138
		return "CustomItemModel [itemId=" + itemId + ", brand=" + brand + ", modelName=" + modelName + ", modelNumber="
29733 tejbeer 139
				+ modelNumber + ", color=" + color + ", type=" + type + "]";
29707 tejbeer 140
	}
141
 
142
}