Subversion Repositories SmartDukaan

Rev

Rev 31860 | Rev 32171 | 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.auth;

//import com.sun.istack.internal.NotNull;

import in.shop2020.utils.Message;

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

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

@Entity
@Table(name = "auth.auth_user")
public class AuthUser {

    @Id
    @Column
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    @Column(name = "`email_id`", unique = true, updatable = false)
    private String emailId;

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

    @Column(name = "manager_id")
    private int managerId;

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

    @Column(name = "ho_user")
    private boolean hoUser;

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

    @Column(name = "first_name", nullable = false)
    private String firstName;

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

    @Column(name = "mobile_number", unique = true, updatable = false)
    private String mobileNumber;

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

    @Column(name = "created_timestamp")
    private LocalDateTime createdTimestamp;

    @Column(name = "last_login_timestap", unique = true, updatable = true)
    private LocalDateTime lastLoginTimestamp;

    public String getEmployeeCode() {
        return employeeCode;
    }


    public boolean isHoUser() {
        return hoUser;
    }


    public void setHoUser(boolean hoUser) {
        this.hoUser = hoUser;
    }


    public Boolean getActive() {
        return active;
    }


    public void setEmployeeCode(String employeeCode) {
        this.employeeCode = employeeCode;
    }


    public int getManagerId() {
        return managerId;
    }


    public void setManagerId(int managerId) {
        this.managerId = managerId;
    }


    public String getFullName() {
        return (this.firstName + " " + this.lastName).trim();
    }

    public Boolean isActive() {
        return active;
    }

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

    public String getGmailId() {
        return gmailId;
    }

    public void setGmailId(String gmailId) {
        this.gmailId = gmailId;
    }

    public int getId() {
        return id;
    }

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

    public String getName() {
        return this.firstName + " " + this.lastName;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

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

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((active == null) ? 0 : active.hashCode());
        result = prime * result + ((createdTimestamp == null) ? 0 : createdTimestamp.hashCode());
        result = prime * result + ((emailId == null) ? 0 : emailId.hashCode());
        result = prime * result + ((employeeCode == null) ? 0 : employeeCode.hashCode());
        result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
        result = prime * result + ((gmailId == null) ? 0 : gmailId.hashCode());
        result = prime * result + id;
        result = prime * result + ((lastLoginTimestamp == null) ? 0 : lastLoginTimestamp.hashCode());
        result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
        result = prime * result + ((mobileNumber == null) ? 0 : mobileNumber.hashCode());
        result = prime * result + ((password == null) ? 0 : password.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;
        AuthUser other = (AuthUser) obj;
        if (active == null) {
            if (other.active != null)
                return false;
        } else if (!active.equals(other.active))
            return false;
        if (createdTimestamp == null) {
            if (other.createdTimestamp != null)
                return false;
        } else if (!createdTimestamp.equals(other.createdTimestamp))
            return false;
        if (emailId == null) {
            if (other.emailId != null)
                return false;
        } else if (!emailId.equals(other.emailId))
            return false;
        if (employeeCode == null) {
            if (other.employeeCode != null)
                return false;
        } else if (!employeeCode.equals(other.employeeCode))
            return false;
        if (firstName == null) {
            if (other.firstName != null)
                return false;
        } else if (!firstName.equals(other.firstName))
            return false;
        if (gmailId == null) {
            if (other.gmailId != null)
                return false;
        } else if (!gmailId.equals(other.gmailId))
            return false;
        if (id != other.id)
            return false;
        if (lastLoginTimestamp == null) {
            if (other.lastLoginTimestamp != null)
                return false;
        } else if (!lastLoginTimestamp.equals(other.lastLoginTimestamp))
            return false;
        if (lastName == null) {
            if (other.lastName != null)
                return false;
        } else if (!lastName.equals(other.lastName))
            return false;
        if (mobileNumber == null) {
            if (other.mobileNumber != null)
                return false;
        } else if (!mobileNumber.equals(other.mobileNumber))
            return false;
        if (password == null) {
            if (other.password != null)
                return false;
        } else if (!password.equals(other.password))
            return false;
        return true;
    }

    public String getEmailId() {
        return emailId;
    }

    public void setEmailId(String emailId) {
        this.emailId = emailId;
    }

    public String getMobileNumber() {
        return mobileNumber;
    }

    public void setMobileNumber(String mobileNumber) {
        this.mobileNumber = mobileNumber;
    }

    public LocalDateTime getCreatedTimestamp() {
        return createdTimestamp;
    }

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

    public LocalDateTime getLastLoginTimestamp() {
        return lastLoginTimestamp;
    }

    public void setLastLoginTimestamp(LocalDateTime lastLoginTimestamp) {
        this.lastLoginTimestamp = lastLoginTimestamp;
    }

    public String getFormattedCreateTimestamp() {
        if (createdTimestamp == null) {
            return null;
        }
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
        return createdTimestamp.format(formatter);
    }

    @Override
    public String toString() {
        return "AuthUser [id=" + id + ", emailId=" + emailId + ", gmailId=" + gmailId + ", employeeCode=" + employeeCode + ", active=" + active + ", firstName=" + firstName + ", lastName=" + lastName + ", mobileNumber=" + mobileNumber + ", password=" + password + ", createdTimestamp=" + createdTimestamp + ", lastLoginTimestamp=" + lastLoginTimestamp + "]";
    }

}