Subversion Repositories SmartDukaan

Rev

Rev 22216 | Rev 23269 | 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 java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;

/**
 * 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 = "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="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 = "posted", columnDefinition = "tinyint(1) default 0")
        private boolean posted;
        
        @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();
        
        @ManyToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
        @JoinColumn(name="provider_id",insertable=false,updatable=false,nullable=false, referencedColumnName="id")
        private InsuranceProvider insuranceProvider;
        

        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 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 InsuranceProvider getInsuranceProvider() {
                return insuranceProvider;
        }
        
        public void setInsuranceProvider(InsuranceProvider insuranceProvider) {
                this.insuranceProvider = insuranceProvider;
        }

        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + id;
                return result;
        }

        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                InsurancePolicy other = (InsurancePolicy) obj;
                if (id != other.id)
                        return false;
                return true;
        }

        @Override
        public String toString() {
                return "InsurancePolicy [id=" + id + ", invoiceNumber=" + invoiceNumber + ", retailerId=" + retailerId
                                + ", purchaseAmount=" + purchaseAmount + ", saleAmount=" + saleAmount + ", sellingPrice=" + sellingPrice
                                + ", 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 + ", createTimestamp=" + createTimestamp + ", invoiceCreationTimestamp="
                                + invoiceCreationTimestamp + ", insuranceProvider=" + insuranceProvider + "]";
        }

         
}