1 package de.dlr.shepard.neo4Core.entities;
2
3 import java.util.Objects;
4
5 import org.neo4j.ogm.annotation.NodeEntity;
6 import org.neo4j.ogm.annotation.Relationship;
7
8 import de.dlr.shepard.util.Constants;
9 import de.dlr.shepard.util.HasId;
10 import lombok.Data;
11 import lombok.NoArgsConstructor;
12 import lombok.ToString;
13
14 @NodeEntity
15 @Data
16 @NoArgsConstructor
17 public class DataObjectReference extends BasicReference {
18
19 @ToString.Exclude
20 @Relationship(type = Constants.POINTS_TO)
21 private DataObject referencedDataObject;
22
23 private String relationship;
24
25
26
27
28
29
30 public DataObjectReference(long id) {
31 super(id);
32 }
33
34 @Override
35 public int hashCode() {
36 final int prime = 31;
37 int result = super.hashCode();
38 result = prime * result + Objects.hash(relationship);
39 result = prime * result + HasId.hashcodeHelper(referencedDataObject);
40 return result;
41 }
42
43 @Override
44 public boolean equals(Object obj) {
45 if (this == obj)
46 return true;
47 if (!super.equals(obj))
48 return false;
49 if (!(obj instanceof DataObjectReference))
50 return false;
51 DataObjectReference other = (DataObjectReference) obj;
52 return Objects.equals(relationship, other.relationship)
53 && HasId.equalsHelper(referencedDataObject, other.referencedDataObject);
54 }
55
56 }