Subversion Repositories SmartDukaan

Rev

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

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

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

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 com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;

@Entity
@Table(name = "user.promoter")
public class Promoter {
        @Id
        @Column(name = "id", unique = true, updatable = false)
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;

        @Column
        private String name;

        /**
         * 
         */
        @Column
        private String brand;

        @Column
        private boolean status;

        public boolean isStatus() {
                return status;
        }

        public void setStatus(boolean status) {
                this.status = status;
        }

        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + ((brand == null) ? 0 : brand.hashCode());
                result = prime * result + ((createdTimestamp == null) ? 0 : createdTimestamp.hashCode());
                result = prime * result + ((email == null) ? 0 : email.hashCode());
                result = prime * result + id;
                result = prime * result + ((mobile == null) ? 0 : mobile.hashCode());
                result = prime * result + ((name == null) ? 0 : name.hashCode());
                result = prime * result + retailerId;
                result = prime * result + (sdPortalAccess ? 1231 : 1237);
                result = prime * result + (status ? 1231 : 1237);
                return result;
        }

        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                Promoter other = (Promoter) obj;
                if (brand == null) {
                        if (other.brand != null)
                                return false;
                } else if (!brand.equals(other.brand))
                        return false;
                if (createdTimestamp == null) {
                        if (other.createdTimestamp != null)
                                return false;
                } else if (!createdTimestamp.equals(other.createdTimestamp))
                        return false;
                if (email == null) {
                        if (other.email != null)
                                return false;
                } else if (!email.equals(other.email))
                        return false;
                if (id != other.id)
                        return false;
                if (mobile == null) {
                        if (other.mobile != null)
                                return false;
                } else if (!mobile.equals(other.mobile))
                        return false;
                if (name == null) {
                        if (other.name != null)
                                return false;
                } else if (!name.equals(other.name))
                        return false;
                if (retailerId != other.retailerId)
                        return false;
                if (sdPortalAccess != other.sdPortalAccess)
                        return false;
                if (status != other.status)
                        return false;
                return true;
        }

        public boolean isSdPortalAccess() {
                return sdPortalAccess;
        }

        public void setSdPortalAccess(boolean sdPortalAccess) {
                this.sdPortalAccess = sdPortalAccess;
        }

        @Column(name = "retailer_id")
        private int retailerId;

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

        @Column(name = "email", unique = true)
        private String email;

        @Column(name = "sdportal_access")
        private boolean sdPortalAccess = false;

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

        public String getEmail() {
                return email;
        }

        public void setEmail(String email) {
                this.email = email;
        }

        public String getMobile() {
                return mobile;
        }

        public void setMobile(String mobile) {
                this.mobile = mobile;
        }

        public int getId() {
                return id;
        }

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

        public String getName() {
                return name;
        }

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

        public String getBrand() {
                return brand;
        }

        public void setBrand(String brand) {
                this.brand = brand;
        }

        public int getRetailerId() {
                return retailerId;
        }

        public void setRetailerId(int retailerId) {
                this.retailerId = retailerId;
        }

        public LocalDateTime getCreatedTimestamp() {
                return createdTimestamp;
        }

        public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
                this.createdTimestamp = createdTimestamp;
        }

        public String getDate(LocalDateTime ldt) {
                DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd");
                String s = dtf.format(ldt);
                return s;
        }

        @Override
        public String toString() {
                return "Promoter [id=" + id + ", name=" + name + ", brand=" + brand + ", status=" + status + ", retailerId="
                                + retailerId + ", mobile=" + mobile + ", email=" + email + ", sdPortalAccess=" + sdPortalAccess
                                + ", createdTimestamp=" + createdTimestamp + "]";
        }

}