Subversion Repositories SmartDukaan

Rev

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