Subversion Repositories SmartDukaan

Rev

Rev 21596 | 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;

import java.time.LocalDateTime;

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

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

@Entity
@Table(name="otp",schema="dtr")
public class Otp{
        /**
         * 
         */
        @Id
        @GeneratedValue(strategy=GenerationType.IDENTITY)
        private int id;
        private String email;
        @Column(length = 10)
        private String mobile;
        @Column(length = 5)
        private String otp;
        @Enumerated(EnumType.STRING)
        private OtpType otpType;
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        private LocalDateTime createdOn;
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        private LocalDateTime expiryTimestamp;
        @Column(columnDefinition="tinyint(1) default 0")
        private boolean expired;
        @Column(columnDefinition="tinyint(1) default 0")
        private boolean verified;
        private int tryCount;
        
        public int getTryCount() {
                return tryCount;
        }
        public void setTryCount(int tryCount) {
                this.tryCount = tryCount;
        }
        public boolean isVerified() {
                return verified;
        }
        public void setVerified(boolean verified) {
                this.verified = verified;
        }
        public int getId() {
                return id;
        }
        public void setId(int id) {
                this.id = id;
        }
        public String getOtp() {
                return otp;
        }
        public void setOtp(String otp) {
                this.otp = otp;
        }
        public OtpType getOtpType() {
                return otpType;
        }
        public void setOtpType(OtpType otpType) {
                this.otpType = otpType;
        }
        public LocalDateTime getCreatedOn() {
                return createdOn;
        }
        public void setCreatedOn(LocalDateTime createdOn) {
                this.createdOn = createdOn;
        }
        public LocalDateTime getExpiryTimestamp() {
                return expiryTimestamp;
        }
        public void setExpiryTimestamp(LocalDateTime expiryTimestamp) {
                this.expiryTimestamp = expiryTimestamp;
        }
        public boolean isExpired() {
                return expired;
        }
        public void setExpired(boolean expired) {
                this.expired = expired;
        }
        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;
        }
        
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + ((createdOn == null) ? 0 : createdOn.hashCode());
                result = prime * result + ((email == null) ? 0 : email.hashCode());
                result = prime * result + (expired ? 1231 : 1237);
                result = prime * result + ((expiryTimestamp == null) ? 0 : expiryTimestamp.hashCode());
                result = prime * result + (int) (id ^ (id >>> 32));
                result = prime * result + ((mobile == null) ? 0 : mobile.hashCode());
                result = prime * result + ((otp == null) ? 0 : otp.hashCode());
                result = prime * result + ((otpType == null) ? 0 : otpType.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;
                Otp other = (Otp) obj;
                if (createdOn == null) {
                        if (other.createdOn != null)
                                return false;
                } else if (!createdOn.equals(other.createdOn))
                        return false;
                if (email == null) {
                        if (other.email != null)
                                return false;
                } else if (!email.equals(other.email))
                        return false;
                if (expired != other.expired)
                        return false;
                if (expiryTimestamp == null) {
                        if (other.expiryTimestamp != null)
                                return false;
                } else if (!expiryTimestamp.equals(other.expiryTimestamp))
                        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 (otp == null) {
                        if (other.otp != null)
                                return false;
                } else if (!otp.equals(other.otp))
                        return false;
                if (otpType != other.otpType)
                        return false;
                return true;
        }
        @Override
        public String toString() {
                return "Otp [id=" + id + ", email=" + email + ", mobile=" + mobile + ", otp=" + otp + ", otpType=" + otpType
                                + ", createdOn=" + createdOn + ", expiryTimestamp=" + expiryTimestamp + ", expired=" + expired + "]";
        }
        
}