Subversion Repositories SmartDukaan

Rev

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