1 package de.dlr.shepard.neo4Core.io;
2
3 import de.dlr.shepard.neo4Core.entities.DataObject;
4 import lombok.Data;
5 import lombok.EqualsAndHashCode;
6 import lombok.NoArgsConstructor;
7 import org.eclipse.microprofile.openapi.annotations.media.Schema;
8
9 @Data
10 @EqualsAndHashCode(callSuper = true)
11 @NoArgsConstructor
12 @Schema(name = "DataObject")
13 public class DataObjectIO extends AbstractDataObjectIO {
14
15 @Schema(readOnly = true, required = true)
16 private long collectionId;
17
18 @Schema(readOnly = true, required = true)
19 private long[] referenceIds;
20
21 @Schema(readOnly = true, required = true)
22 private long[] successorIds;
23
24 private long[] predecessorIds;
25
26 @Schema(readOnly = true, required = true)
27 private long[] childrenIds;
28
29 @Schema(nullable = true, required = true)
30 private Long parentId;
31
32 @Schema(readOnly = true, required = true)
33 private long[] incomingIds;
34
35 public DataObjectIO(DataObject dataObject) {
36 super(dataObject);
37 this.collectionId = dataObject.getCollection().getShepardId();
38 this.referenceIds = extractShepardIds(dataObject.getReferences());
39 this.successorIds = extractShepardIds(dataObject.getSuccessors());
40 this.predecessorIds = extractShepardIds(dataObject.getPredecessors());
41 this.childrenIds = extractShepardIds(dataObject.getChildren());
42 this.parentId = dataObject.getParent() != null ? dataObject.getParent().getShepardId() : null;
43 this.incomingIds = extractShepardIds(dataObject.getIncoming());
44 }
45 }