You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
isspst/src/main/java/info/bukova/isspst/data/Permission.java

100 lines
2.1 KiB
Java

package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import org.springframework.security.core.GrantedAuthority;
@Entity
@Table(name="PERMISSION")
public class Permission extends BaseSimpleData implements GrantedAuthority {
/**
*
*/
private static final long serialVersionUID = 1L;
@Column(name="AUTHORITY")
private String authority;
@Column(name = "DESCRIPTION", length = Constants.LEN_DESCRIPTION)
private String description;
@Column(name="MODULE")
private String module;
@Column(name = "TYPE")
@Enumerated(EnumType.ORDINAL)
private PermissionType type;
public Permission(String authority, String description) {
this();
this.authority = authority;
this.description = description;
this.module = "";
}
public Permission(String authority, String description, String module) {
this(authority, description);
this.module = module;
}
public Permission(String authority, String description, PermissionType type) {
this(authority, description, "", type);
}
public Permission(String authority, String description, String module, PermissionType type) {
this(authority, description, module);
this.type = type;
}
public Permission() {
type = PermissionType.GLOBAL;
}
@Override
public String getAuthority() {
return authority;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getModule() {
return module;
}
public void setModule(String module) {
this.module = module;
}
public void setAuthority(String authority) {
this.authority = authority;
}
@Override
public boolean equals(Object o) {
if ((o instanceof Permission) && ((Permission)o).getId() == this.getId()) {
return true;
} else {
return false;
}
}
public PermissionType getType() {
return type;
}
public void setType(PermissionType type) {
this.type = type;
}
}