1 package de.dlr.shepard.neo4Core.io;
2
3 import de.dlr.shepard.mongoDB.StructuredData;
4 import de.dlr.shepard.neo4Core.entities.StructuredDataReference;
5 import jakarta.validation.constraints.NotEmpty;
6 import jakarta.validation.constraints.NotNull;
7 import lombok.Data;
8 import lombok.EqualsAndHashCode;
9 import lombok.NoArgsConstructor;
10 import org.eclipse.microprofile.openapi.annotations.media.Schema;
11
12 @Data
13 @EqualsAndHashCode(callSuper = true)
14 @NoArgsConstructor
15 @Schema(name = "StructuredDataReference")
16 public class StructuredDataReferenceIO extends BasicReferenceIO {
17
18 @NotEmpty
19 @Schema(required = true)
20 private String[] structuredDataOids;
21
22 @NotNull
23 @Schema(required = true)
24 private long structuredDataContainerId;
25
26 public StructuredDataReferenceIO(StructuredDataReference ref) {
27 super(ref);
28 this.structuredDataOids = ref.getStructuredDatas().stream().map(StructuredData::getOid).toArray(String[]::new);
29 this.structuredDataContainerId = ref.getStructuredDataContainer() != null
30 ? ref.getStructuredDataContainer().getId()
31 : -1;
32 }
33 }