forked from gooddata/gooddata-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntry.java
More file actions
175 lines (151 loc) · 4.92 KB
/
Copy pathEntry.java
File metadata and controls
175 lines (151 loc) · 4.92 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
/*
* Copyright (C) 2004-2017, 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.*;
import com.gooddata.util.*;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.joda.time.DateTime;
import java.util.Set;
/**
* Metadata entry (can be named "LINK" in some API docs)
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Entry {
private final String uri;
private final String title;
private final String summary;
private final String category;
private final String author;
private final String contributor;
private final Boolean deprecated;
private final String identifier;
private final Set<String> tags;
private final DateTime created;
private final DateTime updated;
private final Boolean locked;
private final Boolean unlisted;
@JsonCreator
public Entry(@JsonProperty("link") String uri,
@JsonProperty("title") String title,
@JsonProperty("summary") String summary,
@JsonProperty("category") String category,
@JsonProperty("author") String author,
@JsonProperty("contributor") String contributor,
@JsonProperty("deprecated") @JsonDeserialize(using = BooleanDeserializer.class) Boolean deprecated,
@JsonProperty("identifier") String identifier,
@JsonProperty("tags") @JsonDeserialize(using = TagsDeserializer.class) Set<String> tags,
@JsonProperty("created") @JsonDeserialize(using = GDDateTimeDeserializer.class) DateTime created,
@JsonProperty("updated") @JsonDeserialize(using = GDDateTimeDeserializer.class) DateTime updated,
@JsonProperty("locked") @JsonDeserialize(using = BooleanDeserializer.class) Boolean locked,
@JsonProperty("unlisted") @JsonDeserialize(using = BooleanDeserializer.class) Boolean unlisted) {
this.uri = uri;
this.title = title;
this.summary = summary;
this.category = category;
this.author = author;
this.contributor = contributor;
this.deprecated = deprecated;
this.identifier = identifier;
this.tags = tags;
this.created = created;
this.updated = updated;
this.locked = locked;
this.unlisted = unlisted;
}
/**
* @return self URI string
* @deprecated use {@link #getUri()} instead
*/
@Deprecated
public String getLink() {
return getUri();
}
/**
* Returns internally generated ID of the object (that's part of the object URI).
* @return internal ID of the object
*/
@JsonIgnore
public String getId() {
return Obj.OBJ_TEMPLATE.match(getUri()).get("objId");
}
@JsonIgnore
public String getUri() {
return uri;
}
public String getTitle() {
return title;
}
public String getSummary() {
return summary;
}
public String getCategory() {
return category;
}
public String getAuthor() {
return author;
}
public String getContributor() {
return contributor;
}
/**
* @return true if the deprecated is set and is true
*/
@JsonIgnore
public boolean isDeprecated() {
return Boolean.TRUE.equals(deprecated);
}
@JsonSerialize(using = BooleanStringSerializer.class)
public Boolean getDeprecated() {
return deprecated;
}
/**
* Returns user-specified identifier of the object.
* @return user-specified object identifier
*/
public String getIdentifier() {
return identifier;
}
@JsonSerialize(using = TagsSerializer.class)
public Set<String> getTags() {
return tags;
}
@JsonSerialize(using = GDDateTimeSerializer.class)
public DateTime getCreated() {
return created;
}
@JsonSerialize(using = GDDateTimeSerializer.class)
public DateTime getUpdated() {
return updated;
}
/**
* @return true if the locked is set and is true
*/
@JsonIgnore
public boolean isLocked() {
return Boolean.TRUE.equals(locked);
}
@JsonSerialize(using = BooleanIntegerSerializer.class)
public Boolean getLocked() {
return locked;
}
/**
* @return true if the unlisted is set and is true
*/
@JsonIgnore
public boolean isUnlisted() {
return Boolean.TRUE.equals(unlisted);
}
@JsonSerialize(using = BooleanIntegerSerializer.class)
public Boolean getUnlisted() {
return unlisted;
}
@Override
public String toString() {
return GoodDataToStringBuilder.defaultToString(this);
}
}