View Javadoc
1   package de.dlr.shepard.neo4Core.io;
2   
3   import de.dlr.shepard.mongoDB.ShepardFile;
4   import de.dlr.shepard.neo4Core.entities.FileReference;
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 = "FileReference")
16  public class FileReferenceIO extends BasicReferenceIO {
17  
18    @NotEmpty
19    @Schema(required = true)
20    private String[] fileOids;
21  
22    @NotNull
23    @Schema(required = true)
24    private long fileContainerId;
25  
26    public FileReferenceIO(FileReference ref) {
27      super(ref);
28      this.fileOids = ref.getFiles().stream().map(ShepardFile::getOid).toArray(String[]::new);
29      this.fileContainerId = ref.getFileContainer() != null ? ref.getFileContainer().getId() : -1;
30    }
31  }