forked from gooddata/gooddata-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMeta.java
More file actions
248 lines (212 loc) · 7.34 KB
/
Copy pathMeta.java
File metadata and controls
248 lines (212 loc) · 7.34 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/**
* Copyright (C) 2004-2016, GoodData(R) Corporation. All rights reserved.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
package com.gooddata.md;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.gooddata.util.*;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.joda.time.DateTime;
import java.io.Serializable;
import java.util.Set;
import static org.apache.commons.lang3.StringUtils.substring;
/**
* Metadata meta information (meant just for internal SDK usage)
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Meta implements Serializable {
private static final int SUMMARY_MAX_LENGTH = 2048;
private static final int TITLE_MAX_LENGTH = 255;
private String author;
private String contributor;
private DateTime created;
private DateTime updated;
private String summary;
private String title;
private String category;
private Set<String> tags;
private String uri;
private String identifier;
private Boolean deprecated;
private Boolean production;
private Boolean locked;
private Boolean unlisted;
private Boolean sharedWithSomeone;
@JsonCreator
protected Meta(@JsonProperty("author") String author,
@JsonProperty("contributor") String contributor,
@JsonProperty("created") @JsonDeserialize(using = GDDateTimeDeserializer.class) DateTime created,
@JsonProperty("updated") @JsonDeserialize(using = GDDateTimeDeserializer.class) DateTime updated,
@JsonProperty("summary") String summary,
@JsonProperty("title") String title,
@JsonProperty("category") String category,
@JsonProperty("tags") @JsonDeserialize(using = TagsDeserializer.class) Set<String> tags,
@JsonProperty("uri") String uri,
@JsonProperty("identifier") String identifier) {
super();
this.author = author;
this.uri = uri;
this.tags = tags;
this.created = created;
this.summary = substring(summary, 0, SUMMARY_MAX_LENGTH);
this.title = substring(title, 0, TITLE_MAX_LENGTH);
this.updated = updated;
this.category = category;
this.identifier = identifier;
this.contributor = contributor;
}
public Meta(String author, String contributor, DateTime created, DateTime updated, String summary,
String title, String category, Set<String> tags, String uri, String identifier,
Boolean deprecated, Boolean production, Boolean locked, Boolean unlisted, Boolean sharedWithSomeone) {
this.author = author;
this.contributor = contributor;
this.created = created;
this.updated = updated;
this.summary = summary;
this.title = title;
this.category = category;
this.tags = tags;
this.uri = uri;
this.identifier = identifier;
this.deprecated = deprecated;
this.production = production;
this.locked = locked;
this.unlisted = unlisted;
this.sharedWithSomeone = sharedWithSomeone;
}
public Meta(String title) {
this(title, null);
}
public Meta(String title, String summary) {
this.title = title;
this.summary = summary;
}
public String getAuthor() {
return author;
}
public String getContributor() {
return contributor;
}
@JsonSerialize(using = GDDateTimeSerializer.class)
public DateTime getCreated() {
return created;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@JsonSerialize(using = GDDateTimeSerializer.class)
public DateTime getUpdated() {
return updated;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
@JsonSerialize(using = TagsSerializer.class)
public Set<String> getTags() {
return tags;
}
public void setTags(Set<String> tags) {
this.tags = tags;
}
public String getUri() {
return uri;
}
/**
* Default is false/not-deprecated.
* @return true when the linked object is deprecated, null if not set
*/
@JsonProperty("deprecated")
@JsonSerialize(using = BooleanStringSerializer.class)
public Boolean isDeprecated() {
return deprecated;
}
@JsonProperty("deprecated")
@JsonDeserialize(using = BooleanDeserializer.class)
public void setDeprecated(Boolean deprecated) {
this.deprecated = deprecated;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
/**
* Is the object production or not? Defaults to true.
* @return true when the linked object is production, null if not set
*/
@JsonProperty("isProduction")
@JsonSerialize(using = BooleanIntegerSerializer.class)
public Boolean isProduction() {
return production;
}
@JsonProperty("isProduction")
@JsonDeserialize(using = BooleanDeserializer.class)
public void setProduction(final Boolean production) {
this.production = production;
}
/**
* Flag that MD object is locked; default is false/unlocked.
* @return true when the linked object is locked, null if not set
*/
@JsonProperty("locked")
@JsonSerialize(using = BooleanIntegerSerializer.class)
public Boolean isLocked() {
return locked;
}
@JsonProperty("locked")
@JsonDeserialize(using = BooleanDeserializer.class)
public void setLocked(Boolean locked) {
this.locked = locked;
}
/**
* Default is false/listed.
* @return true when the linked object is unlisted, null if not set
*/
@JsonProperty("unlisted")
@JsonSerialize(using = BooleanIntegerSerializer.class)
public Boolean isUnlisted() {
return unlisted;
}
@JsonProperty("unlisted")
@JsonDeserialize(using = BooleanDeserializer.class)
public void setUnlisted(Boolean unlisted) {
this.unlisted = unlisted;
}
/**
* Is the linked object shared with someone via ACLs?
* @return true when the linked object is shared, null if not set
*/
@JsonProperty("sharedWithSomeone")
@JsonSerialize(using = BooleanIntegerSerializer.class)
public Boolean isSharedWithSomeone() {
return sharedWithSomeone;
}
@JsonProperty("sharedWithSomeone")
@JsonDeserialize(using = BooleanDeserializer.class)
public void setSharedWithSomeone(final Boolean sharedWithSomeone) {
this.sharedWithSomeone = sharedWithSomeone;
}
@Override
public String toString() {
return GoodDataToStringBuilder.defaultToString(this);
}
}