-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathEbeanMetadataAspect.java
More file actions
93 lines (77 loc) · 2.45 KB
/
EbeanMetadataAspect.java
File metadata and controls
93 lines (77 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package com.linkedin.metadata.dao;
import io.ebean.Model;
import io.ebean.annotation.Index;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
/**
* Schema definition for the metadata aspect table.
*/
@Getter
@Setter
@Entity
@Table(name = "metadata_aspect")
public class EbeanMetadataAspect extends Model {
private static final long serialVersionUID = 1L;
public static final String ALL_COLUMNS = "*";
public static final String KEY_ID = "key";
public static final String URN_COLUMN = "urn";
public static final String ASPECT_COLUMN = "aspect";
public static final String VERSION_COLUMN = "version";
public static final String METADATA_COLUMN = "metadata";
public static final String CREATED_ON_COLUMN = "createdOn";
public static final String CREATED_BY_COLUMN = "createdBy";
public static final String CREATED_FOR_COLUMN = "createdFor";
/**
* Key for an aspect in the table.
*/
@Embeddable
@Getter
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
public static class PrimaryKey {
private static final long serialVersionUID = 1L;
@NonNull
@Index
@Column(name = URN_COLUMN, length = 500, nullable = false)
private String urn;
@NonNull
@Index
@Column(name = ASPECT_COLUMN, length = 200, nullable = false)
private String aspect;
@Index
@Column(name = VERSION_COLUMN, nullable = false)
private long version;
}
@NonNull
@EmbeddedId
@Index
protected PrimaryKey key;
@Lob
@Column(name = METADATA_COLUMN, nullable = false)
protected String metadata;
@NonNull
@Column(name = CREATED_ON_COLUMN, nullable = false)
private Timestamp createdOn;
@NonNull
@Column(name = CREATED_BY_COLUMN, nullable = false)
private String createdBy;
@Column(name = CREATED_FOR_COLUMN, nullable = true)
private String createdFor;
@Override
public String toString() {
final String str = "EbeanMetadataAspect: {key: <urn:%s, aspect:%s, version:%s>, createdOn: %s, createdBy: %s, createdFor: %s, metadata: %s}";
return String.format(str, key.getUrn(), key.getAspect(), key.getVersion(), createdOn, createdBy, createdFor, metadata);
}
}