Rev 29707 | Rev 31044 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.entity.dtr;import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;import javax.persistence.*;import java.io.Serializable;import java.time.LocalDate;import java.time.LocalDateTime;import java.time.format.DateTimeFormatter;import java.util.Objects;/*** This class basically contains insurance details** @author ashikali**/@Entity@Table(name = "dtr.insurance_policy", schema = "dtr")public class InsurancePolicy implements Serializable {private static final long serialVersionUID = 1L;public InsurancePolicy() {}@Id@Column(name = "id", unique = true, updatable = false)@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;@Column(name = "invoice_number")private String invoiceNumber;@Column(name = "retailer_id")private int retailerId;@Column(name = "purchase_amount")private float purchaseAmount;@Column(name = "sale_amount")private float saleAmount;@Column(name = "selling_price")private float sellingPrice;@Column(name = "product_name")private String productName;public String getProductName() {return productName;}public void setProductName(String productName) {this.productName = productName;}@Column(name = "serial_number", unique = true)private String serialNumber;@Column(name = "model_name")private String modelName;@Column(name = "brand")private String brand;@Column(name = "policy_number")private String policyNumber;@Column(name = "policy_plan")private String policyPlan;@Column(name = "provider_id")private int providerId;@Column(name = "customer_first_name")private String customerFirstName;@Column(name = "customer_last_name")private String customerLastName;@Column(name = "customer_mobile_number")private String customerMobileNumber;@Column(name = "customer_email_id")private String customerEmailId;@Column(name = "customer_date_of_birth")private LocalDate customerDateOfBirth = LocalDate.now();@Column(name = "customer_address1")private String customerAddress1;@Column(name = "customer_address2")private String customerAddress2;@Column(name = "customer_city")private String customerCity;@Column(name = "customer_pin_code")private String customerPinCode;@Column(name = "customer_state")private String customerState;@Column(name = "device_invoice_number")private String deviceInvoiceNumber;@Column(name = "posted", columnDefinition = "tinyint(1) default 0")private boolean posted;@Transientprivate InsuranceProvider insuranceProvider;@Convert(converter = LocalDateTimeAttributeConverter.class)@Column(name = "create_timestamp", updatable = false)private LocalDateTime createTimestamp = LocalDateTime.now();@Convert(converter = LocalDateTimeAttributeConverter.class)@Column(name = "invoice_creation_timestamp")private LocalDateTime invoiceCreationTimestamp = LocalDateTime.now();@Transientprivate String color;@Transientprivate String coveragePeriod;@Transientprivate int brandId;public int getBrandId() {return brandId;}public void setBrandId(int brandId) {this.brandId = brandId;}public String getDeviceInvoiceNumber() {return deviceInvoiceNumber;}public void setDeviceInvoiceNumber(String deviceInvoiceNumber) {this.deviceInvoiceNumber = deviceInvoiceNumber;}public String getCoveragePeriod() {return coveragePeriod;}public void setCoveragePeriod(String coveragePeriod) {this.coveragePeriod = coveragePeriod;}public String getColor() {return color;}public void setColor(String color) {this.color = color;}public String getFormattedCreateTimestamp() {if (createTimestamp == null) {return null;}DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");return createTimestamp.format(formatter);}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getInvoiceNumber() {return invoiceNumber;}public void setInvoiceNumber(String invoiceNumber) {this.invoiceNumber = invoiceNumber;}public int getRetailerId() {return retailerId;}public void setRetailerId(int retailerId) {this.retailerId = retailerId;}public float getPurchaseAmount() {return purchaseAmount;}public void setPurchaseAmount(float purchaseAmount) {this.purchaseAmount = purchaseAmount;}public float getSaleAmount() {return saleAmount;}public void setSaleAmount(float saleAmount) {this.saleAmount = saleAmount;}public float getSellingPrice() {return sellingPrice;}public void setSellingPrice(float sellingPrice) {this.sellingPrice = sellingPrice;}public String getSerialNumber() {return serialNumber;}public void setSerialNumber(String serialNumber) {this.serialNumber = serialNumber;}public String getModelName() {return modelName;}public void setModelName(String modelName) {this.modelName = modelName;}public String getBrand() {return brand;}public void setBrand(String brand) {this.brand = brand;}public String getPolicyNumber() {return policyNumber;}public void setPolicyNumber(String policyNumber) {this.policyNumber = policyNumber;}public int getProviderId() {return providerId;}public void setProviderId(int providerId) {this.providerId = providerId;}public String getCustomerFirstName() {return customerFirstName;}public void setCustomerFirstName(String customerFirstName) {this.customerFirstName = customerFirstName;}public String getCustomerLastName() {return customerLastName;}public void setCustomerLastName(String customerLastName) {this.customerLastName = customerLastName;}public String getCustomerMobileNumber() {return customerMobileNumber;}public void setCustomerMobileNumber(String customerMobileNumber) {this.customerMobileNumber = customerMobileNumber;}public String getCustomerEmailId() {return customerEmailId;}public void setCustomerEmailId(String customerEmailId) {this.customerEmailId = customerEmailId;}public LocalDate getCustomerDateOfBirth() {return customerDateOfBirth;}public void setCustomerDateOfBirth(LocalDate customerDateOfBirth) {this.customerDateOfBirth = customerDateOfBirth;}public String getCustomerAddress1() {return customerAddress1;}public void setCustomerAddress1(String customerAddress1) {this.customerAddress1 = customerAddress1;}public String getCustomerAddress2() {return customerAddress2;}public void setCustomerAddress2(String customerAddress2) {this.customerAddress2 = customerAddress2;}public String getCustomerCity() {return customerCity;}public void setCustomerCity(String customerCity) {this.customerCity = customerCity;}public String getCustomerPinCode() {return customerPinCode;}public void setCustomerPinCode(String customerPinCode) {this.customerPinCode = customerPinCode;}public String getCustomerState() {return customerState;}public void setCustomerState(String customerState) {this.customerState = customerState;}public boolean isPosted() {return posted;}public void setPosted(boolean posted) {this.posted = posted;}public InsuranceProvider getInsuranceProvider() {return insuranceProvider;}public void setInsuranceProvider(InsuranceProvider insuranceProvider) {this.insuranceProvider = insuranceProvider;}public LocalDateTime getCreateTimestamp() {return createTimestamp;}public void setCreateTimestamp(LocalDateTime createTimestamp) {this.createTimestamp = createTimestamp;}public LocalDateTime getInvoiceCreationTimestamp() {return invoiceCreationTimestamp;}public void setInvoiceCreationTimestamp(LocalDateTime invoiceCreationTimestamp) {this.invoiceCreationTimestamp = invoiceCreationTimestamp;}public String getPolicyPlan() {return policyPlan;}public void setPolicyPlan(String policyPlan) {this.policyPlan = policyPlan;}@Overridepublic boolean equals(Object o) {if (this == o) return true;if (o == null || getClass() != o.getClass()) return false;InsurancePolicy that = (InsurancePolicy) o;return id == that.id && retailerId == that.retailerId && Float.compare(that.purchaseAmount, purchaseAmount) == 0 && Float.compare(that.saleAmount, saleAmount) == 0 && Float.compare(that.sellingPrice, sellingPrice) == 0 && policyPlan == that.policyPlan && providerId == that.providerId && posted == that.posted && brandId == that.brandId && Objects.equals(invoiceNumber, that.invoiceNumber) && Objects.equals(productName, that.productName) && Objects.equals(serialNumber, that.serialNumber) && Objects.equals(modelName, that.modelName) && Objects.equals(brand, that.brand) && Objects.equals(policyNumber, that.policyNumber) && Objects.equals(customerFirstName, that.customerFirstName) && Objects.equals(customerLastName, that.customerLastName) && Objects.equals(customerMobileNumber, that.customerMobileNumber) && Objects.equals(customerEmailId, that.customerEmailId) && Objects.equals(customerDateOfBirth, that.customerDateOfBirth) && Objects.equals(customerAddress1, that.customerAddress1) && Objects.equals(customerAddress2, that.customerAddress2) && Objects.equals(customerCity, that.customerCity) && Objects.equals(customerPinCode, that.customerPinCode) && Objects.equals(customerState, that.customerState) && Objects.equals(deviceInvoiceNumber, that.deviceInvoiceNumber) && Objects.equals(insuranceProvider, that.insuranceProvider) && Objects.equals(createTimestamp, that.createTimestamp) && Objects.equals(invoiceCreationTimestamp, that.invoiceCreationTimestamp) && Objects.equals(color, that.color) && Objects.equals(coveragePeriod, that.coveragePeriod);}@Overridepublic int hashCode() {return Objects.hash(id, invoiceNumber, retailerId, purchaseAmount, saleAmount, sellingPrice, productName, serialNumber, modelName, brand, policyNumber, policyPlan, providerId, customerFirstName, customerLastName, customerMobileNumber, customerEmailId, customerDateOfBirth, customerAddress1, customerAddress2, customerCity, customerPinCode, customerState, deviceInvoiceNumber, posted, insuranceProvider, createTimestamp, invoiceCreationTimestamp, color, coveragePeriod, brandId);}@Overridepublic String toString() {return "InsurancePolicy [id=" + id + ", invoiceNumber=" + invoiceNumber + ", retailerId=" + retailerId+ ", purchaseAmount=" + purchaseAmount + ", saleAmount=" + saleAmount + ", sellingPrice=" + sellingPrice+ ", productName=" + productName + ", serialNumber=" + serialNumber + ", modelName=" + modelName+ ", brand=" + brand + ", policyNumber=" + policyNumber + ", providerId=" + providerId+ ", customerFirstName=" + customerFirstName + ", customerLastName=" + customerLastName+ ", customerMobileNumber=" + customerMobileNumber + ", customerEmailId=" + customerEmailId+ ", customerDateOfBirth=" + customerDateOfBirth + ", customerAddress1=" + customerAddress1+ ", customerAddress2=" + customerAddress2 + ", customerCity=" + customerCity + ", customerPinCode="+ customerPinCode + ", customerState=" + customerState + ", deviceInvoiceNumber=" + deviceInvoiceNumber+ ", posted=" + posted + ", insuranceProvider=" + insuranceProvider + ", createTimestamp="+ createTimestamp + ", invoiceCreationTimestamp=" + invoiceCreationTimestamp + ", color=" + color+ ", coveragePeriod=" + coveragePeriod + ", brandId=" + brandId + "]";}}