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

com.evasion.entity.security.Authority Maven / Gradle / Ivy

The newest version!
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.evasion.entity.security;

import com.evasion.EntityJPA;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 *
 * @author sebastien
 */
@Entity
@Table(name = "authorities")
public class Authority extends EntityJPA {

    /**
     * UID de serialisation.
     */
    private static final long serialVersionUID = 1L;

    /**
     * ID du grouped'utilisateur.
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    /**
     *
     */
    @Column(unique = true, length = 50, nullable = false)
    private String authorityName;

    /**
     * Constructeur
     */
    protected Authority() {
    }

    /**
     * Constructeur par defaut avec les champs obligatoire.
     * @param name nom du groupe.
     */
    public Authority(final String name) {
        this.authorityName = name;
    }

    public String getAuthorityName() {
        return authorityName;
    }

    public void setAuthorityName(String authorityName) {
        this.authorityName = authorityName;
    }

    @Override
    public Long getId() {
        return this.id;
    }

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

    /**
     * {@inheritDoc }.
     */
    @Override
    public boolean equals(final Object obj) {
        if (obj == null) {
            return false;
        }
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof Authority)) {
            return false;
        }
        Authority rhs = (Authority) obj;
        return new EqualsBuilder().append(this.authorityName, rhs.authorityName).
                isEquals();
    }

    /**
     * {@inheritDoc }.
     */
    @Override
    public final int hashCode() {
        return new HashCodeBuilder(17, 37).append(this.authorityName).
                toHashCode();
    }

    /**
     * {@inheritDoc }.
     */
    @Override
    public final String toString() {
        return new ToStringBuilder(this).append("authorityName", authorityName).
                toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy