Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
22216 ashik.ali 1
package com.spice.profitmandi.dao.entity.dtr;
2
 
3
import java.io.Serializable;
22243 ashik.ali 4
import java.time.LocalDate;
22216 ashik.ali 5
import java.time.LocalDateTime;
6
 
7
import javax.persistence.Column;
8
import javax.persistence.Convert;
9
import javax.persistence.Entity;
10
import javax.persistence.GeneratedValue;
11
import javax.persistence.GenerationType;
12
import javax.persistence.Id;
13
import javax.persistence.Table;
23344 ashik.ali 14
import javax.persistence.Transient;
22216 ashik.ali 15
 
16
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
17
 
18
/**
19
 * This class basically contains insurance details
20
 * 
21
 * @author ashikali
22
 *
23
 */
24
@Entity
25
@Table(name="dtr.insurance_policy", schema = "dtr")
26
public class InsurancePolicy implements Serializable{
27
 
28
	private static final long serialVersionUID = 1L;
29
 
30
	public InsurancePolicy() {
31
	}
32
 
33
	@Id
34
	@Column(name="id", unique=true, updatable=false)
35
	@GeneratedValue(strategy = GenerationType.IDENTITY)
36
	private int id;
37
 
38
	@Column(name = "invoice_number")
39
	private String invoiceNumber;
40
 
41
	@Column(name="retailer_id")
42
	private int retailerId;
43
 
44
	@Column(name= "purchase_amount")
45
	private float purchaseAmount;
46
 
47
	@Column(name= "sale_amount")
48
	private float saleAmount;
49
 
50
	@Column(name= "selling_price")
51
	private float sellingPrice;
52
 
24440 amit.gupta 53
	@Column(name= "product_name")
54
	private String productName;
55
 
56
	public String getProductName() {
57
		return productName;
58
	}
59
 
60
	public void setProductName(String productName) {
61
		this.productName = productName;
62
	}
63
 
22216 ashik.ali 64
	@Column(name = "serial_number", unique = true)
65
	private String serialNumber;
66
 
67
	@Column(name = "model_name")
68
	private String modelName;
69
 
70
	@Column(name = "brand")
71
	private String brand;
72
 
73
	@Column(name = "policy_number")
74
	private String policyNumber;
75
 
76
	@Column(name="provider_id")
77
	private int providerId;
78
 
22243 ashik.ali 79
	@Column(name = "customer_first_name")
80
	private String customerFirstName;
81
 
82
	@Column(name = "customer_last_name")
83
	private String customerLastName;
84
 
85
	@Column(name = "customer_mobile_number")
86
	private String customerMobileNumber;
87
 
88
	@Column(name = "customer_email_id")
89
	private String customerEmailId;
90
 
91
	@Column(name = "customer_date_of_birth")
92
	private LocalDate customerDateOfBirth = LocalDate.now();
93
 
94
	@Column(name = "customer_address1")
95
	private String customerAddress1;
96
 
97
	@Column(name = "customer_address2")
98
	private String customerAddress2;
99
 
100
	@Column(name = "customer_city")
101
	private String customerCity;
102
 
103
	@Column(name = "customer_pin_code")
104
	private String customerPinCode;
105
 
106
	@Column(name = "customer_state")
107
	private String customerState;
108
 
109
	@Column(name = "posted", columnDefinition = "tinyint(1) default 0")
110
	private boolean posted;
111
 
23344 ashik.ali 112
	@Transient
113
	private InsuranceProvider insuranceProvider;
114
 
22216 ashik.ali 115
	@Convert(converter = LocalDateTimeAttributeConverter.class)
116
	@Column(name="create_timestamp", updatable = false)
117
	private LocalDateTime createTimestamp = LocalDateTime.now();
118
 
119
	@Convert(converter = LocalDateTimeAttributeConverter.class)
120
	@Column(name="invoice_creation_timestamp")
121
	private LocalDateTime invoiceCreationTimestamp = LocalDateTime.now();
22243 ashik.ali 122
 
22216 ashik.ali 123
 
124
	public int getId() {
125
		return id;
126
	}
127
 
128
	public void setId(int id) {
129
		this.id = id;
130
	}
131
 
132
	public String getInvoiceNumber() {
133
		return invoiceNumber;
134
	}
135
	public void setInvoiceNumber(String invoiceNumber) {
136
		this.invoiceNumber = invoiceNumber;
137
	}
138
 
139
	public int getRetailerId() {
140
		return retailerId;
141
	}
142
 
143
	public void setRetailerId(int retailerId) {
144
		this.retailerId = retailerId;
145
	}
146
 
147
	public float getPurchaseAmount() {
148
		return purchaseAmount;
149
	}
150
 
151
	public void setPurchaseAmount(float purchaseAmount) {
152
		this.purchaseAmount = purchaseAmount;
153
	}
154
 
155
	public float getSaleAmount() {
156
		return saleAmount;
157
	}
158
 
159
	public void setSaleAmount(float saleAmount) {
160
		this.saleAmount = saleAmount;
161
	}
162
 
163
	public float getSellingPrice() {
164
		return sellingPrice;
165
	}
166
 
167
	public void setSellingPrice(float sellingPrice) {
168
		this.sellingPrice = sellingPrice;
169
	}
170
 
171
	public String getSerialNumber() {
172
		return serialNumber;
173
	}
174
 
175
	public void setSerialNumber(String serialNumber) {
176
		this.serialNumber = serialNumber;
177
	}
178
 
179
	public String getModelName() {
180
		return modelName;
181
	}
182
	public void setModelName(String modelName) {
183
		this.modelName = modelName;
184
	}
185
 
186
	public String getBrand() {
187
		return brand;
188
	}
189
	public void setBrand(String brand) {
190
		this.brand = brand;
191
	}
192
 
193
	public String getPolicyNumber() {
194
		return policyNumber;
195
	}
196
 
197
	public void setPolicyNumber(String policyNumber) {
198
		this.policyNumber = policyNumber;
199
	}
200
 
201
	public int getProviderId() {
202
		return providerId;
203
	}
204
 
205
	public void setProviderId(int providerId) {
206
		this.providerId = providerId;
207
	}
22243 ashik.ali 208
 
209
	public String getCustomerFirstName() {
210
		return customerFirstName;
211
	}
212
	public void setCustomerFirstName(String customerFirstName) {
213
		this.customerFirstName = customerFirstName;
214
	}
215
	public String getCustomerLastName() {
216
		return customerLastName;
217
	}
218
	public void setCustomerLastName(String customerLastName) {
219
		this.customerLastName = customerLastName;
220
	}
221
	public String getCustomerMobileNumber() {
222
		return customerMobileNumber;
223
	}
224
	public void setCustomerMobileNumber(String customerMobileNumber) {
225
		this.customerMobileNumber = customerMobileNumber;
226
	}
227
	public String getCustomerEmailId() {
228
		return customerEmailId;
229
	}
230
	public void setCustomerEmailId(String customerEmailId) {
231
		this.customerEmailId = customerEmailId;
232
	}
233
	public LocalDate getCustomerDateOfBirth() {
234
		return customerDateOfBirth;
235
	}
236
	public void setCustomerDateOfBirth(LocalDate customerDateOfBirth) {
237
		this.customerDateOfBirth = customerDateOfBirth;
238
	}
239
	public String getCustomerAddress1() {
240
		return customerAddress1;
241
	}
242
	public void setCustomerAddress1(String customerAddress1) {
243
		this.customerAddress1 = customerAddress1;
244
	}
245
	public String getCustomerAddress2() {
246
		return customerAddress2;
247
	}
248
	public void setCustomerAddress2(String customerAddress2) {
249
		this.customerAddress2 = customerAddress2;
250
	}
251
	public String getCustomerCity() {
252
		return customerCity;
253
	}
254
	public void setCustomerCity(String customerCity) {
255
		this.customerCity = customerCity;
256
	}
257
	public String getCustomerPinCode() {
258
		return customerPinCode;
259
	}
260
	public void setCustomerPinCode(String customerPinCode) {
261
		this.customerPinCode = customerPinCode;
262
	}
263
	public String getCustomerState() {
264
		return customerState;
265
	}
266
	public void setCustomerState(String customerState) {
267
		this.customerState = customerState;
268
	}
22216 ashik.ali 269
 
22243 ashik.ali 270
	public boolean isPosted() {
271
		return posted;
272
	}
273
 
274
	public void setPosted(boolean posted) {
275
		this.posted = posted;
276
	}
23344 ashik.ali 277
 
278
	public InsuranceProvider getInsuranceProvider() {
279
		return insuranceProvider;
280
	}
281
 
282
	public void setInsuranceProvider(InsuranceProvider insuranceProvider) {
283
		this.insuranceProvider = insuranceProvider;
284
	}
285
 
22216 ashik.ali 286
	public LocalDateTime getCreateTimestamp() {
287
		return createTimestamp;
288
	}
289
 
290
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
291
		this.createTimestamp = createTimestamp;
292
	}
293
 
294
	public LocalDateTime getInvoiceCreationTimestamp() {
295
		return invoiceCreationTimestamp;
296
	}
297
 
298
	public void setInvoiceCreationTimestamp(LocalDateTime invoiceCreationTimestamp) {
299
		this.invoiceCreationTimestamp = invoiceCreationTimestamp;
300
	}
301
 
302
	@Override
303
	public int hashCode() {
304
		final int prime = 31;
305
		int result = 1;
24440 amit.gupta 306
		result = prime * result + ((brand == null) ? 0 : brand.hashCode());
307
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
308
		result = prime * result + ((customerAddress1 == null) ? 0 : customerAddress1.hashCode());
309
		result = prime * result + ((customerAddress2 == null) ? 0 : customerAddress2.hashCode());
310
		result = prime * result + ((customerCity == null) ? 0 : customerCity.hashCode());
311
		result = prime * result + ((customerDateOfBirth == null) ? 0 : customerDateOfBirth.hashCode());
312
		result = prime * result + ((customerEmailId == null) ? 0 : customerEmailId.hashCode());
313
		result = prime * result + ((customerFirstName == null) ? 0 : customerFirstName.hashCode());
314
		result = prime * result + ((customerLastName == null) ? 0 : customerLastName.hashCode());
315
		result = prime * result + ((customerMobileNumber == null) ? 0 : customerMobileNumber.hashCode());
316
		result = prime * result + ((customerPinCode == null) ? 0 : customerPinCode.hashCode());
317
		result = prime * result + ((customerState == null) ? 0 : customerState.hashCode());
22216 ashik.ali 318
		result = prime * result + id;
24440 amit.gupta 319
		result = prime * result + ((insuranceProvider == null) ? 0 : insuranceProvider.hashCode());
320
		result = prime * result + ((invoiceCreationTimestamp == null) ? 0 : invoiceCreationTimestamp.hashCode());
321
		result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());
322
		result = prime * result + ((modelName == null) ? 0 : modelName.hashCode());
323
		result = prime * result + ((policyNumber == null) ? 0 : policyNumber.hashCode());
324
		result = prime * result + (posted ? 1231 : 1237);
325
		result = prime * result + ((productName == null) ? 0 : productName.hashCode());
326
		result = prime * result + providerId;
327
		result = prime * result + Float.floatToIntBits(purchaseAmount);
328
		result = prime * result + retailerId;
329
		result = prime * result + Float.floatToIntBits(saleAmount);
330
		result = prime * result + Float.floatToIntBits(sellingPrice);
331
		result = prime * result + ((serialNumber == null) ? 0 : serialNumber.hashCode());
22216 ashik.ali 332
		return result;
333
	}
334
 
335
	@Override
336
	public boolean equals(Object obj) {
337
		if (this == obj)
338
			return true;
339
		if (obj == null)
340
			return false;
341
		if (getClass() != obj.getClass())
342
			return false;
343
		InsurancePolicy other = (InsurancePolicy) obj;
24440 amit.gupta 344
		if (brand == null) {
345
			if (other.brand != null)
346
				return false;
347
		} else if (!brand.equals(other.brand))
348
			return false;
349
		if (createTimestamp == null) {
350
			if (other.createTimestamp != null)
351
				return false;
352
		} else if (!createTimestamp.equals(other.createTimestamp))
353
			return false;
354
		if (customerAddress1 == null) {
355
			if (other.customerAddress1 != null)
356
				return false;
357
		} else if (!customerAddress1.equals(other.customerAddress1))
358
			return false;
359
		if (customerAddress2 == null) {
360
			if (other.customerAddress2 != null)
361
				return false;
362
		} else if (!customerAddress2.equals(other.customerAddress2))
363
			return false;
364
		if (customerCity == null) {
365
			if (other.customerCity != null)
366
				return false;
367
		} else if (!customerCity.equals(other.customerCity))
368
			return false;
369
		if (customerDateOfBirth == null) {
370
			if (other.customerDateOfBirth != null)
371
				return false;
372
		} else if (!customerDateOfBirth.equals(other.customerDateOfBirth))
373
			return false;
374
		if (customerEmailId == null) {
375
			if (other.customerEmailId != null)
376
				return false;
377
		} else if (!customerEmailId.equals(other.customerEmailId))
378
			return false;
379
		if (customerFirstName == null) {
380
			if (other.customerFirstName != null)
381
				return false;
382
		} else if (!customerFirstName.equals(other.customerFirstName))
383
			return false;
384
		if (customerLastName == null) {
385
			if (other.customerLastName != null)
386
				return false;
387
		} else if (!customerLastName.equals(other.customerLastName))
388
			return false;
389
		if (customerMobileNumber == null) {
390
			if (other.customerMobileNumber != null)
391
				return false;
392
		} else if (!customerMobileNumber.equals(other.customerMobileNumber))
393
			return false;
394
		if (customerPinCode == null) {
395
			if (other.customerPinCode != null)
396
				return false;
397
		} else if (!customerPinCode.equals(other.customerPinCode))
398
			return false;
399
		if (customerState == null) {
400
			if (other.customerState != null)
401
				return false;
402
		} else if (!customerState.equals(other.customerState))
403
			return false;
22216 ashik.ali 404
		if (id != other.id)
405
			return false;
24440 amit.gupta 406
		if (insuranceProvider == null) {
407
			if (other.insuranceProvider != null)
408
				return false;
409
		} else if (!insuranceProvider.equals(other.insuranceProvider))
410
			return false;
411
		if (invoiceCreationTimestamp == null) {
412
			if (other.invoiceCreationTimestamp != null)
413
				return false;
414
		} else if (!invoiceCreationTimestamp.equals(other.invoiceCreationTimestamp))
415
			return false;
416
		if (invoiceNumber == null) {
417
			if (other.invoiceNumber != null)
418
				return false;
419
		} else if (!invoiceNumber.equals(other.invoiceNumber))
420
			return false;
421
		if (modelName == null) {
422
			if (other.modelName != null)
423
				return false;
424
		} else if (!modelName.equals(other.modelName))
425
			return false;
426
		if (policyNumber == null) {
427
			if (other.policyNumber != null)
428
				return false;
429
		} else if (!policyNumber.equals(other.policyNumber))
430
			return false;
431
		if (posted != other.posted)
432
			return false;
433
		if (productName.equals(other.productName))
434
			return false;
435
		if (providerId != other.providerId)
436
			return false;
437
		if (Float.floatToIntBits(purchaseAmount) != Float.floatToIntBits(other.purchaseAmount))
438
			return false;
439
		if (retailerId != other.retailerId)
440
			return false;
441
		if (Float.floatToIntBits(saleAmount) != Float.floatToIntBits(other.saleAmount))
442
			return false;
443
		if (Float.floatToIntBits(sellingPrice) != Float.floatToIntBits(other.sellingPrice))
444
			return false;
445
		if (serialNumber == null) {
446
			if (other.serialNumber != null)
447
				return false;
448
		} else if (!serialNumber.equals(other.serialNumber))
449
			return false;
22216 ashik.ali 450
		return true;
451
	}
452
 
453
	@Override
454
	public String toString() {
455
		return "InsurancePolicy [id=" + id + ", invoiceNumber=" + invoiceNumber + ", retailerId=" + retailerId
456
				+ ", purchaseAmount=" + purchaseAmount + ", saleAmount=" + saleAmount + ", sellingPrice=" + sellingPrice
24440 amit.gupta 457
				+ ", productName=" + productName + ", serialNumber=" + serialNumber + ", modelName=" + modelName
458
				+ ", brand=" + brand + ", policyNumber=" + policyNumber + ", providerId=" + providerId
459
				+ ", customerFirstName=" + customerFirstName + ", customerLastName=" + customerLastName
460
				+ ", customerMobileNumber=" + customerMobileNumber + ", customerEmailId=" + customerEmailId
461
				+ ", customerDateOfBirth=" + customerDateOfBirth + ", customerAddress1=" + customerAddress1
462
				+ ", customerAddress2=" + customerAddress2 + ", customerCity=" + customerCity + ", customerPinCode="
463
				+ customerPinCode + ", customerState=" + customerState + ", posted=" + posted + ", insuranceProvider="
464
				+ insuranceProvider + ", createTimestamp=" + createTimestamp + ", invoiceCreationTimestamp="
23269 ashik.ali 465
				+ invoiceCreationTimestamp + "]";
22216 ashik.ali 466
	}
467
 
22243 ashik.ali 468
 
22216 ashik.ali 469
}