package de.dhbw.humbuch.model.entity; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; /** * @author David Vitt * */ @Entity @Table(name="permission") public class Permission implements de.dhbw.humbuch.model.entity.Entity, Serializable { private static final long serialVersionUID = -2046156879791992008L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; private String name; private String description; /** * Required by Hibernate.<p> * Use the {@link Builder} instead. * * @see Builder */ @Deprecated public Permission() {} public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public static class Builder { private final String name; private String description; public Builder(String name) { this.name = name; } public Builder description(String description) { this.description = description; return this; } public Permission build() { return new Permission(this); } } private Permission(Builder builder) { this.name = builder.name; this.description = builder.description; } @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 (!(obj instanceof Permission)) return false; Permission other = (Permission) obj; if (getId() != other.getId()) return false; return true; } }