View Javadoc
1   package de.dlr.shepard.mongoDB;
2   
3   import java.util.Date;
4   import lombok.Data;
5   import lombok.EqualsAndHashCode;
6   import lombok.NoArgsConstructor;
7   import lombok.ToString;
8   import org.bson.Document;
9   import org.eclipse.microprofile.openapi.annotations.media.Schema;
10  import org.neo4j.ogm.annotation.NodeEntity;
11  
12  @NodeEntity
13  @Data
14  @EqualsAndHashCode(callSuper = true)
15  @ToString(callSuper = true)
16  @NoArgsConstructor
17  public class StructuredData extends AbstractMongoObject {
18  
19    @Schema(nullable = true)
20    private String name;
21  
22    public StructuredData(String name, Date createdAt) {
23      setCreatedAt(createdAt);
24      this.name = name;
25    }
26  
27    public StructuredData(String oid, Date createdAt, String name) {
28      super(oid, createdAt);
29      this.name = name;
30    }
31  
32    /**
33     * Converts a document to StructuredData
34     *
35     * @param doc Document
36     */
37    public StructuredData(Document doc) {
38      super(doc.getString("oid"), doc.getDate("createdAt"));
39      this.name = doc.getString("name");
40    }
41  }