Skip to content
PermissionEntity.java 2.04 KiB
Newer Older
package it.inaf.ia2.gms.persistence.model;

import it.inaf.ia2.gms.model.Permission;
Sonia Zorba's avatar
Sonia Zorba committed
import java.util.Objects;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
public class PermissionEntity {
    private Permission permission;
    // The group path is copied here for performance reasons
    private String groupPath;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public Permission getPermission() {
        return permission;
    }

    public void setPermission(Permission permission) {
        this.permission = permission;
    }

    public String getGroupPath() {
        return groupPath;
    }

    public void setGroupPath(String groupPath) {
        this.groupPath = groupPath;
    }
Sonia Zorba's avatar
Sonia Zorba committed

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 41 * hash + Objects.hashCode(this.userId);
        hash = 41 * hash + Objects.hashCode(this.groupId);
        hash = 41 * hash + Objects.hashCode(this.permission);
        hash = 41 * hash + Objects.hashCode(this.groupPath);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final PermissionEntity other = (PermissionEntity) obj;
        if (!Objects.equals(this.userId, other.userId)) {
            return false;
        }
        if (!Objects.equals(this.groupId, other.groupId)) {
            return false;
        }
        if (!Objects.equals(this.groupPath, other.groupPath)) {
            return false;
        }
        return this.permission == other.permission;
    }