View Javadoc
1   package de.dlr.shepard.neo4Core.entities;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   import java.util.Objects;
6   
7   import org.neo4j.ogm.annotation.NodeEntity;
8   import org.neo4j.ogm.annotation.Relationship;
9   
10  import de.dlr.shepard.util.Constants;
11  import lombok.Data;
12  import lombok.NoArgsConstructor;
13  import lombok.ToString;
14  
15  @NodeEntity
16  @Data
17  @ToString(callSuper = true)
18  @NoArgsConstructor
19  public class UserGroup extends BasicEntity {
20  
21  	@Relationship(type = Constants.IS_IN_GROUP, direction = Relationship.INCOMING)
22  	private List<User> users = new ArrayList<>();
23  
24  	public UserGroup(long id) {
25  		super(id);
26  	}
27  
28  	@Override
29  	public int hashCode() {
30  		final int prime = 31;
31  		int result = super.hashCode();
32  		result = prime * result + Objects.hash(users);
33  		return result;
34  	}
35  
36  	@Override
37  	public boolean equals(Object obj) {
38  		if (this == obj)
39  			return true;
40  		if (!super.equals(obj))
41  			return false;
42  		if (!(obj instanceof UserGroup))
43  			return false;
44  		UserGroup other = (UserGroup) obj;
45  		return Objects.equals(users, other.users);
46  	}
47  
48  }