package ub.scp2.entities;

/**
 * Role.java -this class is an entity binded to the role table from the database
 * 
 *
 */
public class Role implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1086975153910678912L;
	private Integer roleId;
	private String name;
	private String webFriendlyName;

	public Role() {
	}

	public Role(String name) {
		this.name = name;
	}

	public Role(String name, String webFriendlyName) {
		this.name = name;
		this.webFriendlyName = webFriendlyName;
	}

	public Integer getRoleId() {
		return this.roleId;
	}

	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getWebFriendlyName() {
		return webFriendlyName;
	}

	public void setWebFriendlyName(String webFriendlyName) {
		this.webFriendlyName = webFriendlyName;
	}

    public boolean equals(Object other) {
        return other instanceof Role && (roleId != null) ? roleId.equals(((Role) other).roleId) : (other == this);
    }

    public int hashCode() {
        return roleId != null ? this.getClass().hashCode() + roleId.hashCode() : super.hashCode();
    }

    public String toString() {
        return roleId.toString();
    }

}
