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.NodeEntity;
9 import org.neo4j.ogm.annotation.Relationship;
10 import org.neo4j.ogm.annotation.Relationship.Direction;
11
12 @NodeEntity
13 @Data
14 @ToString(callSuper = true, onlyExplicitlyIncluded = true)
15 @NoArgsConstructor
16 public class BasicReference extends VersionableEntity {
17
18 @Relationship(type = Constants.HAS_REFERENCE, direction = Direction.INCOMING)
19 private DataObject dataObject;
20
21
22
23
24
25
26 public BasicReference(long id) {
27 super(id);
28 }
29
30
31
32
33
34
35 public String getType() {
36 return this.getClass().getSimpleName();
37 }
38
39 @Override
40 public int hashCode() {
41 final int prime = 31;
42 int result = super.hashCode();
43 result = prime * result + HasId.hashcodeHelper(dataObject);
44 return result;
45 }
46
47 @Override
48 public boolean equals(Object obj) {
49 if (this == obj) return true;
50 if (!super.equals(obj)) return false;
51 if (!(obj instanceof BasicReference)) return false;
52 BasicReference other = (BasicReference) obj;
53 return HasId.equalsHelper(dataObject, other.dataObject);
54 }
55 }