Subversion Repositories SmartDukaan

Rev

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