Subversion Repositories SmartDukaan

Rev

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

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

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.dtr.OtpType;

@Entity
@Table(name = "dtr.otp")
public class Otp {
        /**
         * 
         */
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;

        @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 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 + 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;
                Otp other = (Otp) obj;
                if (id != other.id)
                        return false;
                return true;
        }

        @Override
        public String toString() {
                return "Otp [id=" + id + ", mobile=" + mobile + ", otp=" + otp + ", otpType=" + otpType + ", createdOn="
                                + createdOn + ", expiryTimestamp=" + expiryTimestamp + ", expired=" + expired + ", verified=" + verified
                                + ", tryCount=" + tryCount + "]";
        }

}