Subversion Repositories SmartDukaan

Rev

Rev 21924 | Rev 22009 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21924 Rev 21984
Line 45... Line 45...
45
})
45
})
46
@Entity
46
@Entity
47
@Table(name="fofo.inventory_item", schema = "fofo")
47
@Table(name="fofo.inventory_item", schema = "fofo")
48
public class InventoryItem {
48
public class InventoryItem {
49
	
49
	
-
 
50
	@Override
-
 
51
	public int hashCode() {
-
 
52
		final int prime = 31;
-
 
53
		int result = 1;
-
 
54
		result = prime * result + badQuantity;
-
 
55
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
-
 
56
		result = prime * result + fofoId;
-
 
57
		result = prime * result + goodQuantity;
-
 
58
		result = prime * result + id;
-
 
59
		result = prime * result + initialQuantity;
-
 
60
		result = prime * result + ((item == null) ? 0 : item.hashCode());
-
 
61
		result = prime * result + itemId;
-
 
62
		result = prime * result + ((lastScanType == null) ? 0 : lastScanType.hashCode());
-
 
63
		result = prime * result + ((priceDropAmount == null) ? 0 : priceDropAmount.hashCode());
-
 
64
		result = prime * result + purchaseId;
-
 
65
		result = prime * result + ((serialNumber == null) ? 0 : serialNumber.hashCode());
-
 
66
		result = prime * result + ((unitPrice == null) ? 0 : unitPrice.hashCode());
-
 
67
		result = prime * result + ((updateTimestamp == null) ? 0 : updateTimestamp.hashCode());
-
 
68
		return result;
-
 
69
	}
-
 
70
 
-
 
71
	@Override
-
 
72
	public boolean equals(Object obj) {
-
 
73
		if (this == obj)
-
 
74
			return true;
-
 
75
		if (obj == null)
-
 
76
			return false;
-
 
77
		if (getClass() != obj.getClass())
-
 
78
			return false;
-
 
79
		InventoryItem other = (InventoryItem) obj;
-
 
80
		if (badQuantity != other.badQuantity)
-
 
81
			return false;
-
 
82
		if (createTimestamp == null) {
-
 
83
			if (other.createTimestamp != null)
-
 
84
				return false;
-
 
85
		} else if (!createTimestamp.equals(other.createTimestamp))
-
 
86
			return false;
-
 
87
		if (fofoId != other.fofoId)
-
 
88
			return false;
-
 
89
		if (goodQuantity != other.goodQuantity)
-
 
90
			return false;
-
 
91
		if (id != other.id)
-
 
92
			return false;
-
 
93
		if (initialQuantity != other.initialQuantity)
-
 
94
			return false;
-
 
95
		if (item == null) {
-
 
96
			if (other.item != null)
-
 
97
				return false;
-
 
98
		} else if (!item.equals(other.item))
-
 
99
			return false;
-
 
100
		if (itemId != other.itemId)
-
 
101
			return false;
-
 
102
		if (lastScanType != other.lastScanType)
-
 
103
			return false;
-
 
104
		if (priceDropAmount == null) {
-
 
105
			if (other.priceDropAmount != null)
-
 
106
				return false;
-
 
107
		} else if (!priceDropAmount.equals(other.priceDropAmount))
-
 
108
			return false;
-
 
109
		if (purchaseId != other.purchaseId)
-
 
110
			return false;
-
 
111
		if (serialNumber == null) {
-
 
112
			if (other.serialNumber != null)
-
 
113
				return false;
-
 
114
		} else if (!serialNumber.equals(other.serialNumber))
-
 
115
			return false;
-
 
116
		if (unitPrice == null) {
-
 
117
			if (other.unitPrice != null)
-
 
118
				return false;
-
 
119
		} else if (!unitPrice.equals(other.unitPrice))
-
 
120
			return false;
-
 
121
		if (updateTimestamp == null) {
-
 
122
			if (other.updateTimestamp != null)
-
 
123
				return false;
-
 
124
		} else if (!updateTimestamp.equals(other.updateTimestamp))
-
 
125
			return false;
-
 
126
		return true;
-
 
127
	}
-
 
128
 
50
	@Id
129
	@Id
51
	@Column(name="id", unique=true, updatable=false)
130
	@Column(name="id", unique=true, updatable=false)
52
	@GeneratedValue(strategy = GenerationType.IDENTITY)
131
	@GeneratedValue(strategy = GenerationType.IDENTITY)
53
	private int id;
132
	private int id;
54
	
133
	
Line 76... Line 155...
76
	
155
	
77
	@Column(name = "purchase_id")
156
	@Column(name = "purchase_id")
78
	private int purchaseId;
157
	private int purchaseId;
79
	
158
	
80
	@Column(name="unit_price")
159
	@Column(name="unit_price")
81
	private float unitPrice;
160
	private Float unitPrice;
82
	
161
	
83
	@Column(name = "price_drop_amount")
162
	@Column(name = "price_drop_amount")
84
	private float priceDropAmount;
163
	private Float priceDropAmount;
85
	
164
	
86
	@Convert(converter = LocalDateTimeAttributeConverter.class)
165
	@Convert(converter = LocalDateTimeAttributeConverter.class)
87
	@Column(name = "create_timestamp")
166
	@Column(name = "create_timestamp")
88
	private LocalDateTime createTimestamp = LocalDateTime.now();
167
	private LocalDateTime createTimestamp = LocalDateTime.now();
89
	
168
	
Line 108... Line 187...
108
	}
187
	}
109
 
188
 
110
	public void setItemId(int itemId) {
189
	public void setItemId(int itemId) {
111
		this.itemId = itemId;
190
		this.itemId = itemId;
112
	}
191
	}
-
 
192
	
-
 
193
	public void setFofoId(int fofoId) {
-
 
194
		this.fofoId = fofoId;
-
 
195
	}
113
 
196
 
114
	public int getFofoId() {
197
	public int getFofoId() {
115
		return fofoId;
198
		return fofoId;
116
	}
199
	}
117
 
200
 
118
	public float getUnitPrice() {
-
 
119
		return unitPrice;
-
 
120
	}
-
 
121
 
-
 
122
	public void setUnitPrice(float unitPrice) {
-
 
123
		this.unitPrice = unitPrice;
-
 
124
	}
-
 
125
 
-
 
126
	public void setFofoId(int fofoId) {
-
 
127
		this.fofoId = fofoId;
-
 
128
	}
-
 
129
 
-
 
130
	public String getSerialNumber() {
201
	public String getSerialNumber() {
131
		return serialNumber;
202
		return serialNumber;
132
	}
203
	}
133
	public void setSerialNumber(String serialNumber) {
204
	public void setSerialNumber(String serialNumber) {
134
		this.serialNumber = serialNumber;
205
		this.serialNumber = serialNumber;
135
	}
206
	}
136
	
207
	
137
 
-
 
138
	public int getInitialQuantity() {
208
	public int getInitialQuantity() {
139
		return initialQuantity;
209
		return initialQuantity;
140
	}
210
	}
141
 
211
 
-
 
212
	public Float getUnitPrice() {
-
 
213
		return unitPrice;
-
 
214
	}
-
 
215
 
-
 
216
	public void setUnitPrice(Float unitPrice) {
-
 
217
		this.unitPrice = unitPrice;
-
 
218
	}
-
 
219
 
142
	public void setInitialQuantity(int initialQuantity) {
220
	public void setInitialQuantity(int initialQuantity) {
143
		this.initialQuantity = initialQuantity;
221
		this.initialQuantity = initialQuantity;
144
	}
222
	}
145
 
223
 
146
	public int getGoodQuantity() {
224
	public int getGoodQuantity() {
Line 172... Line 250...
172
	}
250
	}
173
	public void setPurchaseId(int purchaseId) {
251
	public void setPurchaseId(int purchaseId) {
174
		this.purchaseId = purchaseId;
252
		this.purchaseId = purchaseId;
175
	}
253
	}
176
	
254
	
177
	public float getPriceDropAmount() {
255
	public Float getPriceDropAmount() {
178
		return priceDropAmount;
256
		return priceDropAmount;
179
	}
257
	}
180
	public void setPriceDropAmount(float priceDropAmount) {
258
	public void setPriceDropAmount(Float priceDropAmount) {
181
		this.priceDropAmount = priceDropAmount;
259
		this.priceDropAmount = priceDropAmount;
182
	}
260
	}
183
 
261
 
184
	public LocalDateTime getCreateTimestamp() {
262
	public LocalDateTime getCreateTimestamp() {
185
		return createTimestamp;
263
		return createTimestamp;
Line 200... Line 278...
200
		return item;
278
		return item;
201
	}
279
	}
202
	public void setItem(Item item) {
280
	public void setItem(Item item) {
203
		this.item = item;
281
		this.item = item;
204
	}
282
	}
205
	
-
 
206
	
-
 
207
 
-
 
208
	@Override
-
 
209
	public int hashCode() {
-
 
210
		final int prime = 31;
-
 
211
		int result = 1;
-
 
212
		result = prime * result + badQuantity;
-
 
213
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
-
 
214
		result = prime * result + fofoId;
-
 
215
		result = prime * result + goodQuantity;
-
 
216
		result = prime * result + id;
-
 
217
		result = prime * result + initialQuantity;
-
 
218
		result = prime * result + ((item == null) ? 0 : item.hashCode());
-
 
219
		result = prime * result + itemId;
-
 
220
		result = prime * result + ((lastScanType == null) ? 0 : lastScanType.hashCode());
-
 
221
		result = prime * result + Float.floatToIntBits(priceDropAmount);
-
 
222
		result = prime * result + purchaseId;
-
 
223
		result = prime * result + ((serialNumber == null) ? 0 : serialNumber.hashCode());
-
 
224
		result = prime * result + Float.floatToIntBits(unitPrice);
-
 
225
		result = prime * result + ((updateTimestamp == null) ? 0 : updateTimestamp.hashCode());
-
 
226
		return result;
-
 
227
	}
-
 
228
 
-
 
229
	@Override
-
 
230
	public boolean equals(Object obj) {
-
 
231
		if (this == obj)
-
 
232
			return true;
-
 
233
		if (obj == null)
-
 
234
			return false;
-
 
235
		if (getClass() != obj.getClass())
-
 
236
			return false;
-
 
237
		InventoryItem other = (InventoryItem) obj;
-
 
238
		if (badQuantity != other.badQuantity)
-
 
239
			return false;
-
 
240
		if (createTimestamp == null) {
-
 
241
			if (other.createTimestamp != null)
-
 
242
				return false;
-
 
243
		} else if (!createTimestamp.equals(other.createTimestamp))
-
 
244
			return false;
-
 
245
		if (fofoId != other.fofoId)
-
 
246
			return false;
-
 
247
		if (goodQuantity != other.goodQuantity)
-
 
248
			return false;
-
 
249
		if (id != other.id)
-
 
250
			return false;
-
 
251
		if (initialQuantity != other.initialQuantity)
-
 
252
			return false;
-
 
253
		if (item == null) {
-
 
254
			if (other.item != null)
-
 
255
				return false;
-
 
256
		} else if (!item.equals(other.item))
-
 
257
			return false;
-
 
258
		if (itemId != other.itemId)
-
 
259
			return false;
-
 
260
		if (lastScanType != other.lastScanType)
-
 
261
			return false;
-
 
262
		if (Float.floatToIntBits(priceDropAmount) != Float.floatToIntBits(other.priceDropAmount))
-
 
263
			return false;
-
 
264
		if (purchaseId != other.purchaseId)
-
 
265
			return false;
-
 
266
		if (serialNumber == null) {
-
 
267
			if (other.serialNumber != null)
-
 
268
				return false;
-
 
269
		} else if (!serialNumber.equals(other.serialNumber))
-
 
270
			return false;
-
 
271
		if (Float.floatToIntBits(unitPrice) != Float.floatToIntBits(other.unitPrice))
-
 
272
			return false;
-
 
273
		if (updateTimestamp == null) {
-
 
274
			if (other.updateTimestamp != null)
-
 
275
				return false;
-
 
276
		} else if (!updateTimestamp.equals(other.updateTimestamp))
-
 
277
			return false;
-
 
278
		return true;
-
 
279
	}
-
 
280
 
283
 
281
	@Override
284
	@Override
282
	public String toString() {
285
	public String toString() {
283
		return "InventoryItem [id=" + id + ", itemId=" + itemId + ", fofoId=" + fofoId + ", serialNumber="
286
		return "InventoryItem [id=" + id + ", itemId=" + itemId + ", fofoId=" + fofoId + ", serialNumber="
284
				+ serialNumber + ", initialQuantity=" + initialQuantity + ", goodQuantity=" + goodQuantity
287
				+ serialNumber + ", initialQuantity=" + initialQuantity + ", goodQuantity=" + goodQuantity
Line 286... Line 289...
286
				+ ", unitPrice=" + unitPrice + ", priceDropAmount=" + priceDropAmount + ", createTimestamp="
289
				+ ", unitPrice=" + unitPrice + ", priceDropAmount=" + priceDropAmount + ", createTimestamp="
287
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", item=" + item + "]";
290
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", item=" + item + "]";
288
	}
291
	}
289
 
292
 
290
	
293
	
-
 
294
	
-
 
295
	
-
 
296
	
291
}
297
}