1 package de.dlr.shepard.context.references.basicreference.io;
2
3 import de.dlr.shepard.common.neo4j.io.BasicEntityIO;
4 import de.dlr.shepard.context.references.basicreference.entities.BasicReference;
5 import java.util.Objects;
6 import lombok.Data;
7 import lombok.NoArgsConstructor;
8 import org.eclipse.microprofile.openapi.annotations.media.Schema;
9
10 @Data
11 @NoArgsConstructor
12 @Schema(name = "BasicReference")
13 public class BasicReferenceIO extends BasicEntityIO {
14
15 @Schema(readOnly = true)
16 private long dataObjectId;
17
18 @Schema(readOnly = true)
19 private String type;
20
21 public BasicReferenceIO(BasicReference ref) {
22 super(ref);
23 this.type = ref.getType();
24 this.dataObjectId = ref.getDataObject().getShepardId();
25 }
26
27 @Override
28 public boolean equals(Object o) {
29 if (this == o) return true;
30 if (o == null) return false;
31 if (!super.equals(o)) return false;
32 if (this.getClass() != o.getClass()) return false;
33 BasicReferenceIO other = (BasicReferenceIO) o;
34 return (dataObjectId == other.dataObjectId && Objects.equals(type, other.type));
35 }
36
37 @Override
38 public int hashCode() {
39 final int prime = 31;
40 int result = super.hashCode();
41 result = prime * result + ((Long) dataObjectId).hashCode();
42 result = prime * result + Objects.hashCode(type);
43 return result;
44 }
45 }