View Javadoc
1   package de.dlr.shepard.neo4Core.entities;
2   
3   import de.dlr.shepard.util.Constants;
4   import de.dlr.shepard.util.HasId;
5   import lombok.Data;
6   import lombok.NoArgsConstructor;
7   import lombok.ToString;
8   import org.neo4j.ogm.annotation.Relationship;
9   
10  @Data
11  @ToString(callSuper = true)
12  @NoArgsConstructor
13  public class BasicContainer extends BasicEntity {
14  
15    @ToString.Exclude
16    @Relationship(type = Constants.HAS_PERMISSIONS)
17    private Permissions permissions;
18  
19    /**
20     * For testing purposes only
21     *
22     * @param id identifies the entity
23     */
24    public BasicContainer(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 + HasId.hashcodeHelper(permissions);
33      return result;
34    }
35  
36    @Override
37    public boolean equals(Object obj) {
38      if (this == obj) return true;
39      if (!super.equals(obj)) return false;
40      if (!(obj instanceof BasicContainer)) return false;
41      BasicContainer other = (BasicContainer) obj;
42      return HasId.equalsHelper(permissions, other.permissions);
43    }
44  }