UserDetailsVO.java

// license-header java merge-point
//
/**
 * @author Generated by ValueObject.vsl in andromda-java-cartridge on 09/18/2014 12:09:11-0400 Do not modify by hand!
 *
 * TEMPLATE:     ValueObject.vsl in andromda-java-cartridge.
 * MODEL CLASS:  Timetracker EJB3 ::TimeTracker::org.andromda.timetracker::vo::UserDetailsVO
 * STEREOTYPE:   ValueObject
 */
package org.andromda.timetracker.vo;

import java.util.Date;
import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * <p>
 * TODO: Model Documentation for UserDetailsVO
 * </p>
 */
public class UserDetailsVO
    extends UserVO
{
    /** The serial version UID of this class. Needed for serialization. */
    private static final long serialVersionUID = 1496993145138888879L;

    // Class attributes
    /**
     * <p>
     * TODO: Model Documentation for password
     * </p>
     */
    protected String password;
    /**
     * <p>
     * TODO: Model Documentation for email
     * </p>
     */
    protected String email;
    /**
     * <p>
     * TODO: Model Documentation for isActive
     * </p>
     */
    protected boolean isActive;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setIsActive = false;
    /**
     * <p>
     * TODO: Model Documentation for creationDate
     * </p>
     */
    protected Date creationDate;
    /**
     * <p>
     * TODO: Model Documentation for comment
     * </p>
     */
    protected String comment;
    /**
     * <p>
     * TODO: Model Documentation for roles
     * </p>
     */
    protected UserRoleVO[] roles;

    /** Default Constructor with no properties */
    public UserDetailsVO()
    {
        super();
    }

    /**
     * Constructor taking only required properties
     * @param passwordIn String <p>
TODO: Model Documentation for password
</p>
     * @param emailIn String <p>
TODO: Model Documentation for email
</p>
     * @param isActiveIn boolean <p>
TODO: Model Documentation for isActive
</p>
     * @param creationDateIn Date <p>
TODO: Model Documentation for creationDate
</p>
     * @param rolesIn UserRoleVO[] <p>
TODO: Model Documentation for roles
</p>
     * @param usernameIn String <p>
TODO: Model Documentation for username
</p>
     * @param firstNameIn String <p>
TODO: Model Documentation for firstName
</p>
     * @param lastNameIn String <p>
TODO: Model Documentation for lastName
</p>
     */
    public UserDetailsVO(final String passwordIn, final String emailIn, final boolean isActiveIn, final Date creationDateIn, final UserRoleVO[] rolesIn, final String usernameIn, final String firstNameIn, final String lastNameIn)
    {
        super(usernameIn, firstNameIn, lastNameIn);
        this.password = passwordIn;
        this.email = emailIn;
        this.isActive = isActiveIn;
        this.setIsActive = true;
        this.creationDate = creationDateIn;
        this.roles = rolesIn;
    }

    /**
     * Constructor with all properties
     * @param passwordIn String
     * @param emailIn String
     * @param isActiveIn boolean
     * @param creationDateIn Date
     * @param commentIn String
     * @param rolesIn UserRoleVO[]
     * @param idIn Long
     * @param usernameIn String
     * @param firstNameIn String
     * @param lastNameIn String
     */
    public UserDetailsVO(final String passwordIn, final String emailIn, final boolean isActiveIn, final Date creationDateIn, final String commentIn, final UserRoleVO[] rolesIn, final Long idIn, final String usernameIn, final String firstNameIn, final String lastNameIn)
    {
        super(idIn, usernameIn, firstNameIn, lastNameIn);
        this.password = passwordIn;
        this.email = emailIn;
        this.isActive = isActiveIn;
        this.setIsActive = true;
        this.creationDate = creationDateIn;
        this.comment = commentIn;
        this.roles = rolesIn;
    }

    /**
     * Copies constructor from other UserDetailsVO
     *
     * @param otherBean Cannot be <code>null</code>
     * @throws NullPointerException if the argument is <code>null</code>
     */
    public UserDetailsVO(final UserDetailsVO otherBean)
    {
        super(otherBean);
        this.password = otherBean.getPassword();
        this.email = otherBean.getEmail();
        this.isActive = otherBean.isIsActive();
        this.setIsActive = true;
        this.creationDate = otherBean.getCreationDate();
        this.comment = otherBean.getComment();
        this.roles = otherBean.getRoles();
    }

    /**
     * Copies all properties from the argument value object into this value object.
     * @param otherBean Cannot be <code>null</code>
     */
    public void copy(final UserDetailsVO otherBean)
    {
        if (null != otherBean)
        {
            super.copy(otherBean);
            this.setPassword(otherBean.getPassword());
            this.setEmail(otherBean.getEmail());
            this.setIsActive(otherBean.isIsActive());
            this.setIsActive = true;
            this.setCreationDate(otherBean.getCreationDate());
            this.setComment(otherBean.getComment());
            this.setRoles(otherBean.getRoles());
        }
    }

    /**
     * <p>
     * TODO: Model Documentation for password
     * </p>
     * Get the password Attribute
     * @return password String
     */
    public String getPassword()
    {
        return this.password;
    }

    /**
     * <p>
     * TODO: Model Documentation for password
     * </p>
     * @param value String
     */
    public void setPassword(final String value)
    {
        this.password = value;
    }

    /**
     * <p>
     * TODO: Model Documentation for email
     * </p>
     * Get the email Attribute
     * @return email String
     */
    public String getEmail()
    {
        return this.email;
    }

    /**
     * <p>
     * TODO: Model Documentation for email
     * </p>
     * @param value String
     */
    public void setEmail(final String value)
    {
        this.email = value;
    }

    /**
     * <p>
     * TODO: Model Documentation for isActive
     * </p>
     * Get the isActive Attribute
     * @return isActive boolean
     */
    public boolean isIsActive()
    {
        return this.isActive;
    }

    /**
     * <p>
     * TODO: Model Documentation for isActive
     * </p>
     * Duplicates isBoolean method, for use as Jaxb2 compatible object
     * Get the isActive Attribute
     * @return isActive boolean
     */
    @Deprecated
    public boolean getIsActive()
    {
        return this.isActive;
    }

    /**
     * <p>
     * TODO: Model Documentation for isActive
     * </p>
     * @param value boolean
     */
    public void setIsActive(final boolean value)
    {
        this.isActive = value;
        this.setIsActive = true;
    }

    /**
     * Return true if the primitive attribute isActive is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetIsActive()
    {
        return this.setIsActive;
    }

    /**
     * <p>
     * TODO: Model Documentation for creationDate
     * </p>
     * Get the creationDate Attribute
     * @return creationDate Date
     */
    public Date getCreationDate()
    {
        return this.creationDate;
    }

    /**
     * <p>
     * TODO: Model Documentation for creationDate
     * </p>
     * @param value Date
     */
    public void setCreationDate(final Date value)
    {
        this.creationDate = value;
    }

    /**
     * <p>
     * TODO: Model Documentation for comment
     * </p>
     * Get the comment Attribute
     * @return comment String
     */
    public String getComment()
    {
        return this.comment;
    }

    /**
     * <p>
     * TODO: Model Documentation for comment
     * </p>
     * @param value String
     */
    public void setComment(final String value)
    {
        this.comment = value;
    }

    /**
     * <p>
     * TODO: Model Documentation for roles
     * </p>
     * Get the roles Attribute
     * @return roles UserRoleVO[]
     */
    public UserRoleVO[] getRoles()
    {
        return this.roles;
    }

    /**
     * <p>
     * TODO: Model Documentation for roles
     * </p>
     * @param value UserRoleVO[]
     */
    public void setRoles(final UserRoleVO[] value)
    {
        this.roles = value;
    }

    /**
     * @param object to compare this object against
     * @return boolean if equal
     * @see Object#equals(Object)
     */
    @Override
    public boolean equals(final Object object)
    {
        if (object==null || object.getClass() != this.getClass())
        {
             return false;
        }
        // Check if the same object instance
        if (object==this)
        {
            return true;
        }
        UserDetailsVO rhs = (UserDetailsVO) object;
        return new EqualsBuilder()
            .appendSuper(super.equals(object))
            .append(this.getPassword(), rhs.getPassword())
            .append(this.getEmail(), rhs.getEmail())
            .append(this.isIsActive(), rhs.isIsActive())
            .append(this.getCreationDate(), rhs.getCreationDate())
            .append(this.getComment(), rhs.getComment())
            .append(this.getRoles(), rhs.getRoles())
            .isEquals();
    }

    /**
     * @param object to compare this object against
     * @return int if equal
     * @see Comparable#compareTo(Object)
     */
    public int compareTo(final UserVO object)
    {
        if (object==null)
        {
            return -1;
        }
        // Check if the same object instance
        if (object==this)
        {
            return 0;
        }
        if (!(object instanceof UserDetailsVO))
        {
            return -1;
        }
        UserDetailsVO myClass = (UserDetailsVO)object;
        return new CompareToBuilder()
            .appendSuper(super.compareTo(object))
            .append(this.getPassword(), myClass.getPassword())
            .append(this.getEmail(), myClass.getEmail())
            .append(this.isIsActive(), myClass.isIsActive())
            .append(this.getCreationDate(), myClass.getCreationDate())
            .append(this.getComment(), myClass.getComment())
            .append(this.getRoles(), myClass.getRoles())
            .toComparison();
    }

    /**
     * @return int hashCode value
     * @see Object#hashCode()
     */
    @Override
    public int hashCode()
    {
        return new HashCodeBuilder(1249046965, -82296885)
            .appendSuper(super.hashCode())
            .append(this.getPassword())
            .append(this.getEmail())
            .append(this.isIsActive())
            .append(this.getCreationDate())
            .append(this.getComment())
            .append(this.getRoles())
            .toHashCode();
    }

    /**
     * @return String representation of object
     * @see Object#toString()
     */
    @Override
    public String toString()
    {
        return new ToStringBuilder(this)
            .append("password", this.getPassword())
            .append("email", this.getEmail())
            .append("isActive", this.isIsActive())
            .append("creationDate", this.getCreationDate())
            .append("comment", this.getComment())
            .append("roles", this.getRoles())
            .append("id", this.getId())
            .append("username", this.getUsername())
            .append("firstName", this.getFirstName())
            .append("lastName", this.getLastName())
            .toString();
    }

    /**
     * Compares the properties of this instance to the properties of the argument. This method will return
     * {@code false} as soon as it detects that the argument is {@code null} or not of the same type as
     * (or a sub-type of) this instance's type.
     *
     * <p/>For array, collection or map properties the comparison will be done one level deep, in other words:
     * the elements will be compared using the {@code equals()} operation.
     *
     * <p/>Note that two properties will be considered equal when both values are {@code null}.
     *
     * @param thatObject the object containing the properties to compare against this instance
     * @return this method will return {@code true} in case the argument has the same type as this class, or is a
     *      sub-type of this class and all properties as found on this class have equal values when queried on that
     *      argument instance; in all other cases this method will return {@code false}
     */
    @Override
    public boolean equalProperties(final Object thatObject)
    {
        if (thatObject == null || !this.getClass().isAssignableFrom(thatObject.getClass()))
        {
            return false;
        }

        @SuppressWarnings("unchecked")
        final UserDetailsVO that = (UserDetailsVO)thatObject;
        return super.equalProperties(that)
            && equal(this.getPassword(), that.getPassword())
            && equal(this.getEmail(), that.getEmail())
            && equal(this.isIsActive(), that.isIsActive())
            && equal(this.getCreationDate(), that.getCreationDate())
            && equal(this.getComment(), that.getComment())
            && equal(this.getRoles(), that.getRoles())
        ;
    }

    // UserDetailsVO value-object java merge-point
}