root / web_client / src / gr / grnet / pithos / web / client / foldertree / Folder.java @ a926611c
History | View | Annotate | Download (9.9 kB)
1 | 9e8e14e4 | Christos Stathis | /*
|
---|---|---|---|
2 | 58777026 | Christos Stathis | * Copyright 2011 GRNET S.A. All rights reserved.
|
3 | 58777026 | Christos Stathis | *
|
4 | 58777026 | Christos Stathis | * Redistribution and use in source and binary forms, with or
|
5 | 58777026 | Christos Stathis | * without modification, are permitted provided that the following
|
6 | 58777026 | Christos Stathis | * conditions are met:
|
7 | 58777026 | Christos Stathis | *
|
8 | 58777026 | Christos Stathis | * 1. Redistributions of source code must retain the above
|
9 | 58777026 | Christos Stathis | * copyright notice, this list of conditions and the following
|
10 | 58777026 | Christos Stathis | * disclaimer.
|
11 | 58777026 | Christos Stathis | *
|
12 | 58777026 | Christos Stathis | * 2. Redistributions in binary form must reproduce the above
|
13 | 58777026 | Christos Stathis | * copyright notice, this list of conditions and the following
|
14 | 58777026 | Christos Stathis | * disclaimer in the documentation and/or other materials
|
15 | 58777026 | Christos Stathis | * provided with the distribution.
|
16 | 58777026 | Christos Stathis | *
|
17 | 58777026 | Christos Stathis | * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
|
18 | 58777026 | Christos Stathis | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19 | 58777026 | Christos Stathis | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
20 | 58777026 | Christos Stathis | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
|
21 | 58777026 | Christos Stathis | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
22 | 58777026 | Christos Stathis | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
23 | 58777026 | Christos Stathis | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
24 | 58777026 | Christos Stathis | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
25 | 58777026 | Christos Stathis | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
26 | 58777026 | Christos Stathis | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
27 | 58777026 | Christos Stathis | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 | 58777026 | Christos Stathis | * POSSIBILITY OF SUCH DAMAGE.
|
29 | 58777026 | Christos Stathis | *
|
30 | 58777026 | Christos Stathis | * The views and conclusions contained in the software and
|
31 | 58777026 | Christos Stathis | * documentation are those of the authors and should not be
|
32 | 58777026 | Christos Stathis | * interpreted as representing official policies, either expressed
|
33 | 58777026 | Christos Stathis | * or implied, of GRNET S.A.
|
34 | 9e8e14e4 | Christos Stathis | */
|
35 | 9e8e14e4 | Christos Stathis | |
36 | 9e8e14e4 | Christos Stathis | package gr.grnet.pithos.web.client.foldertree; |
37 | 9e8e14e4 | Christos Stathis | |
38 | 0393c0ed | Christos Stathis | import gr.grnet.pithos.web.client.Pithos; |
39 | 0393c0ed | Christos Stathis | |
40 | 10791b56 | Christos Stathis | import java.util.Date; |
41 | 10791b56 | Christos Stathis | import java.util.HashMap; |
42 | 10791b56 | Christos Stathis | import java.util.LinkedHashSet; |
43 | 10791b56 | Christos Stathis | import java.util.Map; |
44 | 10791b56 | Christos Stathis | import java.util.Set; |
45 | 10791b56 | Christos Stathis | |
46 | 580478e1 | Christos Stathis | import com.google.gwt.core.client.GWT; |
47 | 5cd18037 | Christos Stathis | import com.google.gwt.http.client.Response; |
48 | 5cd18037 | Christos Stathis | import com.google.gwt.i18n.client.DateTimeFormat; |
49 | 5cd18037 | Christos Stathis | import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; |
50 | 5cd18037 | Christos Stathis | import com.google.gwt.json.client.JSONArray; |
51 | 5cd18037 | Christos Stathis | import com.google.gwt.json.client.JSONObject; |
52 | 5cd18037 | Christos Stathis | import com.google.gwt.json.client.JSONParser; |
53 | 5cd18037 | Christos Stathis | import com.google.gwt.json.client.JSONValue; |
54 | 9e8e14e4 | Christos Stathis | |
55 | 5cd18037 | Christos Stathis | public class Folder extends Resource { |
56 | 1ac430a1 | Christos Stathis | /*
|
57 | 1ac430a1 | Christos Stathis | * The name of the folder. If the folder is a container this is its name. If it is a virtual folder this is the
|
58 | 1ac430a1 | Christos Stathis | * last part of its path
|
59 | 1ac430a1 | Christos Stathis | */
|
60 | 5cd18037 | Christos Stathis | private String name = null; |
61 | 9e8e14e4 | Christos Stathis | |
62 | 5cd18037 | Christos Stathis | private Date lastModified = null; |
63 | 9e8e14e4 | Christos Stathis | |
64 | 5cd18037 | Christos Stathis | private long bytesUsed = 0; |
65 | 5cd18037 | Christos Stathis | |
66 | 3ca8cd89 | Christos Stathis | private Folder parent = null; |
67 | 3ca8cd89 | Christos Stathis | |
68 | 5cd18037 | Christos Stathis | private Set<Folder> subfolders = new LinkedHashSet<Folder>(); |
69 | 1ac430a1 | Christos Stathis | /*
|
70 | 1ac430a1 | Christos Stathis | * The name of the container that this folder belongs to. If this folder is container, this field equals name
|
71 | 1ac430a1 | Christos Stathis | */
|
72 | 5cd18037 | Christos Stathis | private String container = null; |
73 | 5cd18037 | Christos Stathis | |
74 | 1ac430a1 | Christos Stathis | /*
|
75 | 1ac430a1 | Christos Stathis | * This is the full path of the folder (prefix is a misnomer but it was named so because this is used as a prefix=
|
76 | 1ac430a1 | Christos Stathis | * parameter in the request that fetches its children). If the folder is a cointainer this is empty string
|
77 | 1ac430a1 | Christos Stathis | */
|
78 | 5cd18037 | Christos Stathis | private String prefix = ""; |
79 | 5cd18037 | Christos Stathis | |
80 | fbff60ff | Christos Stathis | private Set<File> files = new LinkedHashSet<File>(); |
81 | fbff60ff | Christos Stathis | |
82 | ba0078a6 | Christos Stathis | private Set<String> tags = new LinkedHashSet<String>(); |
83 | ba0078a6 | Christos Stathis | |
84 | 12190a0c | Christos Stathis | private String owner; |
85 | 12190a0c | Christos Stathis | |
86 | 9fce5629 | Christos Stathis | private Map<String, Boolean[]> permissions = new HashMap<String, Boolean[]>(); |
87 | 9fce5629 | Christos Stathis | |
88 | 9fce5629 | Christos Stathis | private String inheritedPermissionsFrom; |
89 | 9fce5629 | Christos Stathis | |
90 | 5cd18037 | Christos Stathis | public Folder() {};
|
91 | 9e8e14e4 | Christos Stathis | |
92 | 9e8e14e4 | Christos Stathis | public Folder(String name) { |
93 | 9e8e14e4 | Christos Stathis | this.name = name;
|
94 | 9e8e14e4 | Christos Stathis | } |
95 | 5cd18037 | Christos Stathis | |
96 | 5cd18037 | Christos Stathis | public String getName() { |
97 | 5cd18037 | Christos Stathis | return name;
|
98 | 5cd18037 | Christos Stathis | } |
99 | 9e8e14e4 | Christos Stathis | |
100 | 893549a3 | Christos Stathis | @Override
|
101 | 893549a3 | Christos Stathis | public Date getLastModified() { |
102 | 5cd18037 | Christos Stathis | return lastModified;
|
103 | 9e8e14e4 | Christos Stathis | } |
104 | 9e8e14e4 | Christos Stathis | |
105 | 5cd18037 | Christos Stathis | public long getBytesUsed() { |
106 | 5cd18037 | Christos Stathis | return bytesUsed;
|
107 | 9e8e14e4 | Christos Stathis | } |
108 | 9e8e14e4 | Christos Stathis | |
109 | 5cd18037 | Christos Stathis | public Set<Folder> getSubfolders() { |
110 | 9e8e14e4 | Christos Stathis | return subfolders;
|
111 | 9e8e14e4 | Christos Stathis | } |
112 | 9e8e14e4 | Christos Stathis | |
113 | 5cd18037 | Christos Stathis | public void setSubfolders(Set<Folder> subfolders) { |
114 | 9e8e14e4 | Christos Stathis | this.subfolders = subfolders;
|
115 | 9e8e14e4 | Christos Stathis | } |
116 | 5cd18037 | Christos Stathis | |
117 | 5cd18037 | Christos Stathis | public String getContainer() { |
118 | 5cd18037 | Christos Stathis | return container;
|
119 | 5cd18037 | Christos Stathis | } |
120 | 5cd18037 | Christos Stathis | |
121 | 5cd18037 | Christos Stathis | public String getPrefix() { |
122 | 5cd18037 | Christos Stathis | return prefix;
|
123 | 5cd18037 | Christos Stathis | } |
124 | 5cd18037 | Christos Stathis | |
125 | 5cd18037 | Christos Stathis | public void setPrefix(String prefix) { |
126 | 5cd18037 | Christos Stathis | this.prefix = prefix;
|
127 | 5cd18037 | Christos Stathis | } |
128 | 5cd18037 | Christos Stathis | |
129 | 9fce5629 | Christos Stathis | private void parsePermissions(String rawPermissions) { |
130 | 9fce5629 | Christos Stathis | String[] readwrite = rawPermissions.split(";"); |
131 | 9fce5629 | Christos Stathis | for (String s : readwrite) { |
132 | 9fce5629 | Christos Stathis | String[] part = s.split("="); |
133 | 9fce5629 | Christos Stathis | String perm = part[0].trim(); |
134 | 9fce5629 | Christos Stathis | String[] users = part[1].split(","); |
135 | 9fce5629 | Christos Stathis | for (String u : users) { |
136 | 9fce5629 | Christos Stathis | String user = u.trim();
|
137 | 9fce5629 | Christos Stathis | Boolean[] userPerm = permissions.get(u); |
138 | 9fce5629 | Christos Stathis | if (userPerm == null) { |
139 | 9fce5629 | Christos Stathis | userPerm = new Boolean[2]; |
140 | 9fce5629 | Christos Stathis | permissions.put(user, userPerm); |
141 | 9fce5629 | Christos Stathis | } |
142 | 9fce5629 | Christos Stathis | if (perm.equals("read")) { |
143 | 9fce5629 | Christos Stathis | userPerm[0] = Boolean.TRUE; |
144 | 9fce5629 | Christos Stathis | } |
145 | 9fce5629 | Christos Stathis | else if (perm.equals("write")) { |
146 | 9fce5629 | Christos Stathis | userPerm[1] = Boolean.TRUE; |
147 | 9fce5629 | Christos Stathis | } |
148 | 9fce5629 | Christos Stathis | } |
149 | 9fce5629 | Christos Stathis | } |
150 | 9fce5629 | Christos Stathis | } |
151 | 9fce5629 | Christos Stathis | |
152 | 10791b56 | Christos Stathis | public void populate(String _owner, Response response) { |
153 | 10791b56 | Christos Stathis | this.owner = _owner;
|
154 | 5cd18037 | Christos Stathis | String header = response.getHeader("Last-Modified"); |
155 | 5cd18037 | Christos Stathis | if (header != null) |
156 | 580478e1 | Christos Stathis | try {
|
157 | 580478e1 | Christos Stathis | lastModified = DateTimeFormat.getFormat(PredefinedFormat.RFC_2822).parse(header); |
158 | 580478e1 | Christos Stathis | } catch (IllegalArgumentException e) { |
159 | 580478e1 | Christos Stathis | GWT.log("Last-Modified will be set to null", e);
|
160 | 580478e1 | Christos Stathis | lastModified = null;
|
161 | 580478e1 | Christos Stathis | } |
162 | 5cd18037 | Christos Stathis | |
163 | 5cd18037 | Christos Stathis | header = response.getHeader("X-Container-Bytes-Used");
|
164 | 9274a125 | Christos Stathis | if (header != null && header.length() > 0) |
165 | 5cd18037 | Christos Stathis | bytesUsed = Long.valueOf(header);
|
166 | 5cd18037 | Christos Stathis | |
167 | ba0078a6 | Christos Stathis | header = response.getHeader("X-Container-Object-Meta");
|
168 | a39e5b47 | Christos Stathis | if (header != null && header.length() > 0) { |
169 | a39e5b47 | Christos Stathis | for (String t : header.split(",")) { |
170 | a39e5b47 | Christos Stathis | tags.add(t.toLowerCase().trim()); |
171 | 3da18014 | Christos Stathis | } |
172 | ba0078a6 | Christos Stathis | } |
173 | ba0078a6 | Christos Stathis | |
174 | 3ca8cd89 | Christos Stathis | subfolders.clear(); //This is necessary in case we update a pre-existing Folder so that stale subfolders won't show up
|
175 | 816de19f | Christos Stathis | files.clear(); |
176 | 5cd18037 | Christos Stathis | JSONValue json = JSONParser.parseStrict(response.getText()); |
177 | 5cd18037 | Christos Stathis | JSONArray array = json.isArray(); |
178 | 5cd18037 | Christos Stathis | if (array != null) { |
179 | 5cd18037 | Christos Stathis | for (int i=0; i<array.size(); i++) { |
180 | 5cd18037 | Christos Stathis | JSONObject o = array.get(i).isObject(); |
181 | 5cd18037 | Christos Stathis | if (o != null) { |
182 | 1ac430a1 | Christos Stathis | String contentType = unmarshallString(o, "content_type"); |
183 | 0bc032bf | Christos Stathis | if (o.containsKey("subdir") || (contentType != null && (contentType.startsWith("application/directory") || contentType.startsWith("application/folder")))) { |
184 | 5cd18037 | Christos Stathis | Folder f = new Folder();
|
185 | 10791b56 | Christos Stathis | f.populate(this, o, _owner, container);
|
186 | 5cd18037 | Christos Stathis | subfolders.add(f); |
187 | 5cd18037 | Christos Stathis | } |
188 | 0393c0ed | Christos Stathis | else {
|
189 | fbff60ff | Christos Stathis | File file = new File(); |
190 | 10791b56 | Christos Stathis | file.populate(this, o, _owner, container);
|
191 | fbff60ff | Christos Stathis | files.add(file); |
192 | 5cd18037 | Christos Stathis | } |
193 | 5cd18037 | Christos Stathis | } |
194 | 5cd18037 | Christos Stathis | } |
195 | 5cd18037 | Christos Stathis | } |
196 | 5cd18037 | Christos Stathis | } |
197 | 5cd18037 | Christos Stathis | |
198 | 10791b56 | Christos Stathis | public void populate(Folder _parent, JSONObject o, String _owner, String aContainer) { |
199 | 10791b56 | Christos Stathis | this.parent = _parent;
|
200 | 1ac430a1 | Christos Stathis | String path = null; |
201 | 5cd18037 | Christos Stathis | if (o.containsKey("subdir")) { |
202 | 1ac430a1 | Christos Stathis | path = unmarshallString(o, "subdir");
|
203 | 5cd18037 | Christos Stathis | } |
204 | 5cd18037 | Christos Stathis | else {
|
205 | 1ac430a1 | Christos Stathis | path = unmarshallString(o, "name");
|
206 | 5cd18037 | Christos Stathis | lastModified = unmarshallDate(o, "last_modified");
|
207 | 5cd18037 | Christos Stathis | } |
208 | 1ac430a1 | Christos Stathis | if (path.endsWith("/")) |
209 | 1ac430a1 | Christos Stathis | path = path.substring(0, path.length() - 1); |
210 | 1ac430a1 | Christos Stathis | if (path.contains("/")) |
211 | 1ac430a1 | Christos Stathis | name = path.substring(path.lastIndexOf("/") + 1, path.length()); //strip the prefix |
212 | 1ac430a1 | Christos Stathis | else
|
213 | 1ac430a1 | Christos Stathis | name = path; |
214 | 1ac430a1 | Christos Stathis | if (aContainer != null) { |
215 | 1ac430a1 | Christos Stathis | container = aContainer; |
216 | 1ac430a1 | Christos Stathis | prefix = path; |
217 | 1ac430a1 | Christos Stathis | } |
218 | 1ac430a1 | Christos Stathis | else {
|
219 | 1ac430a1 | Christos Stathis | container = name; |
220 | 1ac430a1 | Christos Stathis | prefix = "";
|
221 | 1ac430a1 | Christos Stathis | } |
222 | 10791b56 | Christos Stathis | this.owner = _owner;
|
223 | 9fce5629 | Christos Stathis | |
224 | 9fce5629 | Christos Stathis | inheritedPermissionsFrom = unmarshallString(o, "x_object_shared_by");
|
225 | 9fce5629 | Christos Stathis | String rawPermissions = unmarshallString(o, "x_object_sharing"); |
226 | 9fce5629 | Christos Stathis | if (rawPermissions != null) |
227 | 9fce5629 | Christos Stathis | parsePermissions(rawPermissions); |
228 | 5cd18037 | Christos Stathis | } |
229 | 5cd18037 | Christos Stathis | |
230 | 12190a0c | Christos Stathis | public static Folder createFromResponse(String owner, Response response, Folder result) { |
231 | 5cd18037 | Christos Stathis | Folder f = null;
|
232 | 5cd18037 | Christos Stathis | if (result == null) |
233 | 5cd18037 | Christos Stathis | f = new Folder();
|
234 | 5cd18037 | Christos Stathis | else
|
235 | 5cd18037 | Christos Stathis | f = result; |
236 | 5cd18037 | Christos Stathis | |
237 | 12190a0c | Christos Stathis | f.populate(owner, response); |
238 | 5cd18037 | Christos Stathis | return f;
|
239 | 5cd18037 | Christos Stathis | } |
240 | 5cd18037 | Christos Stathis | |
241 | 5cd18037 | Christos Stathis | @Override
|
242 | 5cd18037 | Christos Stathis | public boolean equals(Object other) { |
243 | 5cd18037 | Christos Stathis | if (other instanceof Folder) { |
244 | 5cd18037 | Christos Stathis | Folder o = (Folder) other; |
245 | 19a73342 | Christos Stathis | return getUri().equals(o.getUri());
|
246 | 5cd18037 | Christos Stathis | } |
247 | 5cd18037 | Christos Stathis | return false; |
248 | 5cd18037 | Christos Stathis | } |
249 | 5cd18037 | Christos Stathis | |
250 | 5cd18037 | Christos Stathis | @Override
|
251 | 5cd18037 | Christos Stathis | public int hashCode() { |
252 | 19a73342 | Christos Stathis | return getUri().hashCode();
|
253 | 5cd18037 | Christos Stathis | } |
254 | fbff60ff | Christos Stathis | |
255 | fbff60ff | Christos Stathis | public Set<File> getFiles() { |
256 | fbff60ff | Christos Stathis | return files;
|
257 | fbff60ff | Christos Stathis | } |
258 | 3ca8cd89 | Christos Stathis | |
259 | 3ca8cd89 | Christos Stathis | public Folder getParent() {
|
260 | 3ca8cd89 | Christos Stathis | return parent;
|
261 | 3ca8cd89 | Christos Stathis | } |
262 | 26cbae7a | Christos Stathis | |
263 | 26cbae7a | Christos Stathis | public String getUri() { |
264 | 26cbae7a | Christos Stathis | return "/" + container + (prefix.length() == 0 ? "" : "/" + prefix); |
265 | 26cbae7a | Christos Stathis | } |
266 | 4d3dcdf6 | Christos Stathis | |
267 | cf2dddff | Christos Stathis | public boolean isContainer() { |
268 | cf2dddff | Christos Stathis | return parent == null; |
269 | cf2dddff | Christos Stathis | } |
270 | 5eef5c8a | Christos Stathis | |
271 | 5eef5c8a | Christos Stathis | public void setContainer(String container) { |
272 | 5eef5c8a | Christos Stathis | this.container = container;
|
273 | 5eef5c8a | Christos Stathis | } |
274 | ba0078a6 | Christos Stathis | |
275 | ba0078a6 | Christos Stathis | public Set<String> getTags() { |
276 | ba0078a6 | Christos Stathis | return tags;
|
277 | ba0078a6 | Christos Stathis | } |
278 | 6e522e4f | Christos Stathis | |
279 | 6e522e4f | Christos Stathis | public String getInheritedPermissionsFrom() { |
280 | 6e522e4f | Christos Stathis | return inheritedPermissionsFrom;
|
281 | 6e522e4f | Christos Stathis | } |
282 | 6e522e4f | Christos Stathis | |
283 | 6e522e4f | Christos Stathis | public Map<String, Boolean[]> getPermissions() { |
284 | 6e522e4f | Christos Stathis | return permissions;
|
285 | 6e522e4f | Christos Stathis | } |
286 | 6e522e4f | Christos Stathis | |
287 | 6e522e4f | Christos Stathis | public String getOwner() { |
288 | 6e522e4f | Christos Stathis | return owner;
|
289 | 6e522e4f | Christos Stathis | } |
290 | 6e522e4f | Christos Stathis | |
291 | 6e522e4f | Christos Stathis | public boolean existChildrenPermissions() { |
292 | 6e522e4f | Christos Stathis | for (File f : files) |
293 | 6e522e4f | Christos Stathis | if (!f.getPermissions().isEmpty() && f.getInheritedPermissionsFrom() == null) |
294 | 6e522e4f | Christos Stathis | return true; |
295 | 6e522e4f | Christos Stathis | |
296 | 6e522e4f | Christos Stathis | for (Folder fo : subfolders)
|
297 | 6e522e4f | Christos Stathis | if ((!fo.getPermissions().isEmpty() && fo.getInheritedPermissionsFrom() == null) || fo.existChildrenPermissions()) |
298 | 6e522e4f | Christos Stathis | return true; |
299 | 6e522e4f | Christos Stathis | return false; |
300 | 6e522e4f | Christos Stathis | } |
301 | b6e41e8b | Christos Stathis | |
302 | b6e41e8b | Christos Stathis | public boolean isShared() { |
303 | b6e41e8b | Christos Stathis | return !permissions.isEmpty();
|
304 | b6e41e8b | Christos Stathis | } |
305 | 0393c0ed | Christos Stathis | |
306 | f72af3c3 | Christos Stathis | /**
|
307 | f72af3c3 | Christos Stathis | * I am THE trash
|
308 | f72af3c3 | Christos Stathis | *
|
309 | f72af3c3 | Christos Stathis | * @return
|
310 | f72af3c3 | Christos Stathis | */
|
311 | 0393c0ed | Christos Stathis | public boolean isTrash() { |
312 | 0393c0ed | Christos Stathis | return isContainer() && name.equals(Pithos.TRASH_CONTAINER);
|
313 | 0393c0ed | Christos Stathis | } |
314 | f72af3c3 | Christos Stathis | |
315 | f72af3c3 | Christos Stathis | /**
|
316 | f72af3c3 | Christos Stathis | * I am IN THE trash
|
317 | f72af3c3 | Christos Stathis | *
|
318 | f72af3c3 | Christos Stathis | * @return
|
319 | f72af3c3 | Christos Stathis | */
|
320 | f72af3c3 | Christos Stathis | public boolean isInTrash() { |
321 | f72af3c3 | Christos Stathis | return container.equals(Pithos.TRASH_CONTAINER);
|
322 | f72af3c3 | Christos Stathis | } |
323 | 0393c0ed | Christos Stathis | |
324 | 0393c0ed | Christos Stathis | public boolean isHome() { |
325 | 0393c0ed | Christos Stathis | return isContainer() && name.equals(Pithos.HOME_CONTAINER);
|
326 | 0393c0ed | Christos Stathis | } |
327 | 41eb16d0 | Christos Stathis | |
328 | 41eb16d0 | Christos Stathis | public boolean contains(Folder folder) { |
329 | 41eb16d0 | Christos Stathis | for (Folder f : subfolders)
|
330 | 41eb16d0 | Christos Stathis | if (f.equals(folder) || f.contains(folder))
|
331 | 41eb16d0 | Christos Stathis | return true; |
332 | 41eb16d0 | Christos Stathis | return false; |
333 | 41eb16d0 | Christos Stathis | } |
334 | 9e8e14e4 | Christos Stathis | } |