Subversion Repositories SmartDukaan

Rev

Rev 24440 | Rev 25726 | 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
 
22216 ashik.ali 124
 
24880 govind 125
	public String getFormattedCreateTimestamp(){
126
		if(createTimestamp == null){
127
			return null;
128
		}
129
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
130
		return createTimestamp.format(formatter);
131
    }
132
 
22216 ashik.ali 133
	public int getId() {
134
		return id;
135
	}
136
 
137
	public void setId(int id) {
138
		this.id = id;
139
	}
140
 
141
	public String getInvoiceNumber() {
142
		return invoiceNumber;
143
	}
144
	public void setInvoiceNumber(String invoiceNumber) {
145
		this.invoiceNumber = invoiceNumber;
146
	}
147
 
148
	public int getRetailerId() {
149
		return retailerId;
150
	}
151
 
152
	public void setRetailerId(int retailerId) {
153
		this.retailerId = retailerId;
154
	}
155
 
156
	public float getPurchaseAmount() {
157
		return purchaseAmount;
158
	}
159
 
160
	public void setPurchaseAmount(float purchaseAmount) {
161
		this.purchaseAmount = purchaseAmount;
162
	}
163
 
164
	public float getSaleAmount() {
165
		return saleAmount;
166
	}
167
 
168
	public void setSaleAmount(float saleAmount) {
169
		this.saleAmount = saleAmount;
170
	}
171
 
172
	public float getSellingPrice() {
173
		return sellingPrice;
174
	}
175
 
176
	public void setSellingPrice(float sellingPrice) {
177
		this.sellingPrice = sellingPrice;
178
	}
179
 
180
	public String getSerialNumber() {
181
		return serialNumber;
182
	}
183
 
184
	public void setSerialNumber(String serialNumber) {
185
		this.serialNumber = serialNumber;
186
	}
187
 
188
	public String getModelName() {
189
		return modelName;
190
	}
191
	public void setModelName(String modelName) {
192
		this.modelName = modelName;
193
	}
194
 
195
	public String getBrand() {
196
		return brand;
197
	}
198
	public void setBrand(String brand) {
199
		this.brand = brand;
200
	}
201
 
202
	public String getPolicyNumber() {
203
		return policyNumber;
204
	}
205
 
206
	public void setPolicyNumber(String policyNumber) {
207
		this.policyNumber = policyNumber;
208
	}
209
 
210
	public int getProviderId() {
211
		return providerId;
212
	}
213
 
214
	public void setProviderId(int providerId) {
215
		this.providerId = providerId;
216
	}
22243 ashik.ali 217
 
218
	public String getCustomerFirstName() {
219
		return customerFirstName;
220
	}
221
	public void setCustomerFirstName(String customerFirstName) {
222
		this.customerFirstName = customerFirstName;
223
	}
224
	public String getCustomerLastName() {
225
		return customerLastName;
226
	}
227
	public void setCustomerLastName(String customerLastName) {
228
		this.customerLastName = customerLastName;
229
	}
230
	public String getCustomerMobileNumber() {
231
		return customerMobileNumber;
232
	}
233
	public void setCustomerMobileNumber(String customerMobileNumber) {
234
		this.customerMobileNumber = customerMobileNumber;
235
	}
236
	public String getCustomerEmailId() {
237
		return customerEmailId;
238
	}
239
	public void setCustomerEmailId(String customerEmailId) {
240
		this.customerEmailId = customerEmailId;
241
	}
242
	public LocalDate getCustomerDateOfBirth() {
243
		return customerDateOfBirth;
244
	}
245
	public void setCustomerDateOfBirth(LocalDate customerDateOfBirth) {
246
		this.customerDateOfBirth = customerDateOfBirth;
247
	}
248
	public String getCustomerAddress1() {
249
		return customerAddress1;
250
	}
251
	public void setCustomerAddress1(String customerAddress1) {
252
		this.customerAddress1 = customerAddress1;
253
	}
254
	public String getCustomerAddress2() {
255
		return customerAddress2;
256
	}
257
	public void setCustomerAddress2(String customerAddress2) {
258
		this.customerAddress2 = customerAddress2;
259
	}
260
	public String getCustomerCity() {
261
		return customerCity;
262
	}
263
	public void setCustomerCity(String customerCity) {
264
		this.customerCity = customerCity;
265
	}
266
	public String getCustomerPinCode() {
267
		return customerPinCode;
268
	}
269
	public void setCustomerPinCode(String customerPinCode) {
270
		this.customerPinCode = customerPinCode;
271
	}
272
	public String getCustomerState() {
273
		return customerState;
274
	}
275
	public void setCustomerState(String customerState) {
276
		this.customerState = customerState;
277
	}
22216 ashik.ali 278
 
22243 ashik.ali 279
	public boolean isPosted() {
280
		return posted;
281
	}
282
 
283
	public void setPosted(boolean posted) {
284
		this.posted = posted;
285
	}
23344 ashik.ali 286
 
287
	public InsuranceProvider getInsuranceProvider() {
288
		return insuranceProvider;
289
	}
290
 
291
	public void setInsuranceProvider(InsuranceProvider insuranceProvider) {
292
		this.insuranceProvider = insuranceProvider;
293
	}
294
 
22216 ashik.ali 295
	public LocalDateTime getCreateTimestamp() {
296
		return createTimestamp;
297
	}
298
 
299
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
300
		this.createTimestamp = createTimestamp;
301
	}
302
 
303
	public LocalDateTime getInvoiceCreationTimestamp() {
304
		return invoiceCreationTimestamp;
305
	}
306
 
307
	public void setInvoiceCreationTimestamp(LocalDateTime invoiceCreationTimestamp) {
308
		this.invoiceCreationTimestamp = invoiceCreationTimestamp;
309
	}
310
 
311
	@Override
312
	public int hashCode() {
313
		final int prime = 31;
314
		int result = 1;
24440 amit.gupta 315
		result = prime * result + ((brand == null) ? 0 : brand.hashCode());
316
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
317
		result = prime * result + ((customerAddress1 == null) ? 0 : customerAddress1.hashCode());
318
		result = prime * result + ((customerAddress2 == null) ? 0 : customerAddress2.hashCode());
319
		result = prime * result + ((customerCity == null) ? 0 : customerCity.hashCode());
320
		result = prime * result + ((customerDateOfBirth == null) ? 0 : customerDateOfBirth.hashCode());
321
		result = prime * result + ((customerEmailId == null) ? 0 : customerEmailId.hashCode());
322
		result = prime * result + ((customerFirstName == null) ? 0 : customerFirstName.hashCode());
323
		result = prime * result + ((customerLastName == null) ? 0 : customerLastName.hashCode());
324
		result = prime * result + ((customerMobileNumber == null) ? 0 : customerMobileNumber.hashCode());
325
		result = prime * result + ((customerPinCode == null) ? 0 : customerPinCode.hashCode());
326
		result = prime * result + ((customerState == null) ? 0 : customerState.hashCode());
22216 ashik.ali 327
		result = prime * result + id;
24440 amit.gupta 328
		result = prime * result + ((insuranceProvider == null) ? 0 : insuranceProvider.hashCode());
329
		result = prime * result + ((invoiceCreationTimestamp == null) ? 0 : invoiceCreationTimestamp.hashCode());
330
		result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());
331
		result = prime * result + ((modelName == null) ? 0 : modelName.hashCode());
332
		result = prime * result + ((policyNumber == null) ? 0 : policyNumber.hashCode());
333
		result = prime * result + (posted ? 1231 : 1237);
334
		result = prime * result + ((productName == null) ? 0 : productName.hashCode());
335
		result = prime * result + providerId;
336
		result = prime * result + Float.floatToIntBits(purchaseAmount);
337
		result = prime * result + retailerId;
338
		result = prime * result + Float.floatToIntBits(saleAmount);
339
		result = prime * result + Float.floatToIntBits(sellingPrice);
340
		result = prime * result + ((serialNumber == null) ? 0 : serialNumber.hashCode());
22216 ashik.ali 341
		return result;
342
	}
343
 
344
	@Override
345
	public boolean equals(Object obj) {
346
		if (this == obj)
347
			return true;
348
		if (obj == null)
349
			return false;
350
		if (getClass() != obj.getClass())
351
			return false;
352
		InsurancePolicy other = (InsurancePolicy) obj;
24440 amit.gupta 353
		if (brand == null) {
354
			if (other.brand != null)
355
				return false;
356
		} else if (!brand.equals(other.brand))
357
			return false;
358
		if (createTimestamp == null) {
359
			if (other.createTimestamp != null)
360
				return false;
361
		} else if (!createTimestamp.equals(other.createTimestamp))
362
			return false;
363
		if (customerAddress1 == null) {
364
			if (other.customerAddress1 != null)
365
				return false;
366
		} else if (!customerAddress1.equals(other.customerAddress1))
367
			return false;
368
		if (customerAddress2 == null) {
369
			if (other.customerAddress2 != null)
370
				return false;
371
		} else if (!customerAddress2.equals(other.customerAddress2))
372
			return false;
373
		if (customerCity == null) {
374
			if (other.customerCity != null)
375
				return false;
376
		} else if (!customerCity.equals(other.customerCity))
377
			return false;
378
		if (customerDateOfBirth == null) {
379
			if (other.customerDateOfBirth != null)
380
				return false;
381
		} else if (!customerDateOfBirth.equals(other.customerDateOfBirth))
382
			return false;
383
		if (customerEmailId == null) {
384
			if (other.customerEmailId != null)
385
				return false;
386
		} else if (!customerEmailId.equals(other.customerEmailId))
387
			return false;
388
		if (customerFirstName == null) {
389
			if (other.customerFirstName != null)
390
				return false;
391
		} else if (!customerFirstName.equals(other.customerFirstName))
392
			return false;
393
		if (customerLastName == null) {
394
			if (other.customerLastName != null)
395
				return false;
396
		} else if (!customerLastName.equals(other.customerLastName))
397
			return false;
398
		if (customerMobileNumber == null) {
399
			if (other.customerMobileNumber != null)
400
				return false;
401
		} else if (!customerMobileNumber.equals(other.customerMobileNumber))
402
			return false;
403
		if (customerPinCode == null) {
404
			if (other.customerPinCode != null)
405
				return false;
406
		} else if (!customerPinCode.equals(other.customerPinCode))
407
			return false;
408
		if (customerState == null) {
409
			if (other.customerState != null)
410
				return false;
411
		} else if (!customerState.equals(other.customerState))
412
			return false;
22216 ashik.ali 413
		if (id != other.id)
414
			return false;
24440 amit.gupta 415
		if (insuranceProvider == null) {
416
			if (other.insuranceProvider != null)
417
				return false;
418
		} else if (!insuranceProvider.equals(other.insuranceProvider))
419
			return false;
420
		if (invoiceCreationTimestamp == null) {
421
			if (other.invoiceCreationTimestamp != null)
422
				return false;
423
		} else if (!invoiceCreationTimestamp.equals(other.invoiceCreationTimestamp))
424
			return false;
425
		if (invoiceNumber == null) {
426
			if (other.invoiceNumber != null)
427
				return false;
428
		} else if (!invoiceNumber.equals(other.invoiceNumber))
429
			return false;
430
		if (modelName == null) {
431
			if (other.modelName != null)
432
				return false;
433
		} else if (!modelName.equals(other.modelName))
434
			return false;
435
		if (policyNumber == null) {
436
			if (other.policyNumber != null)
437
				return false;
438
		} else if (!policyNumber.equals(other.policyNumber))
439
			return false;
440
		if (posted != other.posted)
441
			return false;
442
		if (productName.equals(other.productName))
443
			return false;
444
		if (providerId != other.providerId)
445
			return false;
446
		if (Float.floatToIntBits(purchaseAmount) != Float.floatToIntBits(other.purchaseAmount))
447
			return false;
448
		if (retailerId != other.retailerId)
449
			return false;
450
		if (Float.floatToIntBits(saleAmount) != Float.floatToIntBits(other.saleAmount))
451
			return false;
452
		if (Float.floatToIntBits(sellingPrice) != Float.floatToIntBits(other.sellingPrice))
453
			return false;
454
		if (serialNumber == null) {
455
			if (other.serialNumber != null)
456
				return false;
457
		} else if (!serialNumber.equals(other.serialNumber))
458
			return false;
22216 ashik.ali 459
		return true;
460
	}
461
 
462
	@Override
463
	public String toString() {
464
		return "InsurancePolicy [id=" + id + ", invoiceNumber=" + invoiceNumber + ", retailerId=" + retailerId
465
				+ ", purchaseAmount=" + purchaseAmount + ", saleAmount=" + saleAmount + ", sellingPrice=" + sellingPrice
24440 amit.gupta 466
				+ ", productName=" + productName + ", serialNumber=" + serialNumber + ", modelName=" + modelName
467
				+ ", brand=" + brand + ", policyNumber=" + policyNumber + ", providerId=" + providerId
468
				+ ", customerFirstName=" + customerFirstName + ", customerLastName=" + customerLastName
469
				+ ", customerMobileNumber=" + customerMobileNumber + ", customerEmailId=" + customerEmailId
470
				+ ", customerDateOfBirth=" + customerDateOfBirth + ", customerAddress1=" + customerAddress1
471
				+ ", customerAddress2=" + customerAddress2 + ", customerCity=" + customerCity + ", customerPinCode="
472
				+ customerPinCode + ", customerState=" + customerState + ", posted=" + posted + ", insuranceProvider="
473
				+ insuranceProvider + ", createTimestamp=" + createTimestamp + ", invoiceCreationTimestamp="
23269 ashik.ali 474
				+ invoiceCreationTimestamp + "]";
22216 ashik.ali 475
	}
476
 
22243 ashik.ali 477
 
22216 ashik.ali 478
}