Statistics
| Branch: | Tag: | Revision:

root / src / gr / ebs / gss / server / ejb / ExternalAPI.java @ a0dde818

History | View | Annotate | Download (50.1 kB)

1 14ad7326 pastith
/*
2 14ad7326 pastith
 * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd.
3 14ad7326 pastith
 *
4 14ad7326 pastith
 * This file is part of GSS.
5 14ad7326 pastith
 *
6 14ad7326 pastith
 * GSS is free software: you can redistribute it and/or modify
7 14ad7326 pastith
 * it under the terms of the GNU General Public License as published by
8 14ad7326 pastith
 * the Free Software Foundation, either version 3 of the License, or
9 14ad7326 pastith
 * (at your option) any later version.
10 14ad7326 pastith
 *
11 14ad7326 pastith
 * GSS is distributed in the hope that it will be useful,
12 14ad7326 pastith
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 14ad7326 pastith
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14ad7326 pastith
 * GNU General Public License for more details.
15 14ad7326 pastith
 *
16 14ad7326 pastith
 * You should have received a copy of the GNU General Public License
17 14ad7326 pastith
 * along with GSS.  If not, see <http://www.gnu.org/licenses/>.
18 14ad7326 pastith
 */
19 14ad7326 pastith
package gr.ebs.gss.server.ejb;
20 14ad7326 pastith
21 14ad7326 pastith
import gr.ebs.gss.client.exceptions.DuplicateNameException;
22 14ad7326 pastith
import gr.ebs.gss.client.exceptions.GSSIOException;
23 14ad7326 pastith
import gr.ebs.gss.client.exceptions.InsufficientPermissionsException;
24 14ad7326 pastith
import gr.ebs.gss.client.exceptions.ObjectNotFoundException;
25 14ad7326 pastith
import gr.ebs.gss.client.exceptions.QuotaExceededException;
26 14ad7326 pastith
import gr.ebs.gss.server.domain.FileUploadStatus;
27 14ad7326 pastith
import gr.ebs.gss.server.domain.Nonce;
28 14ad7326 pastith
import gr.ebs.gss.server.domain.User;
29 2f2da9c7 pastith
import gr.ebs.gss.server.domain.dto.FileBodyDTO;
30 2f2da9c7 pastith
import gr.ebs.gss.server.domain.dto.FileHeaderDTO;
31 2f2da9c7 pastith
import gr.ebs.gss.server.domain.dto.FolderDTO;
32 2f2da9c7 pastith
import gr.ebs.gss.server.domain.dto.GroupDTO;
33 2f2da9c7 pastith
import gr.ebs.gss.server.domain.dto.PermissionDTO;
34 2f2da9c7 pastith
import gr.ebs.gss.server.domain.dto.StatsDTO;
35 2f2da9c7 pastith
import gr.ebs.gss.server.domain.dto.UserDTO;
36 14ad7326 pastith
37 14ad7326 pastith
import java.io.File;
38 14ad7326 pastith
import java.io.IOException;
39 14ad7326 pastith
import java.io.InputStream;
40 14ad7326 pastith
import java.util.Date;
41 14ad7326 pastith
import java.util.List;
42 14ad7326 pastith
import java.util.Set;
43 14ad7326 pastith
44 14ad7326 pastith
import javax.ejb.Local;
45 14ad7326 pastith
import javax.ejb.TransactionAttribute;
46 14ad7326 pastith
import javax.ejb.TransactionAttributeType;
47 14ad7326 pastith
48 14ad7326 pastith
/**
49 14ad7326 pastith
 * The External API for GSS clients.
50 14ad7326 pastith
 *
51 14ad7326 pastith
 * @author past
52 14ad7326 pastith
 */
53 14ad7326 pastith
@Local
54 14ad7326 pastith
public interface ExternalAPI {
55 14ad7326 pastith
56 14ad7326 pastith
        /**
57 14ad7326 pastith
         * Retrieves the root folder for the specified user. The caller must ensure
58 14ad7326 pastith
         * that the userId exists.
59 14ad7326 pastith
         *
60 14ad7326 pastith
         * @param userId
61 14ad7326 pastith
         * @return Folder
62 14ad7326 pastith
         * @throws ObjectNotFoundException if no Folder or user was found
63 14ad7326 pastith
         */
64 14ad7326 pastith
        public FolderDTO getRootFolder(Long userId) throws ObjectNotFoundException;
65 14ad7326 pastith
66 14ad7326 pastith
        /**
67 14ad7326 pastith
         * Retrieve the folder with the specified ID.
68 14ad7326 pastith
         *
69 14ad7326 pastith
         * @param userId the ID of the current user
70 14ad7326 pastith
         * @param folderId the ID of the folder to retrieve
71 14ad7326 pastith
         * @return the folder found
72 14ad7326 pastith
         * @throws ObjectNotFoundException if the folder or the user was not found
73 14ad7326 pastith
         * @throws InsufficientPermissionsException if ther user does not have read permissions for folder
74 14ad7326 pastith
         */
75 14ad7326 pastith
        public FolderDTO getFolder(Long userId, Long folderId) throws ObjectNotFoundException,
76 14ad7326 pastith
                        InsufficientPermissionsException;
77 14ad7326 pastith
78 14ad7326 pastith
        /**
79 14ad7326 pastith
         * Returns the user with the specified ID.
80 14ad7326 pastith
         *
81 14ad7326 pastith
         * @param userId The ID of the User to be found
82 14ad7326 pastith
         * @return The User object
83 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
84 14ad7326 pastith
         */
85 14ad7326 pastith
        public User getUser(Long userId) throws ObjectNotFoundException;
86 14ad7326 pastith
87 14ad7326 pastith
        /**
88 14ad7326 pastith
         * Returns the user with the specified ID.
89 14ad7326 pastith
         *
90 14ad7326 pastith
         * @param userId The ID of the User to be found
91 14ad7326 pastith
         * @return The User object
92 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
93 14ad7326 pastith
         */
94 14ad7326 pastith
        public UserDTO getUserDTO(Long userId) throws ObjectNotFoundException;
95 14ad7326 pastith
96 14ad7326 pastith
        /**
97 14ad7326 pastith
         * Returns the group with the specified ID.
98 14ad7326 pastith
         *
99 14ad7326 pastith
         * @param groupId The ID of the Group to be found
100 14ad7326 pastith
         * @return The Group object
101 14ad7326 pastith
         * @throws ObjectNotFoundException if the group cannot be found
102 14ad7326 pastith
         */
103 14ad7326 pastith
        public GroupDTO getGroup(Long groupId) throws ObjectNotFoundException;
104 14ad7326 pastith
105 14ad7326 pastith
        /**
106 14ad7326 pastith
         * Returns the group with the specified name that belongs to the
107 14ad7326 pastith
         * specified user.
108 14ad7326 pastith
         *
109 14ad7326 pastith
         * @param userId the ID of the user
110 14ad7326 pastith
         * @param name the name of the group
111 14ad7326 pastith
         * @return The Group object
112 14ad7326 pastith
         * @throws ObjectNotFoundException if the group cannot be found
113 14ad7326 pastith
         */
114 14ad7326 pastith
        public GroupDTO getGroup(Long userId, String name) throws ObjectNotFoundException;
115 14ad7326 pastith
116 14ad7326 pastith
        /**
117 14ad7326 pastith
         * Retrieve the list of groups for a particular user.
118 14ad7326 pastith
         *
119 14ad7326 pastith
         * @param userId the ID of the User
120 14ad7326 pastith
         * @return a List of Groups that belong to the specified User
121 14ad7326 pastith
         * @throws ObjectNotFoundException if the user was not found
122 14ad7326 pastith
         */
123 14ad7326 pastith
        public List<GroupDTO> getGroups(Long userId) throws ObjectNotFoundException;
124 14ad7326 pastith
125 14ad7326 pastith
        /**
126 14ad7326 pastith
         * Returns a list of files contained in the folder specified by its id.
127 14ad7326 pastith
         *
128 14ad7326 pastith
         * @param userId the ID of the User
129 14ad7326 pastith
         * @param folderId the ID of the folder containing the files
130 3d1b9329 koutsoub
         * @param ignoreDeleted
131 14ad7326 pastith
         * @return the list of file header objects
132 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or the folder cannot be found
133 14ad7326 pastith
         * @throws InsufficientPermissionsException
134 14ad7326 pastith
         */
135 3d1b9329 koutsoub
        public List<FileHeaderDTO> getFiles(Long userId, Long folderId, boolean ignoreDeleted) throws ObjectNotFoundException,
136 14ad7326 pastith
                        InsufficientPermissionsException;
137 14ad7326 pastith
138 14ad7326 pastith
        /**
139 14ad7326 pastith
         * Returns a list of users for the specified group
140 14ad7326 pastith
         *
141 14ad7326 pastith
         * @param userId the ID of the User
142 14ad7326 pastith
         * @param groupId the ID of the requested group
143 14ad7326 pastith
         * @return List<UserDTO>
144 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or group was not found, with
145 14ad7326 pastith
         *             the exception message mentioning the precise problem
146 14ad7326 pastith
         */
147 14ad7326 pastith
        public List<UserDTO> getUsers(Long userId, Long groupId) throws ObjectNotFoundException;
148 14ad7326 pastith
149 14ad7326 pastith
        /**
150 14ad7326 pastith
         * Returns a list of users matching the specified username
151 14ad7326 pastith
         *
152 14ad7326 pastith
         * @param username the username of the User
153 14ad7326 pastith
         * @return List<UserDTO>
154 14ad7326 pastith
         */
155 14ad7326 pastith
        public List<UserDTO> getUsersByUserNameLike(String username);
156 14ad7326 pastith
157 14ad7326 pastith
        /**
158 14ad7326 pastith
         * Creates a new folder with the specified owner, parent folder and name.
159 14ad7326 pastith
         * New folder has the same permissions as its parent
160 14ad7326 pastith
         *
161 14ad7326 pastith
         * @param userId
162 14ad7326 pastith
         * @param parentId
163 14ad7326 pastith
         * @param name
164 a0dde818 Panagiotis Astithas
         * @return the new folder
165 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
166 14ad7326 pastith
         *             the parent folder, as either a folder or file
167 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or parent folder was not
168 14ad7326 pastith
         *             found, with the exception message mentioning the precise
169 14ad7326 pastith
         *             problem
170 14ad7326 pastith
         * @throws InsufficientPermissionsException
171 14ad7326 pastith
         */
172 a0dde818 Panagiotis Astithas
        public FolderDTO createFolder(Long userId, Long parentId, String name) throws DuplicateNameException,
173 14ad7326 pastith
                        ObjectNotFoundException, InsufficientPermissionsException;
174 14ad7326 pastith
175 14ad7326 pastith
        /**
176 14ad7326 pastith
         * Deletes the specified folder, if the specified user has the appropriate
177 14ad7326 pastith
         * permission.
178 14ad7326 pastith
         *
179 14ad7326 pastith
         * @param userId the ID of the current user
180 14ad7326 pastith
         * @param folderId the ID of the folder to delete
181 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
182 14ad7326 pastith
         *             appropriate privileges
183 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or folder was not found, with
184 14ad7326 pastith
         *             the exception message mentioning the precise problem
185 14ad7326 pastith
         */
186 14ad7326 pastith
        public void deleteFolder(Long userId, Long folderId)
187 14ad7326 pastith
                        throws InsufficientPermissionsException, ObjectNotFoundException;
188 14ad7326 pastith
189 14ad7326 pastith
        /**
190 14ad7326 pastith
         * Retrieve the subfolders of the specified folder.
191 14ad7326 pastith
         *
192 14ad7326 pastith
         * @param userId the ID of the current user
193 14ad7326 pastith
         * @param folderId the ID of the folder to retrieve
194 14ad7326 pastith
         * @return the list of subfolders found
195 14ad7326 pastith
         * @throws ObjectNotFoundException if the folder or user was not found
196 14ad7326 pastith
         * @throws InsufficientPermissionsException
197 14ad7326 pastith
         */
198 14ad7326 pastith
        public List<FolderDTO> getSubfolders(Long userId, Long folderId)
199 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
200 14ad7326 pastith
201 14ad7326 pastith
        /**
202 14ad7326 pastith
         * Retrieve the folder with the specified ID with subfolders.
203 14ad7326 pastith
         *
204 14ad7326 pastith
         * @param userId the ID of the current user
205 14ad7326 pastith
         * @param folderId the ID of the folder to retrieve
206 14ad7326 pastith
         * @return the folder found
207 14ad7326 pastith
         * @throws ObjectNotFoundException if the folder or the user was not found
208 14ad7326 pastith
         * @throws InsufficientPermissionsException if ther user does not have read permissions for folder
209 14ad7326 pastith
         */
210 14ad7326 pastith
        public FolderDTO getFolderWithSubfolders(Long userId, Long folderId)
211 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
212 14ad7326 pastith
213 14ad7326 pastith
        /**
214 14ad7326 pastith
         * Retrieve the folder with the specified ID with subfolders.
215 14ad7326 pastith
         *
216 14ad7326 pastith
         * @param userId the ID of the current user
217 14ad7326 pastith
         * @param callingUserId the ID of the user requesting this operation
218 14ad7326 pastith
         * @param folderId the ID of the folder to retrieve
219 14ad7326 pastith
         * @return the folder found
220 14ad7326 pastith
         * @throws ObjectNotFoundException if the folder or the user was not found
221 14ad7326 pastith
         * @throws InsufficientPermissionsException if ther user does not have read permissions for folder
222 14ad7326 pastith
         */
223 14ad7326 pastith
        public FolderDTO getFolderWithSubfolders(Long userId, Long callingUserId, Long folderId)
224 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
225 14ad7326 pastith
        /**
226 14ad7326 pastith
         * Retrieve the subfolders of the specified folder that are shared to others.
227 14ad7326 pastith
         *
228 14ad7326 pastith
         * @param userId the ID of the current user
229 14ad7326 pastith
         * @param folderId the ID of the folder to retrieve
230 14ad7326 pastith
         * @return the list of subfolders found
231 14ad7326 pastith
         * @throws ObjectNotFoundException if the folder or user was not found
232 14ad7326 pastith
         */
233 14ad7326 pastith
        public List<FolderDTO> getSharedSubfolders(Long userId, Long folderId) throws ObjectNotFoundException;
234 14ad7326 pastith
235 14ad7326 pastith
        /**
236 14ad7326 pastith
         * Retrieve the subfolders of the specified folder that are shared to others.
237 14ad7326 pastith
         *
238 14ad7326 pastith
         * @param userId the ID of the current user
239 14ad7326 pastith
         * @param callingUserId the id of the user requesting this operation
240 14ad7326 pastith
         * @param folderId the ID of the folder to retrieve
241 14ad7326 pastith
         * @return the list of subfolders found
242 14ad7326 pastith
         * @throws ObjectNotFoundException if the folder or user was not found
243 14ad7326 pastith
         */
244 14ad7326 pastith
        public List<FolderDTO> getSharedSubfolders(Long userId, Long callingUserId, Long folderId) throws ObjectNotFoundException;
245 14ad7326 pastith
        /**
246 14ad7326 pastith
         * Modifies the specified folder if the specified user has the appropriate
247 14ad7326 pastith
         * permission.
248 14ad7326 pastith
         *
249 14ad7326 pastith
         * @param userId the ID of the current user
250 14ad7326 pastith
         * @param folderId the ID of the folder to retrieve
251 14ad7326 pastith
         * @param folderName
252 77dcb3f1 Panagiotis Astithas
         * @return the updated folder
253 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
254 14ad7326 pastith
         *             appropriate privileges
255 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or folder was not found, with
256 14ad7326 pastith
         *             the exception message mentioning the precise problem
257 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
258 14ad7326 pastith
         *             the parent folder, as either a folder or file
259 14ad7326 pastith
         */
260 77dcb3f1 Panagiotis Astithas
        public FolderDTO modifyFolder(Long userId, Long folderId, String folderName)
261 14ad7326 pastith
                        throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException;
262 14ad7326 pastith
263 14ad7326 pastith
        /**
264 14ad7326 pastith
         * Adds a user to the specified group
265 14ad7326 pastith
         *
266 14ad7326 pastith
         * @param userId the ID of the current user
267 14ad7326 pastith
         * @param groupId the id of the new group
268 14ad7326 pastith
         * @param userToAddId the id of the user to add
269 14ad7326 pastith
         * @throws DuplicateNameException if the user already exists in group
270 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or group was not found, with
271 14ad7326 pastith
         *             the exception message mentioning the precise problem
272 14ad7326 pastith
         * @throws InsufficientPermissionsException
273 14ad7326 pastith
         */
274 14ad7326 pastith
        public void addUserToGroup(Long userId, Long groupId, Long userToAddId)
275 14ad7326 pastith
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException;
276 14ad7326 pastith
277 14ad7326 pastith
        /**
278 14ad7326 pastith
         * Creates a new group with the specified owner and name.
279 14ad7326 pastith
         *
280 14ad7326 pastith
         * @param userId the ID of the current user
281 14ad7326 pastith
         * @param name the name of the new group
282 14ad7326 pastith
         * @throws DuplicateNameException if the new group name already exists
283 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or group was not found, with
284 14ad7326 pastith
         *             the exception message mentioning the precise problem
285 14ad7326 pastith
         */
286 14ad7326 pastith
        public void createGroup(Long userId, String name) throws ObjectNotFoundException, DuplicateNameException;
287 14ad7326 pastith
288 14ad7326 pastith
        /**
289 14ad7326 pastith
         * Deletes the specified group in the specified user's namespace.
290 14ad7326 pastith
         *
291 14ad7326 pastith
         * @param userId the ID of the current user
292 14ad7326 pastith
         * @param groupId the ID of the group to delete
293 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or group was not found, with
294 14ad7326 pastith
         *             the exception message mentioning the precise problem
295 14ad7326 pastith
         * @throws InsufficientPermissionsException
296 14ad7326 pastith
         */
297 14ad7326 pastith
        public void deleteGroup(Long userId, Long groupId) throws ObjectNotFoundException, InsufficientPermissionsException;
298 14ad7326 pastith
299 14ad7326 pastith
        /**
300 14ad7326 pastith
         * Creates a new file with the specified owner, parent folder and name. The
301 14ad7326 pastith
         * new file has the same permissions as its parent folder. The file contents
302 14ad7326 pastith
         * are read from the input stream to a new File object.
303 14ad7326 pastith
         *
304 14ad7326 pastith
         * @param userId the ID of the current user
305 14ad7326 pastith
         * @param folderId the ID of the parent folder
306 14ad7326 pastith
         * @param name the name of the new file
307 14ad7326 pastith
         * @param mimeType the MIME type of the file
308 14ad7326 pastith
         * @param stream the input stream with the file contents
309 8f128261 droutsis
         * @return The FileHeaderDTO created
310 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
311 14ad7326 pastith
         *             the parent folder, as either a folder or file
312 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or parent folder was not
313 14ad7326 pastith
         *             found, with the exception message mentioning the precise
314 14ad7326 pastith
         *             problem
315 14ad7326 pastith
         * @throws GSSIOException if there was an error while storing the file contents
316 14ad7326 pastith
         * @throws InsufficientPermissionsException
317 14ad7326 pastith
         * @throws QuotaExceededException
318 14ad7326 pastith
         */
319 8f128261 droutsis
        public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType,
320 14ad7326 pastith
                                InputStream stream) throws DuplicateNameException, ObjectNotFoundException,
321 14ad7326 pastith
                                GSSIOException, InsufficientPermissionsException, QuotaExceededException;
322 14ad7326 pastith
323 14ad7326 pastith
        /**
324 14ad7326 pastith
         * Deletes the specified file, provided the specified user has
325 14ad7326 pastith
         * the necessary permissions.
326 14ad7326 pastith
         *
327 14ad7326 pastith
         * @param userId the ID of the current user
328 14ad7326 pastith
         * @param fileId the ID of the file to delete
329 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
330 14ad7326 pastith
         *             the exception message mentioning the precise problem
331 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
332 14ad7326 pastith
         *             appropriate privileges
333 14ad7326 pastith
         */
334 14ad7326 pastith
        public void deleteFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
335 14ad7326 pastith
336 14ad7326 pastith
        /**
337 14ad7326 pastith
         * Deletes the specified file in the specified user's namespace.
338 14ad7326 pastith
         *
339 14ad7326 pastith
         * @param userId the ID of the current user
340 14ad7326 pastith
         * @param fileIds the IDs of the files to delete
341 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
342 14ad7326 pastith
         *             the exception message mentioning the precise problem
343 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
344 14ad7326 pastith
         *             appropriate privileges
345 14ad7326 pastith
         */
346 14ad7326 pastith
        public void deleteFiles(Long userId, List<Long> fileIds)
347 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
348 14ad7326 pastith
349 14ad7326 pastith
        /**
350 14ad7326 pastith
         * Creates a new tag for the specified user and file.
351 14ad7326 pastith
         *
352 14ad7326 pastith
         * @param userId the creator of the tag
353 14ad7326 pastith
         * @param fileHeaderId the file that is tagged
354 14ad7326 pastith
         * @param tag the tag
355 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or the file was not found
356 14ad7326 pastith
         */
357 14ad7326 pastith
        public void createTag(Long userId, Long fileHeaderId, String tag) throws ObjectNotFoundException;
358 14ad7326 pastith
359 14ad7326 pastith
        /**
360 14ad7326 pastith
         * Returns all tags defined by the specified user
361 14ad7326 pastith
         *
362 14ad7326 pastith
         * @param userId
363 14ad7326 pastith
         * @return Set<String>
364 14ad7326 pastith
         * @throws ObjectNotFoundException if the user was null
365 14ad7326 pastith
         */
366 14ad7326 pastith
        public Set<String> getUserTags(final Long userId) throws ObjectNotFoundException;
367 14ad7326 pastith
368 14ad7326 pastith
        /**
369 14ad7326 pastith
         * Updates name and tags for the specified file
370 14ad7326 pastith
         *
371 14ad7326 pastith
         * @param userId
372 14ad7326 pastith
         * @param fileId
373 14ad7326 pastith
         * @param name
374 14ad7326 pastith
         * @param tagSet a String that contains tags separated by comma
375 14ad7326 pastith
         * @throws ObjectNotFoundException
376 14ad7326 pastith
         * @throws InsufficientPermissionsException
377 14ad7326 pastith
         */
378 14ad7326 pastith
        public void updateFile(Long userId, Long fileId, String name, String tagSet)
379 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
380 14ad7326 pastith
381 14ad7326 pastith
        /**
382 14ad7326 pastith
         * Retrieve the contents of the current body for the file
383 14ad7326 pastith
         * with the specified FileHeader ID. The file contents
384 14ad7326 pastith
         * are provided as an InputStream from which the caller can
385 14ad7326 pastith
         * retrieve the raw bytes.
386 14ad7326 pastith
         *
387 14ad7326 pastith
         * @param userId the ID of the current user
388 14ad7326 pastith
         * @param fileId the ID of the file to retrieve
389 14ad7326 pastith
         * @return an InputStream from the current file body contents
390 14ad7326 pastith
         * @throws ObjectNotFoundException if the file or the user was not found
391 14ad7326 pastith
         * @throws InsufficientPermissionsException  if the user does not have the
392 14ad7326 pastith
         *             appropriate privileges
393 14ad7326 pastith
         */
394 14ad7326 pastith
        public InputStream getFileContents(Long userId, Long fileId)
395 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
396 14ad7326 pastith
397 14ad7326 pastith
        /**
398 14ad7326 pastith
         * Retrieve the contents of the  body identified by bodyId for the file
399 14ad7326 pastith
         * with the specified FileHeader ID. The file contents
400 14ad7326 pastith
         * are provided as an InputStream from which the caller can
401 14ad7326 pastith
         * retrieve the raw bytes.
402 14ad7326 pastith
         *
403 14ad7326 pastith
         * @param userId the ID of the current user
404 14ad7326 pastith
         * @param fileId the ID of the file to retrieve
405 14ad7326 pastith
         * @param bodyId the body ID
406 14ad7326 pastith
         * @return an InputStream from the current file body contents
407 14ad7326 pastith
         * @throws ObjectNotFoundException if the file or the user was not found
408 14ad7326 pastith
         * @throws InsufficientPermissionsException  if the user does not have the
409 14ad7326 pastith
         *             appropriate privileges
410 14ad7326 pastith
         */
411 14ad7326 pastith
        public InputStream getFileContents(Long userId, Long fileId, Long bodyId)
412 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
413 14ad7326 pastith
414 14ad7326 pastith
        /**
415 14ad7326 pastith
         * Retrieve the file with the specified ID.
416 14ad7326 pastith
         *
417 14ad7326 pastith
         * @param userId the ID of the current user
418 14ad7326 pastith
         * @param fileId the ID of the file to retrieve
419 14ad7326 pastith
         * @return the file found
420 14ad7326 pastith
         * @throws ObjectNotFoundException if the file or the user was not found, with
421 14ad7326 pastith
         *                         the exception message mentioning the precise problem
422 14ad7326 pastith
         * @throws InsufficientPermissionsException
423 14ad7326 pastith
         */
424 14ad7326 pastith
        public FileHeaderDTO getFile(Long userId, Long fileId) throws ObjectNotFoundException,
425 14ad7326 pastith
                        InsufficientPermissionsException;
426 14ad7326 pastith
427 14ad7326 pastith
        /**
428 14ad7326 pastith
         * Retrieve the filebody with the specified ID.
429 14ad7326 pastith
         *
430 14ad7326 pastith
         * @param userId the ID of the current user
431 14ad7326 pastith
         * @param fileId the ID of the file to retrieve
432 14ad7326 pastith
         * @param bodyId the ID of the body
433 14ad7326 pastith
         * @return the file found
434 14ad7326 pastith
         * @throws ObjectNotFoundException if the file or the user was not found, with
435 14ad7326 pastith
         *                         the exception message mentioning the precise problem
436 14ad7326 pastith
         * @throws InsufficientPermissionsException
437 14ad7326 pastith
         */
438 14ad7326 pastith
        public FileBodyDTO getFileBody(Long userId, Long fileId, Long bodyId)
439 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
440 14ad7326 pastith
441 14ad7326 pastith
        /**
442 14ad7326 pastith
         * Get the resource (file or folder) at the specified path in
443 14ad7326 pastith
         * the specified user's namespace. The returned object will be of type
444 14ad7326 pastith
         * FileHeaderDTO or FolderDTO.<p><strong>Note:</strong> this method does not
445 14ad7326 pastith
         * receive the current user as a parameter, therefore it is unable to perform
446 14ad7326 pastith
         * the necessary permission checks and should <strong>NOT</strong> be directly
447 14ad7326 pastith
         * exposed to remote clients. It is the caller's responsibility to verify that
448 14ad7326 pastith
         * the calling user has the required privileges for performing any subsequent
449 14ad7326 pastith
         * action on the resource through one of the other ExternalAPI methods.
450 14ad7326 pastith
         *
451 14ad7326 pastith
         * @param ownerId the ID of the user owning the namespace
452 14ad7326 pastith
         * @param path the absolute path in the user's namespace
453 68410d59 pastith
         * @param ignoreDeleted if true, resources that have been moved to the trash
454 68410d59 pastith
         *                         will be ignored
455 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or resource was not found, with
456 14ad7326 pastith
         *                         the exception message mentioning the precise problem
457 14ad7326 pastith
         * @return the resource found
458 14ad7326 pastith
         */
459 68410d59 pastith
        public Object getResourceAtPath(Long ownerId, String path, boolean ignoreDeleted)
460 68410d59 pastith
                        throws ObjectNotFoundException;
461 14ad7326 pastith
462 14ad7326 pastith
        /**
463 14ad7326 pastith
         * Copy the provided file to the specified destination.
464 14ad7326 pastith
         *
465 14ad7326 pastith
         * @param userId the ID of the current user
466 14ad7326 pastith
         * @param fileId the IF of the provided file
467 14ad7326 pastith
         * @param dest the path of the new resource
468 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
469 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
470 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
471 14ad7326 pastith
         *          the destination folder, as either a folder or file
472 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
473 14ad7326 pastith
         * @throws InsufficientPermissionsException
474 14ad7326 pastith
         * @throws QuotaExceededException
475 14ad7326 pastith
         */
476 14ad7326 pastith
        public void copyFile(Long userId, Long fileId, String dest) throws ObjectNotFoundException,
477 14ad7326 pastith
                        DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
478 14ad7326 pastith
479 14ad7326 pastith
        /**
480 14ad7326 pastith
         * Copy the provided file to the specified destination.
481 14ad7326 pastith
         *
482 14ad7326 pastith
         * @param userId the ID of the current user
483 14ad7326 pastith
         * @param ownerId the ID of the owner of the destination namespace
484 14ad7326 pastith
         * @param fileId the IF of the provided file
485 14ad7326 pastith
         * @param dest the path of the new resource
486 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
487 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
488 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
489 14ad7326 pastith
         *          the destination folder, as either a folder or file
490 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
491 14ad7326 pastith
         * @throws InsufficientPermissionsException
492 14ad7326 pastith
         * @throws QuotaExceededException
493 14ad7326 pastith
         */
494 14ad7326 pastith
        public void copyFileToPath(Long userId, Long ownerId, Long fileId, String dest) throws ObjectNotFoundException,
495 14ad7326 pastith
                        DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
496 14ad7326 pastith
497 14ad7326 pastith
        /**
498 14ad7326 pastith
         * Copy the provided file to the specified destination.
499 14ad7326 pastith
         *
500 14ad7326 pastith
         * @param userId the ID of the current user
501 14ad7326 pastith
         * @param fileIds the IDs of the provided files
502 14ad7326 pastith
         * @param destId the ID of the destination folder
503 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
504 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
505 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
506 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
507 14ad7326 pastith
         *          the destination folder, as either a folder or file
508 14ad7326 pastith
         * @throws InsufficientPermissionsException
509 14ad7326 pastith
         * @throws QuotaExceededException
510 14ad7326 pastith
         */
511 14ad7326 pastith
        public void copyFiles(Long userId, List<Long> fileIds, Long destId)
512 14ad7326 pastith
                        throws ObjectNotFoundException, DuplicateNameException, GSSIOException,
513 14ad7326 pastith
                        InsufficientPermissionsException, QuotaExceededException;
514 14ad7326 pastith
515 14ad7326 pastith
        /**
516 14ad7326 pastith
         * Copy the provided file to the specified destination.
517 14ad7326 pastith
         *
518 14ad7326 pastith
         * @param userId the ID of the current user
519 14ad7326 pastith
         * @param fileId the IF of the provided file
520 14ad7326 pastith
         * @param destId the ID of the destination folder
521 14ad7326 pastith
         * @param destName the name of the new file
522 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
523 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
524 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
525 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
526 14ad7326 pastith
         *          the destination folder, as either a folder or file
527 14ad7326 pastith
         * @throws InsufficientPermissionsException
528 14ad7326 pastith
         * @throws QuotaExceededException
529 14ad7326 pastith
         */
530 14ad7326 pastith
        public void copyFile(Long userId, Long fileId, Long destId, String destName)
531 14ad7326 pastith
                        throws ObjectNotFoundException, DuplicateNameException, GSSIOException,
532 14ad7326 pastith
                        InsufficientPermissionsException, QuotaExceededException;
533 14ad7326 pastith
534 14ad7326 pastith
        /**
535 14ad7326 pastith
         * Copy the provided folder to the specified destination.
536 14ad7326 pastith
         *
537 14ad7326 pastith
         * @param userId the ID of the current user
538 14ad7326 pastith
         * @param folderId the IF of the provided folder
539 14ad7326 pastith
         * @param dest the path of the new folder
540 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
541 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
542 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
543 14ad7326 pastith
         *          the destination folder, as either a folder or file
544 14ad7326 pastith
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
545 14ad7326 pastith
         *          appropriate privileges
546 14ad7326 pastith
         */
547 14ad7326 pastith
        public void copyFolder(Long userId, Long folderId, String dest) throws ObjectNotFoundException,
548 14ad7326 pastith
                        DuplicateNameException, InsufficientPermissionsException;
549 14ad7326 pastith
550 14ad7326 pastith
        /**
551 14ad7326 pastith
         * Copy the provided folder to the specified destination.
552 14ad7326 pastith
         *
553 14ad7326 pastith
         * @param userId the ID of the current user
554 14ad7326 pastith
         * @param folderId the IF of the provided folder
555 14ad7326 pastith
         * @param destId the ID of the destination folder
556 14ad7326 pastith
         * @param destName the name of the new folder
557 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
558 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
559 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
560 14ad7326 pastith
         *          the destination folder, as either a folder or file
561 14ad7326 pastith
         * @throws InsufficientPermissionsException InsufficientPermissionsException
562 14ad7326 pastith
         *                         if the user does not have the appropriate privileges
563 14ad7326 pastith
         */
564 14ad7326 pastith
        public void copyFolder(Long userId, Long folderId, Long destId, String destName)
565 14ad7326 pastith
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException;
566 14ad7326 pastith
567 14ad7326 pastith
        /**
568 14ad7326 pastith
         * Copy the provided folder and all its subfolders and files to the specified destination.
569 14ad7326 pastith
         *
570 14ad7326 pastith
         * @param userId the ID of the current user
571 14ad7326 pastith
         * @param ownerId the ID of the owner of the destination namespace
572 14ad7326 pastith
         * @param folderId the IF of the provided folder
573 14ad7326 pastith
         * @param dest the path of the new folder
574 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
575 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
576 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
577 14ad7326 pastith
         *          the destination folder, as either a folder or file
578 14ad7326 pastith
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
579 14ad7326 pastith
         *          appropriate privileges
580 14ad7326 pastith
         * @throws QuotaExceededException if the user quota limit would be exceeded
581 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
582 14ad7326 pastith
         */
583 14ad7326 pastith
        public void copyFolderStructureToPath(Long userId, Long ownerId, Long folderId, String dest) throws ObjectNotFoundException,
584 14ad7326 pastith
                        DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
585 14ad7326 pastith
586 14ad7326 pastith
        /**
587 14ad7326 pastith
         * Copy the provided folder and all its subfolders and files to the specified destination.
588 14ad7326 pastith
         *
589 14ad7326 pastith
         * @param userId the ID of the current user
590 14ad7326 pastith
         * @param folderId the IF of the provided folder
591 14ad7326 pastith
         * @param destId the ID of the destination folder
592 14ad7326 pastith
         * @param destName the name of the new folder
593 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
594 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
595 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
596 14ad7326 pastith
         *          the destination folder, as either a folder or file
597 14ad7326 pastith
         * @throws InsufficientPermissionsException InsufficientPermissionsException
598 14ad7326 pastith
         *                         if the user does not have the appropriate privileges
599 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
600 14ad7326 pastith
         * @throws QuotaExceededException if the user quota limit would be exceeded
601 14ad7326 pastith
         */
602 14ad7326 pastith
        public void copyFolderStructure(Long userId, Long folderId, Long destId, String destName)
603 14ad7326 pastith
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,
604 14ad7326 pastith
                        GSSIOException, QuotaExceededException;
605 14ad7326 pastith
606 14ad7326 pastith
        /**
607 14ad7326 pastith
         * Marks  the specified file as deleted in the specified user's namespace.
608 14ad7326 pastith
         *
609 14ad7326 pastith
         * @param userId the ID of the current user
610 14ad7326 pastith
         * @param fileId the ID of the file to delete
611 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
612 14ad7326 pastith
         *             the exception message mentioning the precise problem
613 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
614 14ad7326 pastith
         *             appropriate privileges
615 14ad7326 pastith
         */
616 14ad7326 pastith
        public void moveFileToTrash(Long userId, Long fileId) throws ObjectNotFoundException,
617 14ad7326 pastith
                        InsufficientPermissionsException;
618 14ad7326 pastith
619 14ad7326 pastith
        /**
620 14ad7326 pastith
         * Marks  the specified deleted file as undeleted in the specified user's namespace.
621 14ad7326 pastith
         *
622 14ad7326 pastith
         * @param userId the ID of the current user
623 14ad7326 pastith
         * @param fileId the ID of the file to undelete
624 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
625 14ad7326 pastith
         *             the exception message mentioning the precise problem
626 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
627 14ad7326 pastith
         *             appropriate privileges
628 14ad7326 pastith
         *
629 14ad7326 pastith
         */
630 14ad7326 pastith
        public void removeFileFromTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
631 14ad7326 pastith
632 14ad7326 pastith
        /**
633 14ad7326 pastith
         * Marks  the specified files as deleted in the specified user's namespace.
634 14ad7326 pastith
         *
635 14ad7326 pastith
         * @param userId the ID of the current user
636 14ad7326 pastith
         * @param fileIds the IDs of the file to delete
637 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
638 14ad7326 pastith
         *             the exception message mentioning the precise problem
639 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
640 14ad7326 pastith
         *             appropriate privileges
641 14ad7326 pastith
         */
642 14ad7326 pastith
        public void moveFilesToTrash(Long userId, List<Long> fileIds)
643 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
644 14ad7326 pastith
645 14ad7326 pastith
        /**
646 14ad7326 pastith
         * Marks  the specified deleted files as undeleted in the specified user's namespace.
647 14ad7326 pastith
         *
648 14ad7326 pastith
         * @param userId the ID of the current user
649 14ad7326 pastith
         * @param fileIds the IDs of the file to undelete
650 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
651 14ad7326 pastith
         *             the exception message mentioning the precise problem
652 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
653 14ad7326 pastith
         *             appropriate privileges
654 14ad7326 pastith
         */
655 14ad7326 pastith
        public void removeFilesFromTrash(Long userId, List<Long> fileIds) throws ObjectNotFoundException, InsufficientPermissionsException;
656 14ad7326 pastith
657 14ad7326 pastith
        /**
658 14ad7326 pastith
         * Marks  the specified folder as deleted in the specified user's namespace.
659 14ad7326 pastith
         *
660 14ad7326 pastith
         * @param userId the ID of the current user
661 14ad7326 pastith
         * @param folderId the ID of the folder to delete
662 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
663 14ad7326 pastith
         *             the exception message mentioning the precise problem
664 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
665 14ad7326 pastith
         *             appropriate privileges
666 14ad7326 pastith
         */
667 14ad7326 pastith
        public void moveFolderToTrash(Long userId, Long folderId)
668 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
669 14ad7326 pastith
670 14ad7326 pastith
        /**
671 14ad7326 pastith
         * Marks  the specified deleted folder as undeleted in the specified user's namespace.
672 14ad7326 pastith
         *
673 14ad7326 pastith
         * @param userId the ID of the current user
674 14ad7326 pastith
         * @param folderId the ID of the folder to undelete
675 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
676 14ad7326 pastith
         *             the exception message mentioning the precise problem
677 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
678 14ad7326 pastith
         *          appropriate privileges
679 14ad7326 pastith
         *
680 14ad7326 pastith
         */
681 14ad7326 pastith
        public void removeFolderFromTrash(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
682 14ad7326 pastith
683 14ad7326 pastith
        /**
684 14ad7326 pastith
         * Move the provided folder and all its subfolders and files to the specified destination.
685 14ad7326 pastith
         *
686 14ad7326 pastith
         * @param userId the ID of the current user
687 14ad7326 pastith
         * @param folderId the IF of the provided folder
688 14ad7326 pastith
         * @param destId the ID of the destination folder
689 14ad7326 pastith
         * @param destName the name of the new folder
690 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
691 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
692 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
693 14ad7326 pastith
         *          the destination folder, as either a folder or file
694 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
695 14ad7326 pastith
         *          appropriate privileges
696 14ad7326 pastith
         * @throws GSSIOException
697 14ad7326 pastith
         * @throws QuotaExceededException
698 14ad7326 pastith
         */
699 14ad7326 pastith
        public void moveFolder(Long userId, Long folderId, Long destId, String destName)
700 14ad7326 pastith
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,
701 14ad7326 pastith
                        GSSIOException, QuotaExceededException;
702 14ad7326 pastith
703 14ad7326 pastith
        /**
704 14ad7326 pastith
         * Move the provided folder and all its subfolders and files to the specified destination.
705 14ad7326 pastith
         *
706 14ad7326 pastith
         * @param userId the ID of the current user
707 14ad7326 pastith
         * @param ownerId the owner of the destination namespace
708 14ad7326 pastith
         * @param folderId the IF of the provided folder
709 14ad7326 pastith
         * @param dest the path of the new folder
710 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
711 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
712 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
713 14ad7326 pastith
         *          the destination folder, as either a folder or file
714 14ad7326 pastith
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
715 14ad7326 pastith
         *          appropriate privileges
716 14ad7326 pastith
         * @throws GSSIOException
717 14ad7326 pastith
         * @throws QuotaExceededException
718 14ad7326 pastith
         */
719 14ad7326 pastith
        public void moveFolderToPath(Long userId, Long ownerId, Long folderId, String dest) throws ObjectNotFoundException,
720 14ad7326 pastith
                        DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
721 14ad7326 pastith
722 14ad7326 pastith
        /**
723 14ad7326 pastith
         * Move the provided file to the specified destination.
724 14ad7326 pastith
         *
725 14ad7326 pastith
         * @param userId the ID of the current user
726 14ad7326 pastith
         * @param fileId the IF of the provided file
727 14ad7326 pastith
         * @param destId the ID of the destination folder
728 14ad7326 pastith
         * @param destName the name of the new file
729 14ad7326 pastith
         * @throws InsufficientPermissionsException
730 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
731 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
732 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
733 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
734 14ad7326 pastith
         *          the destination folder, as either a folder or file
735 14ad7326 pastith
         * @throws QuotaExceededException
736 14ad7326 pastith
         */
737 14ad7326 pastith
        public void moveFile(Long userId, Long fileId, Long destId, String destName)
738 14ad7326 pastith
                        throws InsufficientPermissionsException, ObjectNotFoundException,
739 14ad7326 pastith
                        DuplicateNameException, GSSIOException, QuotaExceededException;
740 14ad7326 pastith
741 14ad7326 pastith
        /**
742 14ad7326 pastith
         * Move the provided file to the specified destination.
743 14ad7326 pastith
         *
744 14ad7326 pastith
         * @param userId the ID of the current user
745 14ad7326 pastith
         * @param ownerId the owner of the destination namespace
746 14ad7326 pastith
         * @param fileId the IF of the provided file
747 14ad7326 pastith
         * @param dest the path of the new file
748 14ad7326 pastith
         * @throws InsufficientPermissionsException
749 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
750 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
751 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
752 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
753 14ad7326 pastith
         *          the destination folder, as either a folder or file
754 14ad7326 pastith
         * @throws QuotaExceededException
755 14ad7326 pastith
         */
756 14ad7326 pastith
        public void moveFileToPath(Long userId, Long ownerId, Long fileId, String dest) throws ObjectNotFoundException, InsufficientPermissionsException, DuplicateNameException, GSSIOException, QuotaExceededException;
757 14ad7326 pastith
758 14ad7326 pastith
        /**
759 14ad7326 pastith
         * move the provided file to the specified destination.
760 14ad7326 pastith
         *
761 14ad7326 pastith
         * @param userId the ID of the current user
762 14ad7326 pastith
         * @param fileIds the IDs of the provided files
763 14ad7326 pastith
         * @param destId the ID of the destination folder
764 14ad7326 pastith
         * @throws InsufficientPermissionsException
765 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
766 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
767 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
768 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
769 14ad7326 pastith
         *          the destination folder, as either a folder or file
770 14ad7326 pastith
         * @throws QuotaExceededException
771 14ad7326 pastith
         */
772 14ad7326 pastith
        public void moveFiles(Long userId, List<Long> fileIds, Long destId)
773 14ad7326 pastith
                        throws InsufficientPermissionsException, ObjectNotFoundException,
774 14ad7326 pastith
                        DuplicateNameException, GSSIOException, QuotaExceededException;
775 14ad7326 pastith
776 14ad7326 pastith
        /**
777 14ad7326 pastith
         * Returns a list of All deleted files of a user.
778 14ad7326 pastith
         *
779 14ad7326 pastith
         * @param userId the ID of the User
780 14ad7326 pastith
         *          * @return the list of deleted file header objects
781 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
782 14ad7326 pastith
         */
783 14ad7326 pastith
        public List<FileHeaderDTO> getDeletedFiles(Long userId) throws ObjectNotFoundException;
784 14ad7326 pastith
785 14ad7326 pastith
        /**
786 14ad7326 pastith
         * Returns a list of All deleted root folders of a user.
787 14ad7326 pastith
         *
788 14ad7326 pastith
         * @param userId the ID of the User
789 14ad7326 pastith
         *          * @return the list of deleted file header objects
790 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
791 14ad7326 pastith
         */
792 14ad7326 pastith
        public List<FolderDTO> getDeletedRootFolders(Long userId) throws ObjectNotFoundException;
793 14ad7326 pastith
794 14ad7326 pastith
        /**
795 14ad7326 pastith
         * Empty Trash by deleting all marked as deleted files and folders
796 14ad7326 pastith
         * @param userId
797 14ad7326 pastith
         * @throws ObjectNotFoundException if something goes wrong in the delete process
798 14ad7326 pastith
         * @throws InsufficientPermissionsException if something goes wrong in the delete process
799 14ad7326 pastith
         */
800 14ad7326 pastith
        public void emptyTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
801 14ad7326 pastith
802 14ad7326 pastith
        /**
803 14ad7326 pastith
         * Restores All Trashed Items by undeleting all marked as deleted files and folders
804 14ad7326 pastith
         * @param userId
805 14ad7326 pastith
         * @throws ObjectNotFoundException if something goes wrong in the delete process
806 14ad7326 pastith
         * @throws InsufficientPermissionsException
807 14ad7326 pastith
         */
808 14ad7326 pastith
        public void restoreTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
809 14ad7326 pastith
810 14ad7326 pastith
        /**
811 14ad7326 pastith
         * Search the system for a user with the specified username.
812 14ad7326 pastith
         * If no such user is found, the method returns null.
813 14ad7326 pastith
         *
814 14ad7326 pastith
         * @param username the username to search for
815 14ad7326 pastith
         * @return the User object with the specified username
816 14ad7326 pastith
         */
817 14ad7326 pastith
        public User findUser(String username);
818 14ad7326 pastith
819 14ad7326 pastith
        /**
820 14ad7326 pastith
         * Create a new user with the specified name, username and e-mail address.
821 14ad7326 pastith
         *
822 14ad7326 pastith
         * @param username the username of the new user
823 14ad7326 pastith
         * @param name the full name of the new user
824 14ad7326 pastith
         * @param mail the e-mail of the new user
825 14ad7326 pastith
         * @return the newly-created User object
826 14ad7326 pastith
         * @throws DuplicateNameException if a user with the same username already exists
827 14ad7326 pastith
         * @throws ObjectNotFoundException if no username was provided
828 14ad7326 pastith
         */
829 14ad7326 pastith
        public User createUser(String username, String name, String mail)
830 14ad7326 pastith
                        throws DuplicateNameException, ObjectNotFoundException;
831 14ad7326 pastith
832 14ad7326 pastith
        /**
833 98e2f2ae Panagiotis Astithas
         * Update the user with the specified username with the provided name
834 14ad7326 pastith
         * and e-mail address.
835 14ad7326 pastith
         *
836 14ad7326 pastith
         * @param username the username of the user
837 14ad7326 pastith
         * @param name the modified full name of the user
838 14ad7326 pastith
         * @param mail the modified e-mail of the user
839 14ad7326 pastith
         * @return the updated User object
840 14ad7326 pastith
         * @throws ObjectNotFoundException if no username was provided
841 14ad7326 pastith
         */
842 14ad7326 pastith
        public User updateUser(String username, String name, String mail) throws ObjectNotFoundException;
843 14ad7326 pastith
844 14ad7326 pastith
        /**
845 14ad7326 pastith
         * Updates the authentication token for the specified user.
846 14ad7326 pastith
         *
847 14ad7326 pastith
         * @param userId the ID of the user whose token should be updated
848 14ad7326 pastith
         * @return the updated user
849 14ad7326 pastith
         * @throws ObjectNotFoundException if the user could not be found
850 14ad7326 pastith
         */
851 14ad7326 pastith
        public User updateUserToken(Long userId) throws ObjectNotFoundException;
852 14ad7326 pastith
853 14ad7326 pastith
        /**
854 0a4b8f82 pastith
         * Updates the policy acceptance flag for the specified user.
855 0a4b8f82 pastith
         *
856 0a4b8f82 pastith
         * @param userId the ID of the user whose flag should be updated
857 0a4b8f82 pastith
         * @param isAccepted the new value of the flag
858 0a4b8f82 pastith
         * @return the updated user
859 0a4b8f82 pastith
         * @throws ObjectNotFoundException if the user could not be found
860 0a4b8f82 pastith
         */
861 0a4b8f82 pastith
        public User updateUserPolicyAcceptance(Long userId, boolean isAccepted) throws ObjectNotFoundException;
862 0a4b8f82 pastith
863 0a4b8f82 pastith
        /**
864 14ad7326 pastith
         * Invalidates the authentication token for the specified user.
865 14ad7326 pastith
         *
866 14ad7326 pastith
         * @param userId the ID of the user whose token should be updated
867 14ad7326 pastith
         * @throws ObjectNotFoundException if the user could not be found
868 14ad7326 pastith
         */
869 14ad7326 pastith
        public void invalidateUserToken(Long userId) throws ObjectNotFoundException;
870 14ad7326 pastith
871 14ad7326 pastith
        /**
872 14ad7326 pastith
         * Retrieve folder user and group permissions
873 14ad7326 pastith
         *
874 14ad7326 pastith
         * @param userId the ID of the user whose token should be updated
875 14ad7326 pastith
         * @param folderId the ID of the folder
876 14ad7326 pastith
         * @return the Set of permissions from requested folder
877 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or folder could not be found
878 14ad7326 pastith
         * @throws InsufficientPermissionsException
879 14ad7326 pastith
         */
880 14ad7326 pastith
        public Set<PermissionDTO> getFolderPermissions(Long userId, Long folderId)
881 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
882 14ad7326 pastith
883 14ad7326 pastith
        /**
884 14ad7326 pastith
         * update folder permissions
885 14ad7326 pastith
         * @param userId
886 14ad7326 pastith
         * @param folderId
887 14ad7326 pastith
         * @param permissions
888 14ad7326 pastith
         * @throws ObjectNotFoundException
889 14ad7326 pastith
         * @throws InsufficientPermissionsException
890 14ad7326 pastith
         */
891 14ad7326 pastith
        public void setFolderPermissions(Long userId, Long folderId, Set<PermissionDTO> permissions)
892 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
893 14ad7326 pastith
894 14ad7326 pastith
        /**
895 14ad7326 pastith
         * Retrieve file user and group permissions
896 14ad7326 pastith
         *
897 14ad7326 pastith
         * @param userId the ID of the user whose token should be updated
898 14ad7326 pastith
         * @param fileId the ID of the folder
899 14ad7326 pastith
         * @return the Set of permissions from requested folder
900 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or folder could not be found
901 14ad7326 pastith
         * @throws InsufficientPermissionsException
902 14ad7326 pastith
         */
903 14ad7326 pastith
        public Set<PermissionDTO> getFilePermissions(Long userId, Long fileId)
904 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
905 14ad7326 pastith
906 14ad7326 pastith
907 14ad7326 pastith
        /**
908 14ad7326 pastith
         * update file permissions
909 14ad7326 pastith
         * @param userId
910 14ad7326 pastith
         * @param fileId
911 14ad7326 pastith
         * @param readForAll
912 14ad7326 pastith
         * @param permissions
913 14ad7326 pastith
         * @throws ObjectNotFoundException
914 14ad7326 pastith
         * @throws InsufficientPermissionsException
915 14ad7326 pastith
         */
916 14ad7326 pastith
        public void setFilePermissions(Long userId, Long fileId, Boolean readForAll,
917 14ad7326 pastith
                                Set<PermissionDTO> permissions)
918 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
919 14ad7326 pastith
920 14ad7326 pastith
        /**
921 14ad7326 pastith
         * Returns a list of all shared root folders of a user.
922 14ad7326 pastith
         *
923 14ad7326 pastith
         * @param userId the ID of the User
924 14ad7326 pastith
         * @return the list of shared root folders
925 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
926 14ad7326 pastith
         */
927 14ad7326 pastith
        public List<FolderDTO> getSharedRootFolders(Long userId) throws ObjectNotFoundException;
928 14ad7326 pastith
929 14ad7326 pastith
        /**
930 14ad7326 pastith
         * Returns a list of all shared files of a user that are not
931 14ad7326 pastith
         * inside other shared folders.
932 14ad7326 pastith
         *
933 14ad7326 pastith
         * @param userId the ID of the User
934 14ad7326 pastith
         * @return the list of shared files
935 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
936 14ad7326 pastith
         */
937 14ad7326 pastith
        public List<FileHeaderDTO> getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException;
938 14ad7326 pastith
939 14ad7326 pastith
        /**
940 14ad7326 pastith
         * Returns a list of all shared files of a user.
941 14ad7326 pastith
         *
942 14ad7326 pastith
         * @param userId the ID of the User
943 14ad7326 pastith
         * @return the list of shared files
944 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
945 14ad7326 pastith
         */
946 14ad7326 pastith
        public List<FileHeaderDTO> getSharedFiles(Long userId) throws ObjectNotFoundException;
947 14ad7326 pastith
948 14ad7326 pastith
        /**
949 14ad7326 pastith
         * Returns a list of all shared folders of a user.
950 14ad7326 pastith
         *
951 14ad7326 pastith
         * @param userId the ID of the User
952 14ad7326 pastith
         * @return the list of shared folders
953 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
954 14ad7326 pastith
         */
955 14ad7326 pastith
        public List<FolderDTO> getSharedFolders(Long userId) throws ObjectNotFoundException;
956 14ad7326 pastith
957 14ad7326 pastith
        /**
958 14ad7326 pastith
         * Returns a list of all shared root folders of a user that calling
959 14ad7326 pastith
         * user has at least read permissions.
960 14ad7326 pastith
         *
961 14ad7326 pastith
         * @param ownerId the ID of the User
962 14ad7326 pastith
         * @return the list of shared root folders
963 14ad7326 pastith
         * @param callingUserId
964 14ad7326 pastith
         *
965 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
966 14ad7326 pastith
         */
967 14ad7326 pastith
        public List<FolderDTO> getSharedRootFolders(Long ownerId, Long callingUserId)
968 14ad7326 pastith
                        throws ObjectNotFoundException;
969 14ad7326 pastith
970 14ad7326 pastith
        /**
971 14ad7326 pastith
         * Returns a list of all shared  files of a user that calling user has
972 14ad7326 pastith
         * at least read permissions..
973 14ad7326 pastith
         *
974 14ad7326 pastith
         * @param ownerId the ID of the User
975 14ad7326 pastith
         * @return the list of shared files
976 14ad7326 pastith
         * @param callingUserId
977 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
978 14ad7326 pastith
         */
979 14ad7326 pastith
        public List<FileHeaderDTO> getSharedFiles(Long ownerId, Long callingUserId)
980 14ad7326 pastith
                        throws ObjectNotFoundException;
981 14ad7326 pastith
982 14ad7326 pastith
        /**
983 14ad7326 pastith
         * Remove a user member from a group
984 14ad7326 pastith
         *
985 14ad7326 pastith
         * @param userId the ID of the User owning the group
986 14ad7326 pastith
         * @param groupId the ID of the requested group
987 14ad7326 pastith
         * @param memberId the ID of the member to be removed
988 14ad7326 pastith
         *
989 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or group was not found, with
990 14ad7326 pastith
         *             the exception message mentioning the precise problem
991 14ad7326 pastith
         * @throws InsufficientPermissionsException
992 14ad7326 pastith
         */
993 14ad7326 pastith
        public void removeMemberFromGroup(Long userId, Long groupId, Long memberId)
994 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
995 14ad7326 pastith
996 14ad7326 pastith
        /**
997 14ad7326 pastith
         * Retrieves the list of users sharing files to user identified by user id
998 14ad7326 pastith
         * @param userId
999 14ad7326 pastith
         * @return the List of users sharing files to user
1000 14ad7326 pastith
         * @throws ObjectNotFoundException
1001 14ad7326 pastith
         */
1002 14ad7326 pastith
        public List<UserDTO> getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException;
1003 14ad7326 pastith
1004 14ad7326 pastith
        /**
1005 14ad7326 pastith
         * Search Files
1006 14ad7326 pastith
         *
1007 14ad7326 pastith
         * @param userId
1008 14ad7326 pastith
         * @param query
1009 14ad7326 pastith
         * @return list of files that match query
1010 14ad7326 pastith
         * @throws ObjectNotFoundException if no user or query was specified
1011 14ad7326 pastith
         */
1012 14ad7326 pastith
        public List<FileHeaderDTO> searchFiles(Long userId, String query) throws ObjectNotFoundException;
1013 14ad7326 pastith
1014 14ad7326 pastith
        /**
1015 14ad7326 pastith
         * Creates a nonce for the specified user.
1016 14ad7326 pastith
         *
1017 14ad7326 pastith
         * @param userId the ID of the user
1018 14ad7326 pastith
         * @return the new nonce
1019 14ad7326 pastith
         * @throws ObjectNotFoundException if the user could not be found
1020 14ad7326 pastith
         */
1021 14ad7326 pastith
        public Nonce createNonce(Long userId) throws ObjectNotFoundException;
1022 14ad7326 pastith
1023 14ad7326 pastith
        /**
1024 14ad7326 pastith
         * Find the nonce object for the specified encoded nonce, that should be
1025 14ad7326 pastith
         * associated with the specified user.
1026 14ad7326 pastith
         *
1027 14ad7326 pastith
         * @param nonce the issued nonce in Base64 encoding
1028 14ad7326 pastith
         * @param userId the ID of the user for whom this nonce should have been issued
1029 14ad7326 pastith
         * @return the retrieved nonce object
1030 14ad7326 pastith
         * @throws ObjectNotFoundException if the nonce or user were not found
1031 14ad7326 pastith
         */
1032 14ad7326 pastith
        public Nonce getNonce(String nonce, Long userId) throws ObjectNotFoundException;
1033 14ad7326 pastith
1034 14ad7326 pastith
        /**
1035 14ad7326 pastith
         * Remove the specified nonce from the persistent store.
1036 14ad7326 pastith
         *
1037 14ad7326 pastith
         * @param id the ID of the nonce
1038 14ad7326 pastith
         * @throws ObjectNotFoundException if the specified nonce could not be found
1039 14ad7326 pastith
         */
1040 14ad7326 pastith
        public void removeNonce(Long id) throws ObjectNotFoundException;
1041 14ad7326 pastith
1042 14ad7326 pastith
        /**
1043 14ad7326 pastith
         * Activate the supplied nonce for the specified user.
1044 14ad7326 pastith
         *
1045 14ad7326 pastith
         * @param userId the ID of the user
1046 14ad7326 pastith
         * @param nonce the nonce to activate
1047 14ad7326 pastith
         * @param nonceExpiryDate the expiry date of the nonce
1048 14ad7326 pastith
         * @throws ObjectNotFoundException
1049 14ad7326 pastith
         */
1050 14ad7326 pastith
        public void activateUserNonce(Long userId, String nonce, Date nonceExpiryDate) throws ObjectNotFoundException;
1051 14ad7326 pastith
1052 14ad7326 pastith
        /**
1053 14ad7326 pastith
         * Retrieves user statistics.
1054 14ad7326 pastith
         *
1055 14ad7326 pastith
         * @param userId the ID of the user
1056 14ad7326 pastith
         * @return the statistics
1057 14ad7326 pastith
         * @throws ObjectNotFoundException
1058 14ad7326 pastith
         *
1059 14ad7326 pastith
         */
1060 14ad7326 pastith
        public StatsDTO getUserStatistics(Long userId) throws ObjectNotFoundException;
1061 14ad7326 pastith
1062 14ad7326 pastith
        /**
1063 14ad7326 pastith
         * Retrieves file versions
1064 14ad7326 pastith
         *
1065 14ad7326 pastith
         * @param userId the ID of the user
1066 14ad7326 pastith
         * @param fileId the ID of the file
1067 14ad7326 pastith
         * @return the list of filebodies
1068 14ad7326 pastith
         * @throws ObjectNotFoundException
1069 14ad7326 pastith
         * @throws InsufficientPermissionsException
1070 14ad7326 pastith
         *
1071 14ad7326 pastith
         */
1072 14ad7326 pastith
        public List<FileBodyDTO> getVersions(Long userId, Long fileId)
1073 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1074 14ad7326 pastith
1075 14ad7326 pastith
        /**
1076 39c34533 pastith
         * Restore the file contents to the specified version.
1077 14ad7326 pastith
         *
1078 14ad7326 pastith
         * @param userId the ID of the user
1079 14ad7326 pastith
         * @param fileId the ID of the file
1080 39c34533 pastith
         * @param version the version number of the desired file contents
1081 39c34533 pastith
         * @throws ObjectNotFoundException if the user or file was not
1082 39c34533 pastith
         *                         found, with        the exception message mentioning the precise problem
1083 39c34533 pastith
         * @throws InsufficientPermissionsException if the user does not have the
1084 39c34533 pastith
         *          appropriate privileges
1085 39c34533 pastith
         * @throws QuotaExceededException if the user quota limit would be exceeded
1086 39c34533 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
1087 14ad7326 pastith
         */
1088 39c34533 pastith
        public void restoreVersion(Long userId, Long fileId, int version)
1089 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException,  GSSIOException, QuotaExceededException;
1090 14ad7326 pastith
1091 14ad7326 pastith
        /**
1092 14ad7326 pastith
         * Remove file version identified by bodyId
1093 14ad7326 pastith
         *
1094 14ad7326 pastith
         * @param userId the ID of the user
1095 14ad7326 pastith
         * @param fileId the ID of the file
1096 14ad7326 pastith
         * @param bodyId the ID of the body
1097 14ad7326 pastith
         *
1098 14ad7326 pastith
         * @throws ObjectNotFoundException
1099 14ad7326 pastith
         * @throws InsufficientPermissionsException
1100 14ad7326 pastith
         *
1101 14ad7326 pastith
         */
1102 14ad7326 pastith
        public void removeVersion(Long userId, Long fileId, Long bodyId)
1103 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1104 14ad7326 pastith
1105 14ad7326 pastith
        /**
1106 14ad7326 pastith
         * Removes all old file versions for specified file keeping only the current revision
1107 14ad7326 pastith
         *
1108 14ad7326 pastith
         * @param userId the ID of the user
1109 14ad7326 pastith
         * @param fileId the ID of the file
1110 14ad7326 pastith
         *
1111 14ad7326 pastith
         * @throws ObjectNotFoundException
1112 14ad7326 pastith
         * @throws InsufficientPermissionsException
1113 14ad7326 pastith
         *
1114 14ad7326 pastith
         */
1115 14ad7326 pastith
        public void removeOldVersions(Long userId, Long fileId)
1116 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1117 14ad7326 pastith
1118 14ad7326 pastith
        /**
1119 14ad7326 pastith
         * Toggle between file being versioned or not.
1120 14ad7326 pastith
         *
1121 14ad7326 pastith
         * @param userId the ID of the user
1122 14ad7326 pastith
         * @param fileId the ID of the file
1123 14ad7326 pastith
         * @param versioned the new value of the flag
1124 14ad7326 pastith
         *
1125 14ad7326 pastith
         * @throws ObjectNotFoundException
1126 14ad7326 pastith
         * @throws InsufficientPermissionsException
1127 14ad7326 pastith
         *
1128 14ad7326 pastith
         */
1129 14ad7326 pastith
        public void toggleFileVersioning(Long userId, Long fileId, boolean versioned)
1130 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1131 14ad7326 pastith
1132 14ad7326 pastith
        /**
1133 14ad7326 pastith
         * It is used by the Solr mbean to rebuild the index.
1134 14ad7326 pastith
         */
1135 14ad7326 pastith
        public void rebuildSolrIndex();
1136 14ad7326 pastith
1137 14ad7326 pastith
        /**
1138 14ad7326 pastith
         * Creates a new file with the specified owner, parent folder and name. The
1139 14ad7326 pastith
         * new file has the same permissions as its parent folder. The file contents
1140 14ad7326 pastith
         * are already uploaded outside of externalAPI and the uploaded file is used as a parameter.
1141 14ad7326 pastith
         *
1142 14ad7326 pastith
         * @param userId the ID of the current user
1143 14ad7326 pastith
         * @param folderId the ID of the parent folder
1144 14ad7326 pastith
         * @param name the name of the new file
1145 14ad7326 pastith
         * @param mimeType the MIME type of the file
1146 4d737770 Fotis Stamatelopoulos
         * @param fileSize the uploaded file size
1147 4d737770 Fotis Stamatelopoulos
         * @param filePath the uploaded file full path
1148 8f128261 droutsis
         * @return The FileHeaderDTO created
1149 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
1150 14ad7326 pastith
         *             the parent folder, as either a folder or file
1151 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or parent folder was not
1152 14ad7326 pastith
         *             found, with the exception message mentioning the precise
1153 14ad7326 pastith
         *             problem
1154 14ad7326 pastith
         * @throws GSSIOException if there was an error while storing the file contents
1155 14ad7326 pastith
         * @throws InsufficientPermissionsException
1156 14ad7326 pastith
         * @throws QuotaExceededException
1157 14ad7326 pastith
         */
1158 4d737770 Fotis Stamatelopoulos
        public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType, long fileSize, String filePath)
1159 14ad7326 pastith
                        throws DuplicateNameException, ObjectNotFoundException, GSSIOException,
1160 14ad7326 pastith
                        InsufficientPermissionsException, QuotaExceededException;
1161 14ad7326 pastith
1162 14ad7326 pastith
        /**
1163 14ad7326 pastith
         * Create a new FileBody with the supplied uploaded file as contents and make it the current body
1164 14ad7326 pastith
         * of the file.
1165 14ad7326 pastith
         *
1166 14ad7326 pastith
         * @param userId the ID of the current user
1167 14ad7326 pastith
         * @param fileId the ID of the file header object
1168 14ad7326 pastith
         * @param mimeType the content type of the file
1169 4d737770 Fotis Stamatelopoulos
         * @param fileSize the uploaded file size
1170 4d737770 Fotis Stamatelopoulos
         * @param filePath the uploaded file full path
1171 8f128261 droutsis
         * @return The FileHeaderDTO updated
1172 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
1173 14ad7326 pastith
         *                         the exception message mentioning the precise problem
1174 14ad7326 pastith
         * @throws GSSIOException when an IO exception occurs
1175 14ad7326 pastith
         * @throws InsufficientPermissionsException
1176 14ad7326 pastith
         * @throws QuotaExceededException
1177 14ad7326 pastith
         */
1178 8f128261 droutsis
        public FileHeaderDTO updateFileContents(Long userId, Long fileId, String mimeType,
1179 4d737770 Fotis Stamatelopoulos
                                long fileSize, String filePath) throws ObjectNotFoundException, GSSIOException,
1180 14ad7326 pastith
                                InsufficientPermissionsException, QuotaExceededException;
1181 14ad7326 pastith
1182 14ad7326 pastith
        /**
1183 14ad7326 pastith
         * Create a file based on inputstream without using transaction.
1184 14ad7326 pastith
         *
1185 14ad7326 pastith
         * @param stream
1186 14ad7326 pastith
         * @param userId
1187 14ad7326 pastith
         * @return the file
1188 14ad7326 pastith
         * @throws IOException
1189 14ad7326 pastith
         * @throws ObjectNotFoundException
1190 14ad7326 pastith
         */
1191 14ad7326 pastith
        @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
1192 14ad7326 pastith
        public File uploadFile(InputStream stream, Long userId)
1193 14ad7326 pastith
                        throws IOException, ObjectNotFoundException;
1194 14ad7326 pastith
1195 14ad7326 pastith
        public void createFileUploadProgress(Long userId, String filename,
1196 14ad7326 pastith
                                Long bytesTransfered, Long fileSize) throws ObjectNotFoundException;
1197 14ad7326 pastith
1198 14ad7326 pastith
        public FileUploadStatus getFileUploadStatus(Long userId, String fileName);
1199 14ad7326 pastith
1200 14ad7326 pastith
        public void removeFileUploadProgress(Long userId, String filename)
1201 14ad7326 pastith
                        throws ObjectNotFoundException;
1202 14ad7326 pastith
1203 14ad7326 pastith
        /**
1204 14ad7326 pastith
         * Fetch the file body with the specified version number.
1205 14ad7326 pastith
         *
1206 14ad7326 pastith
         * @param userId the ID of the current user
1207 14ad7326 pastith
         * @param fileId the ID of the file header
1208 14ad7326 pastith
         * @param version the version number
1209 14ad7326 pastith
         * @return the file body
1210 14ad7326 pastith
         * @throws ObjectNotFoundException if the user file or version
1211 14ad7326 pastith
         *                         were not found
1212 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not
1213 14ad7326 pastith
         *                         have enough privileges for reading this file
1214 14ad7326 pastith
         */
1215 14ad7326 pastith
        public FileBodyDTO getFileVersion(Long userId, Long fileId, int version) throws ObjectNotFoundException, InsufficientPermissionsException;
1216 14ad7326 pastith
1217 3eaf782f pastith
        /**
1218 3eaf782f pastith
         * Search the system for a user with the specified email address.
1219 3eaf782f pastith
         * If no such user is found, the method returns null.
1220 3eaf782f pastith
         */
1221 3eaf782f pastith
        public User findUserByEmail(String email);
1222 3eaf782f pastith
1223 3eaf782f pastith
        /**
1224 3eaf782f pastith
         * Update the user with the values from the supplied object.
1225 3eaf782f pastith
         */
1226 3eaf782f pastith
        public void updateUser(User user);
1227 8f128261 droutsis
1228 8f128261 droutsis
        /**
1229 8f128261 droutsis
         * Update accounting information for given user.
1230 8f128261 droutsis
         *
1231 8f128261 droutsis
         * @param user The user to update
1232 8f128261 droutsis
         * @param date Date of transaction
1233 8f128261 droutsis
         * @param bandwidthDiff Bandwidth used; positive for addition,
1234 8f128261 droutsis
         * negative for subtraction (e.g. to rollback)
1235 8f128261 droutsis
         */
1236 8f128261 droutsis
        public void updateAccounting(User user, Date date, long bandwidthDiff);
1237 77f75ac4 pastith
1238 77f75ac4 pastith
        /**
1239 77f75ac4 pastith
         * Check if the user with the specified ID has permission to read the
1240 77f75ac4 pastith
         * folder with the supplied ID.
1241 77f75ac4 pastith
         */
1242 77f75ac4 pastith
        public boolean canReadFolder(Long userId, Long folderId) throws ObjectNotFoundException;
1243 3ef7b691 Dimitris Routsis
1244 3ef7b691 Dimitris Routsis
        /**
1245 3ef7b691 Dimitris Routsis
         * Reset WebDAV password for given user.
1246 3ef7b691 Dimitris Routsis
         *
1247 3ef7b691 Dimitris Routsis
         * @param userId
1248 3ef7b691 Dimitris Routsis
         * @return the new password
1249 3ef7b691 Dimitris Routsis
         * @throws ObjectNotFoundException
1250 3ef7b691 Dimitris Routsis
         */
1251 3ef7b691 Dimitris Routsis
        public String resetWebDAVPassword(Long userId) throws ObjectNotFoundException;
1252 3ef7b691 Dimitris Routsis
1253 14ad7326 pastith
}