org.redmine.ta.beans.Membership Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redmine-java-api-nodep Show documentation
Show all versions of redmine-java-api-nodep Show documentation
Free open-source Java API for Redmine and Chiliproject bug/task management systems.
The newest version!
package org.redmine.ta.beans;
import java.util.ArrayList;
import java.util.List;
/**
* User or group membership.
*
* @author maxkar
*
*/
public class Membership implements Identifiable {
private Integer id;
private Project project;
/**
* User. Not set for "group" membership.
*/
private User user;
private List roles = new ArrayList();
@Override
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Project getProject() {
return project;
}
public void setProject(Project project) {
this.project = project;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public List getRoles() {
return roles;
}
public void setRoles(List roles) {
this.roles = roles;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((project == null) ? 0 : project.hashCode());
result = prime * result + ((roles == null) ? 0 : roles.hashCode());
result = prime * result + ((user == null) ? 0 : user.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Membership other = (Membership) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (project == null) {
if (other.project != null)
return false;
} else if (!project.equals(other.project))
return false;
if (roles == null) {
if (other.roles != null)
return false;
} else if (!roles.equals(other.roles))
return false;
if (user == null) {
if (other.user != null)
return false;
} else if (!user.equals(other.user))
return false;
return true;
}
@Override
public String toString() {
return "Membership [id=" + id + ", project=" + project + ", user="
+ user + ", roles=" + roles + "]";
}
}