All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.infusers.core.user.dto.UserDetailsDto Maven / Gradle / Ivy

There is a newer version: 2024.12.0008
Show newest version
package com.infusers.core.user.dto;

import java.io.Serializable;
import java.util.Date;

import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;

import com.infusers.core.user.APIUser;

@RedisHash("UserDetailsDto")
public final class UserDetailsDto extends JdkSerializationRedisSerializer implements Serializable {
	
	private static final long serialVersionUID = 443911446941799444L;

    private long id;

	private String username;
	private String password;
	private String firstname;
	private String lastname;
    private String mobilenumber;
    private String countrycode;

	private boolean admin;
    private boolean active;
	private String verificationCode;
	private Date createdAt;
	

	public String getCountrycode() {
		return countrycode;
	}
	public void setCountrycode(String countrycode) {
		this.countrycode = countrycode;
	}
	
	public String getMobilenumber() {
		return mobilenumber;
	}
	public void setMobilenumber(String mobilenumber) {
		this.mobilenumber = mobilenumber;
	}

	public Date getCreatedAt() {
		return createdAt;
	}
	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}
	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 getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
    public boolean isAdmin() {
		return admin;
	}
	public void setAdmin(boolean isadmin) {
		this.admin = isadmin;
	}
	public boolean isActive() {
		return active;
	}
	public void setActive(boolean isactive) {
		this.active = isactive;
	}
	
    public String getVerificationCode() {
		return verificationCode;
	}

	public void setVerificationCode(String verificationCode) {
		this.verificationCode = verificationCode;
	}
	
	public void copy(APIUser apiUser) {
		if(apiUser!=null) {
			this.id = apiUser.getId();
			this.username = apiUser.getUsername();
			this.password = apiUser.getPassword();
			this.firstname = apiUser.getFirstname();
			this.lastname = apiUser.getLastname();
			this.mobilenumber= String.valueOf(apiUser.getMobilenumber());
			this.countrycode = apiUser.getCountrycode();
			this.admin = apiUser.isAdmin();
			this.active = apiUser.isActive();
			this.verificationCode = apiUser.getVerificationCode();
			this.createdAt = apiUser.getCreatedAt();
		}
	}
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public boolean isValid() {
		return username!=null && username.length()!=0 && password !=null && password.length()!=0;
	}
	
    @Override
    public int hashCode() {
        return username!=null ? username.hashCode() : -1;
    }
    
    @Override
    public boolean equals(Object obj) {
          
    // if both the object references are 
    // referring to the same object.
    if(this == obj)
            return true;
          
        if(obj == null || obj.getClass()!= this.getClass())
            return false;
          
        // type casting of the argument. 
        UserDetailsDto userDetails = (UserDetailsDto) obj;
          
        // comparing the state of argument with 
        // the state of 'this' Object.
        return (userDetails.username.equals(this.username));
    }
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy