Subversion Repositories SmartDukaan

Rev

Rev 31860 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity.fofo;

import java.io.Serializable;
import java.time.LocalDateTime;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.UpdateTimestamp;

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

/**
 * This class basically contains address details
 * 
 * @author ashikali
 *
 */
@Entity
@Table(name = "fofo.customer_address")
public class CustomerAddress implements Serializable {

        private static final long serialVersionUID = 1L;

        public CustomerAddress() {
        }

        @Id
        @Column(name = "id", unique = true, updatable = false)
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;

        @Column(name = "name")
        private String name;

        @Column(name = "last_name")
        private String lastName;

        @Column(name = "line_1")
        private String line1;

        @Column(name = "line_2")
        private String line2;

        @Column(name = "landmark")
        private String landmark;

        @Column(name = "city")
        private String city;

        @Column(name = "state")
        private String state;

        @Column(name = "pin_code", length = 10)
        private String pinCode;

        @Column(name = "country", length = 100)
        private String country;

        @Column(name = "phone_number", length = 20)
        private String phoneNumber;

        @Column(name = "customer_id")
        private int customerId;

        @Column(name = "active")
        private Boolean active;

 @Column(name = "is_default")
        private Boolean isDefault;

        public Boolean getDefault() {
                return isDefault;
        }

        public void setDefault(Boolean aDefault) {
                this.isDefault = aDefault;
        }

        public Boolean getActive() {
                return active;
        }

        public void setActive(Boolean active) {
                this.active = active;
        }

        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "create_timestamp", updatable = false)
        private LocalDateTime createTimestamp = LocalDateTime.now();

        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "update_timestamp")
        @UpdateTimestamp
        private LocalDateTime updateTimestamp = LocalDateTime.now();

        public int getId() {
                return id;
        }

        public void setId(int id) {
                this.id = id;
        }

        public void setName(String name) {
                this.name = name;
        }

        public String getName() {
                return name;
        }

        public void setLine1(String line1) {
                this.line1 = line1;
        }

        public String getLine1() {
                return line1;
        }

        public void setLine2(String line2) {
                this.line2 = line2;
        }

        public String getLine2() {
                return line2;
        }

        public void setLandmark(String landmark) {
                this.landmark = landmark;
        }

        public String getLandmark() {
                return landmark;
        }

        public void setCity(String city) {
                this.city = city;
        }

        public String getCity() {
                return city;
        }

        public void setPinCode(String pinCode) {
                this.pinCode = pinCode;
        }

        public String getPinCode() {
                return pinCode;
        }

        public void setState(String state) {
                this.state = state;
        }

        public String getState() {
                return state;
        }

        public void setCountry(String country) {
                this.country = country;
        }

        public String getCountry() {
                return country;
        }

        public void setPhoneNumber(String phoneNumber) {
                this.phoneNumber = phoneNumber;
        }

        public String getPhoneNumber() {
                return phoneNumber;
        }

        public void setCreateTimestamp(LocalDateTime createTimestamp) {
                this.createTimestamp = createTimestamp;
        }

        public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }

        public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
                this.updateTimestamp = updateTimestamp;
        }

        public LocalDateTime getUpdateTimestamp() {
                return updateTimestamp;
        }

        public int getCustomerId() {
                return customerId;
        }

        public void setCustomerId(int customerId) {
                this.customerId = customerId;
        }

        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + ((active == null) ? 0 : active.hashCode());
                result = prime * result + ((city == null) ? 0 : city.hashCode());
                result = prime * result + ((country == null) ? 0 : country.hashCode());
                result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
                result = prime * result + customerId;
                result = prime * result + id;
                result = prime * result + ((landmark == null) ? 0 : landmark.hashCode());
                result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
                result = prime * result + ((line1 == null) ? 0 : line1.hashCode());
                result = prime * result + ((line2 == null) ? 0 : line2.hashCode());
                result = prime * result + ((name == null) ? 0 : name.hashCode());
                result = prime * result + ((phoneNumber == null) ? 0 : phoneNumber.hashCode());
                result = prime * result + ((pinCode == null) ? 0 : pinCode.hashCode());
                result = prime * result + ((state == null) ? 0 : state.hashCode());
                result = prime * result + ((updateTimestamp == null) ? 0 : updateTimestamp.hashCode());
                return result;
        }

        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                CustomerAddress other = (CustomerAddress) obj;
                if (active == null) {
                        if (other.active != null)
                                return false;
                } else if (!active.equals(other.active))
                        return false;
                if (city == null) {
                        if (other.city != null)
                                return false;
                } else if (!city.equals(other.city))
                        return false;
                if (country == null) {
                        if (other.country != null)
                                return false;
                } else if (!country.equals(other.country))
                        return false;
                if (createTimestamp == null) {
                        if (other.createTimestamp != null)
                                return false;
                } else if (!createTimestamp.equals(other.createTimestamp))
                        return false;
                if (customerId != other.customerId)
                        return false;
                if (id != other.id)
                        return false;
                if (landmark == null) {
                        if (other.landmark != null)
                                return false;
                } else if (!landmark.equals(other.landmark))
                        return false;
                if (lastName == null) {
                        if (other.lastName != null)
                                return false;
                } else if (!lastName.equals(other.lastName))
                        return false;
                if (line1 == null) {
                        if (other.line1 != null)
                                return false;
                } else if (!line1.equals(other.line1))
                        return false;
                if (line2 == null) {
                        if (other.line2 != null)
                                return false;
                } else if (!line2.equals(other.line2))
                        return false;
                if (name == null) {
                        if (other.name != null)
                                return false;
                } else if (!name.equals(other.name))
                        return false;
                if (phoneNumber == null) {
                        if (other.phoneNumber != null)
                                return false;
                } else if (!phoneNumber.equals(other.phoneNumber))
                        return false;
                if (pinCode == null) {
                        if (other.pinCode != null)
                                return false;
                } else if (!pinCode.equals(other.pinCode))
                        return false;
                if (state == null) {
                        if (other.state != null)
                                return false;
                } else if (!state.equals(other.state))
                        return false;
                if (updateTimestamp == null) {
                        if (other.updateTimestamp != null)
                                return false;
                } else if (!updateTimestamp.equals(other.updateTimestamp))
                        return false;
                return true;
        }

        public String getLastName() {
                return lastName;
        }

        public void setLastName(String lastName) {
                this.lastName = lastName;
        }

        @Override
        public String toString() {
                return "CustomerAddress{" +
                                "id=" + id +
                                ", name='" + name + '\'' +
                                ", lastName='" + lastName + '\'' +
                                ", line1='" + line1 + '\'' +
                                ", line2='" + line2 + '\'' +
                                ", landmark='" + landmark + '\'' +
                                ", city='" + city + '\'' +
                                ", state='" + state + '\'' +
                                ", pinCode='" + pinCode + '\'' +
                                ", country='" + country + '\'' +
                                ", phoneNumber='" + phoneNumber + '\'' +
                                ", customerId=" + customerId +
                                ", active=" + active +
                                ", isDefault=" + isDefault +
                                ", createTimestamp=" + createTimestamp +
                                ", updateTimestamp=" + updateTimestamp +
                                '}';
        }
}