Revision b51c628b src/gr/grnet/pithos/web/client/foldertree/File.java
b/src/gr/grnet/pithos/web/client/foldertree/File.java | ||
---|---|---|
78 | 78 |
|
79 | 79 |
private Set<String> tags = new HashSet<String>(); |
80 | 80 |
|
81 |
private boolean published; |
|
82 |
|
|
81 | 83 |
public String getContentType() { |
82 | 84 |
return contentType; |
83 | 85 |
} |
... | ... | |
141 | 143 |
return inTrash; |
142 | 144 |
} |
143 | 145 |
|
144 |
public void populate(Folder parent, JSONObject o, String container) { |
|
146 |
public void populate(Folder parent, JSONObject o, String owner, String container) {
|
|
145 | 147 |
this.parent = parent; |
146 | 148 |
path = unmarshallString(o, "name"); |
147 | 149 |
if (path.contains("/")) |
148 | 150 |
name = path.substring(path.lastIndexOf("/") + 1, path.length()); //strip the prefix |
149 | 151 |
else |
150 | 152 |
name = path; |
153 |
this.owner = owner; |
|
151 | 154 |
hash = unmarshallString(o, "hash"); |
152 | 155 |
bytes = unmarshallLong(o, "bytes"); |
153 | 156 |
version = unmarshallInt(o, "version"); |
... | ... | |
155 | 158 |
lastModified = unmarshallDate(o, "last_modified"); |
156 | 159 |
modifiedBy = unmarshallString(o, "modified_by"); |
157 | 160 |
versionTimestamp = unmarshallDate(o, "version_timestamp"); |
161 |
published = unmarshallBoolean(o, "x_object_public"); |
|
158 | 162 |
this.container = container; |
159 | 163 |
|
160 | 164 |
for (String key : o.keySet()) |
161 | 165 |
if (key.startsWith("x_object_meta_") && !key.equals("x_object_meta_trash")) |
162 | 166 |
tags.add(key.substring("x_object_meta_".length()).trim().toLowerCase()); |
167 |
|
|
168 |
|
|
163 | 169 |
} |
164 | 170 |
|
165 | 171 |
public boolean equals(Object other) { |
... | ... | |
178 | 184 |
return container; |
179 | 185 |
} |
180 | 186 |
|
181 |
public static File createFromResponse(Response response, File result) { |
|
182 |
result.populate(response); |
|
187 |
public static File createFromResponse(String owner, Response response, File result) {
|
|
188 |
result.populate(owner, response);
|
|
183 | 189 |
return result; |
184 | 190 |
} |
185 | 191 |
|
186 |
private void populate(Response response) { |
|
192 |
private void populate(String owner, Response response) { |
|
193 |
this.owner = owner; |
|
187 | 194 |
for (Header h : response.getHeaders()) { |
188 | 195 |
String header = h.getName(); |
189 | 196 |
if (header.startsWith("X-Object-Meta-") && !header.equals("X-Object-Meta-Trash")) |
... | ... | |
195 | 202 |
inTrash = Boolean.valueOf(header); |
196 | 203 |
else |
197 | 204 |
inTrash = false; |
198 |
|
|
199 |
JSONValue json = JSONParser.parseStrict(response.getText()); |
|
200 |
JSONObject o = json.isObject(); |
|
201 | 205 |
} |
202 | 206 |
|
203 | 207 |
public Folder getParent() { |
... | ... | |
207 | 211 |
public Set<String> getTags() { |
208 | 212 |
return tags; |
209 | 213 |
} |
214 |
|
|
215 |
public boolean isPublished() { |
|
216 |
return published; |
|
217 |
} |
|
210 | 218 |
} |
Also available in: Unified diff