View Javadoc
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 io.swagger.v3.oas.annotations.media.Schema;
6   import jakarta.validation.constraints.NotEmpty;
7   import jakarta.validation.constraints.NotNull;
8   import lombok.Data;
9   import lombok.EqualsAndHashCode;
10  import lombok.NoArgsConstructor;
11  
12  @Data
13  @EqualsAndHashCode(callSuper = true)
14  @NoArgsConstructor
15  @Schema(name = "StructuredDataReference")
16  public class StructuredDataReferenceIO extends BasicReferenceIO {
17  
18  	@NotEmpty
19  	private String[] structuredDataOids;
20  
21  	@NotNull
22  	private long structuredDataContainerId;
23  
24  	public StructuredDataReferenceIO(StructuredDataReference ref) {
25  		super(ref);
26  		this.structuredDataOids = ref.getStructuredDatas().stream().map(StructuredData::getOid).toArray(String[]::new);
27  		this.structuredDataContainerId = ref.getStructuredDataContainer() != null
28  				? ref.getStructuredDataContainer().getId()
29  				: -1;
30  	}
31  
32  }