Statistics
| Branch: | Tag: | Revision:

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

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 d114cfe2 Panagiotis Astithas
         * Updates the attributes of 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 d114cfe2 Panagiotis Astithas
         * @param modificationDate the modification date
376 14ad7326 pastith
         * @throws ObjectNotFoundException
377 14ad7326 pastith
         * @throws InsufficientPermissionsException
378 14ad7326 pastith
         */
379 d114cfe2 Panagiotis Astithas
        public void updateFile(Long userId, Long fileId, String name, String tagSet, Date modificationDate)
380 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
381 14ad7326 pastith
382 14ad7326 pastith
        /**
383 14ad7326 pastith
         * Retrieve the contents of the current body for the file
384 14ad7326 pastith
         * with the specified FileHeader ID. The file contents
385 14ad7326 pastith
         * are provided as an InputStream from which the caller can
386 14ad7326 pastith
         * retrieve the raw bytes.
387 14ad7326 pastith
         *
388 14ad7326 pastith
         * @param userId the ID of the current user
389 14ad7326 pastith
         * @param fileId the ID of the file to retrieve
390 14ad7326 pastith
         * @return an InputStream from the current file body contents
391 14ad7326 pastith
         * @throws ObjectNotFoundException if the file or the user was not found
392 14ad7326 pastith
         * @throws InsufficientPermissionsException  if the user does not have the
393 14ad7326 pastith
         *             appropriate privileges
394 14ad7326 pastith
         */
395 14ad7326 pastith
        public InputStream getFileContents(Long userId, Long fileId)
396 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
397 14ad7326 pastith
398 14ad7326 pastith
        /**
399 14ad7326 pastith
         * Retrieve the contents of the  body identified by bodyId for the file
400 14ad7326 pastith
         * with the specified FileHeader ID. The file contents
401 14ad7326 pastith
         * are provided as an InputStream from which the caller can
402 14ad7326 pastith
         * retrieve the raw bytes.
403 14ad7326 pastith
         *
404 14ad7326 pastith
         * @param userId the ID of the current user
405 14ad7326 pastith
         * @param fileId the ID of the file to retrieve
406 14ad7326 pastith
         * @param bodyId the body ID
407 14ad7326 pastith
         * @return an InputStream from the current file body contents
408 14ad7326 pastith
         * @throws ObjectNotFoundException if the file or the user was not found
409 14ad7326 pastith
         * @throws InsufficientPermissionsException  if the user does not have the
410 14ad7326 pastith
         *             appropriate privileges
411 14ad7326 pastith
         */
412 14ad7326 pastith
        public InputStream getFileContents(Long userId, Long fileId, Long bodyId)
413 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
414 14ad7326 pastith
415 14ad7326 pastith
        /**
416 14ad7326 pastith
         * Retrieve the file with the specified ID.
417 14ad7326 pastith
         *
418 14ad7326 pastith
         * @param userId the ID of the current user
419 14ad7326 pastith
         * @param fileId the ID of the file to retrieve
420 14ad7326 pastith
         * @return the file found
421 14ad7326 pastith
         * @throws ObjectNotFoundException if the file or the user was not found, with
422 14ad7326 pastith
         *                         the exception message mentioning the precise problem
423 14ad7326 pastith
         * @throws InsufficientPermissionsException
424 14ad7326 pastith
         */
425 14ad7326 pastith
        public FileHeaderDTO getFile(Long userId, Long fileId) throws ObjectNotFoundException,
426 14ad7326 pastith
                        InsufficientPermissionsException;
427 14ad7326 pastith
428 14ad7326 pastith
        /**
429 14ad7326 pastith
         * Retrieve the filebody with the specified ID.
430 14ad7326 pastith
         *
431 14ad7326 pastith
         * @param userId the ID of the current user
432 14ad7326 pastith
         * @param fileId the ID of the file to retrieve
433 14ad7326 pastith
         * @param bodyId the ID of the body
434 14ad7326 pastith
         * @return the file found
435 14ad7326 pastith
         * @throws ObjectNotFoundException if the file or the user was not found, with
436 14ad7326 pastith
         *                         the exception message mentioning the precise problem
437 14ad7326 pastith
         * @throws InsufficientPermissionsException
438 14ad7326 pastith
         */
439 14ad7326 pastith
        public FileBodyDTO getFileBody(Long userId, Long fileId, Long bodyId)
440 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
441 14ad7326 pastith
442 14ad7326 pastith
        /**
443 14ad7326 pastith
         * Get the resource (file or folder) at the specified path in
444 14ad7326 pastith
         * the specified user's namespace. The returned object will be of type
445 14ad7326 pastith
         * FileHeaderDTO or FolderDTO.<p><strong>Note:</strong> this method does not
446 14ad7326 pastith
         * receive the current user as a parameter, therefore it is unable to perform
447 14ad7326 pastith
         * the necessary permission checks and should <strong>NOT</strong> be directly
448 14ad7326 pastith
         * exposed to remote clients. It is the caller's responsibility to verify that
449 14ad7326 pastith
         * the calling user has the required privileges for performing any subsequent
450 14ad7326 pastith
         * action on the resource through one of the other ExternalAPI methods.
451 14ad7326 pastith
         *
452 14ad7326 pastith
         * @param ownerId the ID of the user owning the namespace
453 14ad7326 pastith
         * @param path the absolute path in the user's namespace
454 68410d59 pastith
         * @param ignoreDeleted if true, resources that have been moved to the trash
455 68410d59 pastith
         *                         will be ignored
456 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or resource was not found, with
457 14ad7326 pastith
         *                         the exception message mentioning the precise problem
458 14ad7326 pastith
         * @return the resource found
459 14ad7326 pastith
         */
460 68410d59 pastith
        public Object getResourceAtPath(Long ownerId, String path, boolean ignoreDeleted)
461 68410d59 pastith
                        throws ObjectNotFoundException;
462 14ad7326 pastith
463 14ad7326 pastith
        /**
464 14ad7326 pastith
         * Copy the provided file to the specified destination.
465 14ad7326 pastith
         *
466 14ad7326 pastith
         * @param userId the ID of the current user
467 14ad7326 pastith
         * @param fileId the IF of the provided file
468 14ad7326 pastith
         * @param dest the path of the new resource
469 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
470 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
471 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
472 14ad7326 pastith
         *          the destination folder, as either a folder or file
473 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
474 14ad7326 pastith
         * @throws InsufficientPermissionsException
475 14ad7326 pastith
         * @throws QuotaExceededException
476 14ad7326 pastith
         */
477 14ad7326 pastith
        public void copyFile(Long userId, Long fileId, String dest) throws ObjectNotFoundException,
478 14ad7326 pastith
                        DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
479 14ad7326 pastith
480 14ad7326 pastith
        /**
481 14ad7326 pastith
         * Copy the provided file to the specified destination.
482 14ad7326 pastith
         *
483 14ad7326 pastith
         * @param userId the ID of the current user
484 14ad7326 pastith
         * @param ownerId the ID of the owner of the destination namespace
485 14ad7326 pastith
         * @param fileId the IF of the provided file
486 14ad7326 pastith
         * @param dest the path of the new resource
487 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
488 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
489 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
490 14ad7326 pastith
         *          the destination folder, as either a folder or file
491 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
492 14ad7326 pastith
         * @throws InsufficientPermissionsException
493 14ad7326 pastith
         * @throws QuotaExceededException
494 14ad7326 pastith
         */
495 14ad7326 pastith
        public void copyFileToPath(Long userId, Long ownerId, Long fileId, String dest) throws ObjectNotFoundException,
496 14ad7326 pastith
                        DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
497 14ad7326 pastith
498 14ad7326 pastith
        /**
499 14ad7326 pastith
         * Copy the provided file to the specified destination.
500 14ad7326 pastith
         *
501 14ad7326 pastith
         * @param userId the ID of the current user
502 14ad7326 pastith
         * @param fileIds the IDs of the provided files
503 14ad7326 pastith
         * @param destId the ID of the destination folder
504 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
505 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
506 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
507 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
508 14ad7326 pastith
         *          the destination folder, as either a folder or file
509 14ad7326 pastith
         * @throws InsufficientPermissionsException
510 14ad7326 pastith
         * @throws QuotaExceededException
511 14ad7326 pastith
         */
512 14ad7326 pastith
        public void copyFiles(Long userId, List<Long> fileIds, Long destId)
513 14ad7326 pastith
                        throws ObjectNotFoundException, DuplicateNameException, GSSIOException,
514 14ad7326 pastith
                        InsufficientPermissionsException, QuotaExceededException;
515 14ad7326 pastith
516 14ad7326 pastith
        /**
517 14ad7326 pastith
         * Copy the provided file to the specified destination.
518 14ad7326 pastith
         *
519 14ad7326 pastith
         * @param userId the ID of the current user
520 14ad7326 pastith
         * @param fileId the IF of the provided file
521 14ad7326 pastith
         * @param destId the ID of the destination folder
522 14ad7326 pastith
         * @param destName the name of the new file
523 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
524 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
525 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
526 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
527 14ad7326 pastith
         *          the destination folder, as either a folder or file
528 14ad7326 pastith
         * @throws InsufficientPermissionsException
529 14ad7326 pastith
         * @throws QuotaExceededException
530 14ad7326 pastith
         */
531 14ad7326 pastith
        public void copyFile(Long userId, Long fileId, Long destId, String destName)
532 14ad7326 pastith
                        throws ObjectNotFoundException, DuplicateNameException, GSSIOException,
533 14ad7326 pastith
                        InsufficientPermissionsException, QuotaExceededException;
534 14ad7326 pastith
535 14ad7326 pastith
        /**
536 14ad7326 pastith
         * Copy the provided folder to the specified destination.
537 14ad7326 pastith
         *
538 14ad7326 pastith
         * @param userId the ID of the current user
539 14ad7326 pastith
         * @param folderId the IF of the provided folder
540 14ad7326 pastith
         * @param dest the path of the new folder
541 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
542 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
543 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
544 14ad7326 pastith
         *          the destination folder, as either a folder or file
545 14ad7326 pastith
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
546 14ad7326 pastith
         *          appropriate privileges
547 14ad7326 pastith
         */
548 14ad7326 pastith
        public void copyFolder(Long userId, Long folderId, String dest) throws ObjectNotFoundException,
549 14ad7326 pastith
                        DuplicateNameException, InsufficientPermissionsException;
550 14ad7326 pastith
551 14ad7326 pastith
        /**
552 14ad7326 pastith
         * Copy the provided folder to the specified destination.
553 14ad7326 pastith
         *
554 14ad7326 pastith
         * @param userId the ID of the current user
555 14ad7326 pastith
         * @param folderId the IF of the provided folder
556 14ad7326 pastith
         * @param destId the ID of the destination folder
557 14ad7326 pastith
         * @param destName the name of the new folder
558 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
559 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
560 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
561 14ad7326 pastith
         *          the destination folder, as either a folder or file
562 14ad7326 pastith
         * @throws InsufficientPermissionsException InsufficientPermissionsException
563 14ad7326 pastith
         *                         if the user does not have the appropriate privileges
564 14ad7326 pastith
         */
565 14ad7326 pastith
        public void copyFolder(Long userId, Long folderId, Long destId, String destName)
566 14ad7326 pastith
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException;
567 14ad7326 pastith
568 14ad7326 pastith
        /**
569 14ad7326 pastith
         * Copy the provided folder and all its subfolders and files to the specified destination.
570 14ad7326 pastith
         *
571 14ad7326 pastith
         * @param userId the ID of the current user
572 14ad7326 pastith
         * @param ownerId the ID of the owner of the destination namespace
573 14ad7326 pastith
         * @param folderId the IF of the provided folder
574 14ad7326 pastith
         * @param dest the path of the new folder
575 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
576 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
577 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
578 14ad7326 pastith
         *          the destination folder, as either a folder or file
579 14ad7326 pastith
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
580 14ad7326 pastith
         *          appropriate privileges
581 14ad7326 pastith
         * @throws QuotaExceededException if the user quota limit would be exceeded
582 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
583 14ad7326 pastith
         */
584 14ad7326 pastith
        public void copyFolderStructureToPath(Long userId, Long ownerId, Long folderId, String dest) throws ObjectNotFoundException,
585 14ad7326 pastith
                        DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
586 14ad7326 pastith
587 14ad7326 pastith
        /**
588 14ad7326 pastith
         * Copy the provided folder and all its subfolders and files to the specified destination.
589 14ad7326 pastith
         *
590 14ad7326 pastith
         * @param userId the ID of the current user
591 14ad7326 pastith
         * @param folderId the IF of the provided folder
592 14ad7326 pastith
         * @param destId the ID of the destination folder
593 14ad7326 pastith
         * @param destName the name of the new folder
594 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
595 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
596 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
597 14ad7326 pastith
         *          the destination folder, as either a folder or file
598 14ad7326 pastith
         * @throws InsufficientPermissionsException InsufficientPermissionsException
599 14ad7326 pastith
         *                         if the user does not have the appropriate privileges
600 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
601 14ad7326 pastith
         * @throws QuotaExceededException if the user quota limit would be exceeded
602 14ad7326 pastith
         */
603 14ad7326 pastith
        public void copyFolderStructure(Long userId, Long folderId, Long destId, String destName)
604 14ad7326 pastith
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,
605 14ad7326 pastith
                        GSSIOException, QuotaExceededException;
606 14ad7326 pastith
607 14ad7326 pastith
        /**
608 14ad7326 pastith
         * Marks  the specified file as deleted in the specified user's namespace.
609 14ad7326 pastith
         *
610 14ad7326 pastith
         * @param userId the ID of the current user
611 14ad7326 pastith
         * @param fileId the ID of the file to delete
612 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
613 14ad7326 pastith
         *             the exception message mentioning the precise problem
614 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
615 14ad7326 pastith
         *             appropriate privileges
616 14ad7326 pastith
         */
617 14ad7326 pastith
        public void moveFileToTrash(Long userId, Long fileId) throws ObjectNotFoundException,
618 14ad7326 pastith
                        InsufficientPermissionsException;
619 14ad7326 pastith
620 14ad7326 pastith
        /**
621 14ad7326 pastith
         * Marks  the specified deleted file as undeleted in the specified user's namespace.
622 14ad7326 pastith
         *
623 14ad7326 pastith
         * @param userId the ID of the current user
624 14ad7326 pastith
         * @param fileId the ID of the file to undelete
625 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
626 14ad7326 pastith
         *             the exception message mentioning the precise problem
627 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
628 14ad7326 pastith
         *             appropriate privileges
629 14ad7326 pastith
         *
630 14ad7326 pastith
         */
631 14ad7326 pastith
        public void removeFileFromTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
632 14ad7326 pastith
633 14ad7326 pastith
        /**
634 14ad7326 pastith
         * Marks  the specified files as deleted in the specified user's namespace.
635 14ad7326 pastith
         *
636 14ad7326 pastith
         * @param userId the ID of the current user
637 14ad7326 pastith
         * @param fileIds the IDs of the file to delete
638 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
639 14ad7326 pastith
         *             the exception message mentioning the precise problem
640 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
641 14ad7326 pastith
         *             appropriate privileges
642 14ad7326 pastith
         */
643 14ad7326 pastith
        public void moveFilesToTrash(Long userId, List<Long> fileIds)
644 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
645 14ad7326 pastith
646 14ad7326 pastith
        /**
647 14ad7326 pastith
         * Marks  the specified deleted files as undeleted in the specified user's namespace.
648 14ad7326 pastith
         *
649 14ad7326 pastith
         * @param userId the ID of the current user
650 14ad7326 pastith
         * @param fileIds the IDs of the file to undelete
651 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
652 14ad7326 pastith
         *             the exception message mentioning the precise problem
653 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
654 14ad7326 pastith
         *             appropriate privileges
655 14ad7326 pastith
         */
656 14ad7326 pastith
        public void removeFilesFromTrash(Long userId, List<Long> fileIds) throws ObjectNotFoundException, InsufficientPermissionsException;
657 14ad7326 pastith
658 14ad7326 pastith
        /**
659 14ad7326 pastith
         * Marks  the specified folder as deleted in the specified user's namespace.
660 14ad7326 pastith
         *
661 14ad7326 pastith
         * @param userId the ID of the current user
662 14ad7326 pastith
         * @param folderId the ID of the folder to delete
663 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
664 14ad7326 pastith
         *             the exception message mentioning the precise problem
665 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
666 14ad7326 pastith
         *             appropriate privileges
667 14ad7326 pastith
         */
668 14ad7326 pastith
        public void moveFolderToTrash(Long userId, Long folderId)
669 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
670 14ad7326 pastith
671 14ad7326 pastith
        /**
672 14ad7326 pastith
         * Marks  the specified deleted folder as undeleted in the specified user's namespace.
673 14ad7326 pastith
         *
674 14ad7326 pastith
         * @param userId the ID of the current user
675 14ad7326 pastith
         * @param folderId the ID of the folder to undelete
676 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
677 14ad7326 pastith
         *             the exception message mentioning the precise problem
678 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
679 14ad7326 pastith
         *          appropriate privileges
680 14ad7326 pastith
         *
681 14ad7326 pastith
         */
682 14ad7326 pastith
        public void removeFolderFromTrash(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
683 14ad7326 pastith
684 14ad7326 pastith
        /**
685 14ad7326 pastith
         * Move the provided folder and all its subfolders and files to the specified destination.
686 14ad7326 pastith
         *
687 14ad7326 pastith
         * @param userId the ID of the current user
688 14ad7326 pastith
         * @param folderId the IF of the provided folder
689 14ad7326 pastith
         * @param destId the ID of the destination folder
690 14ad7326 pastith
         * @param destName the name of the new folder
691 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
692 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
693 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
694 14ad7326 pastith
         *          the destination folder, as either a folder or file
695 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not have the
696 14ad7326 pastith
         *          appropriate privileges
697 14ad7326 pastith
         * @throws GSSIOException
698 14ad7326 pastith
         * @throws QuotaExceededException
699 14ad7326 pastith
         */
700 14ad7326 pastith
        public void moveFolder(Long userId, Long folderId, Long destId, String destName)
701 14ad7326 pastith
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,
702 14ad7326 pastith
                        GSSIOException, QuotaExceededException;
703 14ad7326 pastith
704 14ad7326 pastith
        /**
705 14ad7326 pastith
         * Move the provided folder and all its subfolders and files to the specified destination.
706 14ad7326 pastith
         *
707 14ad7326 pastith
         * @param userId the ID of the current user
708 14ad7326 pastith
         * @param ownerId the owner of the destination namespace
709 14ad7326 pastith
         * @param folderId the IF of the provided folder
710 14ad7326 pastith
         * @param dest the path of the new folder
711 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, folder or destination was not
712 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
713 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
714 14ad7326 pastith
         *          the destination folder, as either a folder or file
715 14ad7326 pastith
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
716 14ad7326 pastith
         *          appropriate privileges
717 14ad7326 pastith
         * @throws GSSIOException
718 14ad7326 pastith
         * @throws QuotaExceededException
719 14ad7326 pastith
         */
720 14ad7326 pastith
        public void moveFolderToPath(Long userId, Long ownerId, Long folderId, String dest) throws ObjectNotFoundException,
721 14ad7326 pastith
                        DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
722 14ad7326 pastith
723 14ad7326 pastith
        /**
724 14ad7326 pastith
         * Move the provided file to the specified destination.
725 14ad7326 pastith
         *
726 14ad7326 pastith
         * @param userId the ID of the current user
727 14ad7326 pastith
         * @param fileId the IF of the provided file
728 14ad7326 pastith
         * @param destId the ID of the destination folder
729 14ad7326 pastith
         * @param destName the name of the new file
730 14ad7326 pastith
         * @throws InsufficientPermissionsException
731 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
732 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
733 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
734 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
735 14ad7326 pastith
         *          the destination folder, as either a folder or file
736 14ad7326 pastith
         * @throws QuotaExceededException
737 14ad7326 pastith
         */
738 14ad7326 pastith
        public void moveFile(Long userId, Long fileId, Long destId, String destName)
739 14ad7326 pastith
                        throws InsufficientPermissionsException, ObjectNotFoundException,
740 14ad7326 pastith
                        DuplicateNameException, GSSIOException, QuotaExceededException;
741 14ad7326 pastith
742 14ad7326 pastith
        /**
743 14ad7326 pastith
         * Move the provided file to the specified destination.
744 14ad7326 pastith
         *
745 14ad7326 pastith
         * @param userId the ID of the current user
746 14ad7326 pastith
         * @param ownerId the owner of the destination namespace
747 14ad7326 pastith
         * @param fileId the IF of the provided file
748 14ad7326 pastith
         * @param dest the path of the new file
749 14ad7326 pastith
         * @throws InsufficientPermissionsException
750 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
751 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
752 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
753 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
754 14ad7326 pastith
         *          the destination folder, as either a folder or file
755 14ad7326 pastith
         * @throws QuotaExceededException
756 14ad7326 pastith
         */
757 14ad7326 pastith
        public void moveFileToPath(Long userId, Long ownerId, Long fileId, String dest) throws ObjectNotFoundException, InsufficientPermissionsException, DuplicateNameException, GSSIOException, QuotaExceededException;
758 14ad7326 pastith
759 14ad7326 pastith
        /**
760 14ad7326 pastith
         * move the provided file to the specified destination.
761 14ad7326 pastith
         *
762 14ad7326 pastith
         * @param userId the ID of the current user
763 14ad7326 pastith
         * @param fileIds the IDs of the provided files
764 14ad7326 pastith
         * @param destId the ID of the destination folder
765 14ad7326 pastith
         * @throws InsufficientPermissionsException
766 14ad7326 pastith
         * @throws ObjectNotFoundException if the user, file or destination was not
767 14ad7326 pastith
         *                         found, with        the exception message mentioning the precise problem
768 14ad7326 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
769 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
770 14ad7326 pastith
         *          the destination folder, as either a folder or file
771 14ad7326 pastith
         * @throws QuotaExceededException
772 14ad7326 pastith
         */
773 14ad7326 pastith
        public void moveFiles(Long userId, List<Long> fileIds, Long destId)
774 14ad7326 pastith
                        throws InsufficientPermissionsException, ObjectNotFoundException,
775 14ad7326 pastith
                        DuplicateNameException, GSSIOException, QuotaExceededException;
776 14ad7326 pastith
777 14ad7326 pastith
        /**
778 14ad7326 pastith
         * Returns a list of All deleted files of a user.
779 14ad7326 pastith
         *
780 14ad7326 pastith
         * @param userId the ID of the User
781 14ad7326 pastith
         *          * @return the list of deleted file header objects
782 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
783 14ad7326 pastith
         */
784 14ad7326 pastith
        public List<FileHeaderDTO> getDeletedFiles(Long userId) throws ObjectNotFoundException;
785 14ad7326 pastith
786 14ad7326 pastith
        /**
787 14ad7326 pastith
         * Returns a list of All deleted root folders of a user.
788 14ad7326 pastith
         *
789 14ad7326 pastith
         * @param userId the ID of the User
790 14ad7326 pastith
         *          * @return the list of deleted file header objects
791 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
792 14ad7326 pastith
         */
793 14ad7326 pastith
        public List<FolderDTO> getDeletedRootFolders(Long userId) throws ObjectNotFoundException;
794 14ad7326 pastith
795 14ad7326 pastith
        /**
796 14ad7326 pastith
         * Empty Trash by deleting all marked as deleted files and folders
797 14ad7326 pastith
         * @param userId
798 14ad7326 pastith
         * @throws ObjectNotFoundException if something goes wrong in the delete process
799 14ad7326 pastith
         * @throws InsufficientPermissionsException if something goes wrong in the delete process
800 14ad7326 pastith
         */
801 14ad7326 pastith
        public void emptyTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
802 14ad7326 pastith
803 14ad7326 pastith
        /**
804 14ad7326 pastith
         * Restores All Trashed Items by undeleting all marked as deleted files and folders
805 14ad7326 pastith
         * @param userId
806 14ad7326 pastith
         * @throws ObjectNotFoundException if something goes wrong in the delete process
807 14ad7326 pastith
         * @throws InsufficientPermissionsException
808 14ad7326 pastith
         */
809 14ad7326 pastith
        public void restoreTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
810 14ad7326 pastith
811 14ad7326 pastith
        /**
812 14ad7326 pastith
         * Search the system for a user with the specified username.
813 14ad7326 pastith
         * If no such user is found, the method returns null.
814 14ad7326 pastith
         *
815 14ad7326 pastith
         * @param username the username to search for
816 14ad7326 pastith
         * @return the User object with the specified username
817 14ad7326 pastith
         */
818 14ad7326 pastith
        public User findUser(String username);
819 14ad7326 pastith
820 14ad7326 pastith
        /**
821 14ad7326 pastith
         * Create a new user with the specified name, username and e-mail address.
822 14ad7326 pastith
         *
823 14ad7326 pastith
         * @param username the username of the new user
824 14ad7326 pastith
         * @param name the full name of the new user
825 14ad7326 pastith
         * @param mail the e-mail of the new user
826 14ad7326 pastith
         * @return the newly-created User object
827 14ad7326 pastith
         * @throws DuplicateNameException if a user with the same username already exists
828 14ad7326 pastith
         * @throws ObjectNotFoundException if no username was provided
829 14ad7326 pastith
         */
830 14ad7326 pastith
        public User createUser(String username, String name, String mail)
831 14ad7326 pastith
                        throws DuplicateNameException, ObjectNotFoundException;
832 14ad7326 pastith
833 14ad7326 pastith
        /**
834 98e2f2ae Panagiotis Astithas
         * Update the user with the specified username with the provided name
835 14ad7326 pastith
         * and e-mail address.
836 14ad7326 pastith
         *
837 14ad7326 pastith
         * @param username the username of the user
838 14ad7326 pastith
         * @param name the modified full name of the user
839 14ad7326 pastith
         * @param mail the modified e-mail of the user
840 14ad7326 pastith
         * @return the updated User object
841 14ad7326 pastith
         * @throws ObjectNotFoundException if no username was provided
842 14ad7326 pastith
         */
843 14ad7326 pastith
        public User updateUser(String username, String name, String mail) throws ObjectNotFoundException;
844 14ad7326 pastith
845 14ad7326 pastith
        /**
846 14ad7326 pastith
         * Updates the authentication token for the specified user.
847 14ad7326 pastith
         *
848 14ad7326 pastith
         * @param userId the ID of the user whose token should be updated
849 14ad7326 pastith
         * @return the updated user
850 14ad7326 pastith
         * @throws ObjectNotFoundException if the user could not be found
851 14ad7326 pastith
         */
852 14ad7326 pastith
        public User updateUserToken(Long userId) throws ObjectNotFoundException;
853 14ad7326 pastith
854 14ad7326 pastith
        /**
855 0a4b8f82 pastith
         * Updates the policy acceptance flag for the specified user.
856 0a4b8f82 pastith
         *
857 0a4b8f82 pastith
         * @param userId the ID of the user whose flag should be updated
858 0a4b8f82 pastith
         * @param isAccepted the new value of the flag
859 0a4b8f82 pastith
         * @return the updated user
860 0a4b8f82 pastith
         * @throws ObjectNotFoundException if the user could not be found
861 0a4b8f82 pastith
         */
862 0a4b8f82 pastith
        public User updateUserPolicyAcceptance(Long userId, boolean isAccepted) throws ObjectNotFoundException;
863 0a4b8f82 pastith
864 0a4b8f82 pastith
        /**
865 14ad7326 pastith
         * Invalidates the authentication token for the specified user.
866 14ad7326 pastith
         *
867 14ad7326 pastith
         * @param userId the ID of the user whose token should be updated
868 14ad7326 pastith
         * @throws ObjectNotFoundException if the user could not be found
869 14ad7326 pastith
         */
870 14ad7326 pastith
        public void invalidateUserToken(Long userId) throws ObjectNotFoundException;
871 14ad7326 pastith
872 14ad7326 pastith
        /**
873 14ad7326 pastith
         * Retrieve folder user and group permissions
874 14ad7326 pastith
         *
875 14ad7326 pastith
         * @param userId the ID of the user whose token should be updated
876 14ad7326 pastith
         * @param folderId the ID of the folder
877 14ad7326 pastith
         * @return the Set of permissions from requested folder
878 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or folder could not be found
879 14ad7326 pastith
         * @throws InsufficientPermissionsException
880 14ad7326 pastith
         */
881 14ad7326 pastith
        public Set<PermissionDTO> getFolderPermissions(Long userId, Long folderId)
882 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
883 14ad7326 pastith
884 14ad7326 pastith
        /**
885 14ad7326 pastith
         * update folder permissions
886 14ad7326 pastith
         * @param userId
887 14ad7326 pastith
         * @param folderId
888 14ad7326 pastith
         * @param permissions
889 14ad7326 pastith
         * @throws ObjectNotFoundException
890 14ad7326 pastith
         * @throws InsufficientPermissionsException
891 14ad7326 pastith
         */
892 14ad7326 pastith
        public void setFolderPermissions(Long userId, Long folderId, Set<PermissionDTO> permissions)
893 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
894 14ad7326 pastith
895 14ad7326 pastith
        /**
896 14ad7326 pastith
         * Retrieve file user and group permissions
897 14ad7326 pastith
         *
898 14ad7326 pastith
         * @param userId the ID of the user whose token should be updated
899 14ad7326 pastith
         * @param fileId the ID of the folder
900 14ad7326 pastith
         * @return the Set of permissions from requested folder
901 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or folder could not be found
902 14ad7326 pastith
         * @throws InsufficientPermissionsException
903 14ad7326 pastith
         */
904 14ad7326 pastith
        public Set<PermissionDTO> getFilePermissions(Long userId, Long fileId)
905 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
906 14ad7326 pastith
907 14ad7326 pastith
908 14ad7326 pastith
        /**
909 14ad7326 pastith
         * update file permissions
910 14ad7326 pastith
         * @param userId
911 14ad7326 pastith
         * @param fileId
912 14ad7326 pastith
         * @param readForAll
913 14ad7326 pastith
         * @param permissions
914 14ad7326 pastith
         * @throws ObjectNotFoundException
915 14ad7326 pastith
         * @throws InsufficientPermissionsException
916 14ad7326 pastith
         */
917 14ad7326 pastith
        public void setFilePermissions(Long userId, Long fileId, Boolean readForAll,
918 14ad7326 pastith
                                Set<PermissionDTO> permissions)
919 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
920 14ad7326 pastith
921 14ad7326 pastith
        /**
922 14ad7326 pastith
         * Returns a list of all shared root folders of a user.
923 14ad7326 pastith
         *
924 14ad7326 pastith
         * @param userId the ID of the User
925 14ad7326 pastith
         * @return the list of shared root folders
926 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
927 14ad7326 pastith
         */
928 14ad7326 pastith
        public List<FolderDTO> getSharedRootFolders(Long userId) throws ObjectNotFoundException;
929 14ad7326 pastith
930 14ad7326 pastith
        /**
931 14ad7326 pastith
         * Returns a list of all shared files of a user that are not
932 14ad7326 pastith
         * inside other shared folders.
933 14ad7326 pastith
         *
934 14ad7326 pastith
         * @param userId the ID of the User
935 14ad7326 pastith
         * @return the list of shared files
936 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
937 14ad7326 pastith
         */
938 14ad7326 pastith
        public List<FileHeaderDTO> getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException;
939 14ad7326 pastith
940 14ad7326 pastith
        /**
941 14ad7326 pastith
         * Returns a list of all shared files of a user.
942 14ad7326 pastith
         *
943 14ad7326 pastith
         * @param userId the ID of the User
944 14ad7326 pastith
         * @return the list of shared files
945 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
946 14ad7326 pastith
         */
947 14ad7326 pastith
        public List<FileHeaderDTO> getSharedFiles(Long userId) throws ObjectNotFoundException;
948 14ad7326 pastith
949 14ad7326 pastith
        /**
950 14ad7326 pastith
         * Returns a list of all shared folders of a user.
951 14ad7326 pastith
         *
952 14ad7326 pastith
         * @param userId the ID of the User
953 14ad7326 pastith
         * @return the list of shared folders
954 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
955 14ad7326 pastith
         */
956 14ad7326 pastith
        public List<FolderDTO> getSharedFolders(Long userId) throws ObjectNotFoundException;
957 14ad7326 pastith
958 14ad7326 pastith
        /**
959 14ad7326 pastith
         * Returns a list of all shared root folders of a user that calling
960 14ad7326 pastith
         * user has at least read permissions.
961 14ad7326 pastith
         *
962 14ad7326 pastith
         * @param ownerId the ID of the User
963 14ad7326 pastith
         * @return the list of shared root folders
964 14ad7326 pastith
         * @param callingUserId
965 14ad7326 pastith
         *
966 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
967 14ad7326 pastith
         */
968 14ad7326 pastith
        public List<FolderDTO> getSharedRootFolders(Long ownerId, Long callingUserId)
969 14ad7326 pastith
                        throws ObjectNotFoundException;
970 14ad7326 pastith
971 14ad7326 pastith
        /**
972 14ad7326 pastith
         * Returns a list of all shared  files of a user that calling user has
973 14ad7326 pastith
         * at least read permissions..
974 14ad7326 pastith
         *
975 14ad7326 pastith
         * @param ownerId the ID of the User
976 14ad7326 pastith
         * @return the list of shared files
977 14ad7326 pastith
         * @param callingUserId
978 14ad7326 pastith
         * @throws ObjectNotFoundException if the user cannot be found
979 14ad7326 pastith
         */
980 14ad7326 pastith
        public List<FileHeaderDTO> getSharedFiles(Long ownerId, Long callingUserId)
981 14ad7326 pastith
                        throws ObjectNotFoundException;
982 14ad7326 pastith
983 14ad7326 pastith
        /**
984 14ad7326 pastith
         * Remove a user member from a group
985 14ad7326 pastith
         *
986 14ad7326 pastith
         * @param userId the ID of the User owning the group
987 14ad7326 pastith
         * @param groupId the ID of the requested group
988 14ad7326 pastith
         * @param memberId the ID of the member to be removed
989 14ad7326 pastith
         *
990 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or group was not found, with
991 14ad7326 pastith
         *             the exception message mentioning the precise problem
992 14ad7326 pastith
         * @throws InsufficientPermissionsException
993 14ad7326 pastith
         */
994 14ad7326 pastith
        public void removeMemberFromGroup(Long userId, Long groupId, Long memberId)
995 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
996 14ad7326 pastith
997 14ad7326 pastith
        /**
998 14ad7326 pastith
         * Retrieves the list of users sharing files to user identified by user id
999 14ad7326 pastith
         * @param userId
1000 14ad7326 pastith
         * @return the List of users sharing files to user
1001 14ad7326 pastith
         * @throws ObjectNotFoundException
1002 14ad7326 pastith
         */
1003 14ad7326 pastith
        public List<UserDTO> getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException;
1004 14ad7326 pastith
1005 14ad7326 pastith
        /**
1006 14ad7326 pastith
         * Search Files
1007 14ad7326 pastith
         *
1008 14ad7326 pastith
         * @param userId
1009 14ad7326 pastith
         * @param query
1010 14ad7326 pastith
         * @return list of files that match query
1011 14ad7326 pastith
         * @throws ObjectNotFoundException if no user or query was specified
1012 14ad7326 pastith
         */
1013 14ad7326 pastith
        public List<FileHeaderDTO> searchFiles(Long userId, String query) throws ObjectNotFoundException;
1014 14ad7326 pastith
1015 14ad7326 pastith
        /**
1016 14ad7326 pastith
         * Creates a nonce for the specified user.
1017 14ad7326 pastith
         *
1018 14ad7326 pastith
         * @param userId the ID of the user
1019 14ad7326 pastith
         * @return the new nonce
1020 14ad7326 pastith
         * @throws ObjectNotFoundException if the user could not be found
1021 14ad7326 pastith
         */
1022 14ad7326 pastith
        public Nonce createNonce(Long userId) throws ObjectNotFoundException;
1023 14ad7326 pastith
1024 14ad7326 pastith
        /**
1025 14ad7326 pastith
         * Find the nonce object for the specified encoded nonce, that should be
1026 14ad7326 pastith
         * associated with the specified user.
1027 14ad7326 pastith
         *
1028 14ad7326 pastith
         * @param nonce the issued nonce in Base64 encoding
1029 14ad7326 pastith
         * @param userId the ID of the user for whom this nonce should have been issued
1030 14ad7326 pastith
         * @return the retrieved nonce object
1031 14ad7326 pastith
         * @throws ObjectNotFoundException if the nonce or user were not found
1032 14ad7326 pastith
         */
1033 14ad7326 pastith
        public Nonce getNonce(String nonce, Long userId) throws ObjectNotFoundException;
1034 14ad7326 pastith
1035 14ad7326 pastith
        /**
1036 14ad7326 pastith
         * Remove the specified nonce from the persistent store.
1037 14ad7326 pastith
         *
1038 14ad7326 pastith
         * @param id the ID of the nonce
1039 14ad7326 pastith
         * @throws ObjectNotFoundException if the specified nonce could not be found
1040 14ad7326 pastith
         */
1041 14ad7326 pastith
        public void removeNonce(Long id) throws ObjectNotFoundException;
1042 14ad7326 pastith
1043 14ad7326 pastith
        /**
1044 14ad7326 pastith
         * Activate the supplied nonce for the specified user.
1045 14ad7326 pastith
         *
1046 14ad7326 pastith
         * @param userId the ID of the user
1047 14ad7326 pastith
         * @param nonce the nonce to activate
1048 14ad7326 pastith
         * @param nonceExpiryDate the expiry date of the nonce
1049 14ad7326 pastith
         * @throws ObjectNotFoundException
1050 14ad7326 pastith
         */
1051 14ad7326 pastith
        public void activateUserNonce(Long userId, String nonce, Date nonceExpiryDate) throws ObjectNotFoundException;
1052 14ad7326 pastith
1053 14ad7326 pastith
        /**
1054 14ad7326 pastith
         * Retrieves user statistics.
1055 14ad7326 pastith
         *
1056 14ad7326 pastith
         * @param userId the ID of the user
1057 14ad7326 pastith
         * @return the statistics
1058 14ad7326 pastith
         * @throws ObjectNotFoundException
1059 14ad7326 pastith
         *
1060 14ad7326 pastith
         */
1061 14ad7326 pastith
        public StatsDTO getUserStatistics(Long userId) throws ObjectNotFoundException;
1062 14ad7326 pastith
1063 14ad7326 pastith
        /**
1064 14ad7326 pastith
         * Retrieves file versions
1065 14ad7326 pastith
         *
1066 14ad7326 pastith
         * @param userId the ID of the user
1067 14ad7326 pastith
         * @param fileId the ID of the file
1068 14ad7326 pastith
         * @return the list of filebodies
1069 14ad7326 pastith
         * @throws ObjectNotFoundException
1070 14ad7326 pastith
         * @throws InsufficientPermissionsException
1071 14ad7326 pastith
         *
1072 14ad7326 pastith
         */
1073 14ad7326 pastith
        public List<FileBodyDTO> getVersions(Long userId, Long fileId)
1074 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1075 14ad7326 pastith
1076 14ad7326 pastith
        /**
1077 39c34533 pastith
         * Restore the file contents to the specified version.
1078 14ad7326 pastith
         *
1079 14ad7326 pastith
         * @param userId the ID of the user
1080 14ad7326 pastith
         * @param fileId the ID of the file
1081 39c34533 pastith
         * @param version the version number of the desired file contents
1082 39c34533 pastith
         * @throws ObjectNotFoundException if the user or file was not
1083 39c34533 pastith
         *                         found, with        the exception message mentioning the precise problem
1084 39c34533 pastith
         * @throws InsufficientPermissionsException if the user does not have the
1085 39c34533 pastith
         *          appropriate privileges
1086 39c34533 pastith
         * @throws QuotaExceededException if the user quota limit would be exceeded
1087 39c34533 pastith
         * @throws GSSIOException if there was an error while accessing the file contents
1088 14ad7326 pastith
         */
1089 39c34533 pastith
        public void restoreVersion(Long userId, Long fileId, int version)
1090 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException,  GSSIOException, QuotaExceededException;
1091 14ad7326 pastith
1092 14ad7326 pastith
        /**
1093 14ad7326 pastith
         * Remove file version identified by bodyId
1094 14ad7326 pastith
         *
1095 14ad7326 pastith
         * @param userId the ID of the user
1096 14ad7326 pastith
         * @param fileId the ID of the file
1097 14ad7326 pastith
         * @param bodyId the ID of the body
1098 14ad7326 pastith
         *
1099 14ad7326 pastith
         * @throws ObjectNotFoundException
1100 14ad7326 pastith
         * @throws InsufficientPermissionsException
1101 14ad7326 pastith
         *
1102 14ad7326 pastith
         */
1103 14ad7326 pastith
        public void removeVersion(Long userId, Long fileId, Long bodyId)
1104 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1105 14ad7326 pastith
1106 14ad7326 pastith
        /**
1107 14ad7326 pastith
         * Removes all old file versions for specified file keeping only the current revision
1108 14ad7326 pastith
         *
1109 14ad7326 pastith
         * @param userId the ID of the user
1110 14ad7326 pastith
         * @param fileId the ID of the file
1111 14ad7326 pastith
         *
1112 14ad7326 pastith
         * @throws ObjectNotFoundException
1113 14ad7326 pastith
         * @throws InsufficientPermissionsException
1114 14ad7326 pastith
         *
1115 14ad7326 pastith
         */
1116 14ad7326 pastith
        public void removeOldVersions(Long userId, Long fileId)
1117 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1118 14ad7326 pastith
1119 14ad7326 pastith
        /**
1120 14ad7326 pastith
         * Toggle between file being versioned or not.
1121 14ad7326 pastith
         *
1122 14ad7326 pastith
         * @param userId the ID of the user
1123 14ad7326 pastith
         * @param fileId the ID of the file
1124 14ad7326 pastith
         * @param versioned the new value of the flag
1125 14ad7326 pastith
         *
1126 14ad7326 pastith
         * @throws ObjectNotFoundException
1127 14ad7326 pastith
         * @throws InsufficientPermissionsException
1128 14ad7326 pastith
         *
1129 14ad7326 pastith
         */
1130 14ad7326 pastith
        public void toggleFileVersioning(Long userId, Long fileId, boolean versioned)
1131 14ad7326 pastith
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1132 14ad7326 pastith
1133 14ad7326 pastith
        /**
1134 14ad7326 pastith
         * It is used by the Solr mbean to rebuild the index.
1135 14ad7326 pastith
         */
1136 14ad7326 pastith
        public void rebuildSolrIndex();
1137 14ad7326 pastith
1138 14ad7326 pastith
        /**
1139 14ad7326 pastith
         * Creates a new file with the specified owner, parent folder and name. The
1140 14ad7326 pastith
         * new file has the same permissions as its parent folder. The file contents
1141 14ad7326 pastith
         * are already uploaded outside of externalAPI and the uploaded file is used as a parameter.
1142 14ad7326 pastith
         *
1143 14ad7326 pastith
         * @param userId the ID of the current user
1144 14ad7326 pastith
         * @param folderId the ID of the parent folder
1145 14ad7326 pastith
         * @param name the name of the new file
1146 14ad7326 pastith
         * @param mimeType the MIME type of the file
1147 4d737770 Fotis Stamatelopoulos
         * @param fileSize the uploaded file size
1148 4d737770 Fotis Stamatelopoulos
         * @param filePath the uploaded file full path
1149 8f128261 droutsis
         * @return The FileHeaderDTO created
1150 14ad7326 pastith
         * @throws DuplicateNameException if the specified name already exists in
1151 14ad7326 pastith
         *             the parent folder, as either a folder or file
1152 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or parent folder was not
1153 14ad7326 pastith
         *             found, with the exception message mentioning the precise
1154 14ad7326 pastith
         *             problem
1155 14ad7326 pastith
         * @throws GSSIOException if there was an error while storing the file contents
1156 14ad7326 pastith
         * @throws InsufficientPermissionsException
1157 14ad7326 pastith
         * @throws QuotaExceededException
1158 14ad7326 pastith
         */
1159 4d737770 Fotis Stamatelopoulos
        public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType, long fileSize, String filePath)
1160 14ad7326 pastith
                        throws DuplicateNameException, ObjectNotFoundException, GSSIOException,
1161 14ad7326 pastith
                        InsufficientPermissionsException, QuotaExceededException;
1162 14ad7326 pastith
1163 14ad7326 pastith
        /**
1164 14ad7326 pastith
         * Create a new FileBody with the supplied uploaded file as contents and make it the current body
1165 14ad7326 pastith
         * of the file.
1166 14ad7326 pastith
         *
1167 14ad7326 pastith
         * @param userId the ID of the current user
1168 14ad7326 pastith
         * @param fileId the ID of the file header object
1169 14ad7326 pastith
         * @param mimeType the content type of the file
1170 4d737770 Fotis Stamatelopoulos
         * @param fileSize the uploaded file size
1171 4d737770 Fotis Stamatelopoulos
         * @param filePath the uploaded file full path
1172 8f128261 droutsis
         * @return The FileHeaderDTO updated
1173 14ad7326 pastith
         * @throws ObjectNotFoundException if the user or file was not found, with
1174 14ad7326 pastith
         *                         the exception message mentioning the precise problem
1175 14ad7326 pastith
         * @throws GSSIOException when an IO exception occurs
1176 14ad7326 pastith
         * @throws InsufficientPermissionsException
1177 14ad7326 pastith
         * @throws QuotaExceededException
1178 14ad7326 pastith
         */
1179 8f128261 droutsis
        public FileHeaderDTO updateFileContents(Long userId, Long fileId, String mimeType,
1180 4d737770 Fotis Stamatelopoulos
                                long fileSize, String filePath) throws ObjectNotFoundException, GSSIOException,
1181 14ad7326 pastith
                                InsufficientPermissionsException, QuotaExceededException;
1182 14ad7326 pastith
1183 14ad7326 pastith
        /**
1184 14ad7326 pastith
         * Create a file based on inputstream without using transaction.
1185 14ad7326 pastith
         *
1186 14ad7326 pastith
         * @param stream
1187 14ad7326 pastith
         * @param userId
1188 14ad7326 pastith
         * @return the file
1189 14ad7326 pastith
         * @throws IOException
1190 14ad7326 pastith
         * @throws ObjectNotFoundException
1191 14ad7326 pastith
         */
1192 14ad7326 pastith
        @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
1193 14ad7326 pastith
        public File uploadFile(InputStream stream, Long userId)
1194 14ad7326 pastith
                        throws IOException, ObjectNotFoundException;
1195 14ad7326 pastith
1196 14ad7326 pastith
        public void createFileUploadProgress(Long userId, String filename,
1197 14ad7326 pastith
                                Long bytesTransfered, Long fileSize) throws ObjectNotFoundException;
1198 14ad7326 pastith
1199 14ad7326 pastith
        public FileUploadStatus getFileUploadStatus(Long userId, String fileName);
1200 14ad7326 pastith
1201 14ad7326 pastith
        public void removeFileUploadProgress(Long userId, String filename)
1202 14ad7326 pastith
                        throws ObjectNotFoundException;
1203 14ad7326 pastith
1204 14ad7326 pastith
        /**
1205 14ad7326 pastith
         * Fetch the file body with the specified version number.
1206 14ad7326 pastith
         *
1207 14ad7326 pastith
         * @param userId the ID of the current user
1208 14ad7326 pastith
         * @param fileId the ID of the file header
1209 14ad7326 pastith
         * @param version the version number
1210 14ad7326 pastith
         * @return the file body
1211 14ad7326 pastith
         * @throws ObjectNotFoundException if the user file or version
1212 14ad7326 pastith
         *                         were not found
1213 14ad7326 pastith
         * @throws InsufficientPermissionsException if the user does not
1214 14ad7326 pastith
         *                         have enough privileges for reading this file
1215 14ad7326 pastith
         */
1216 14ad7326 pastith
        public FileBodyDTO getFileVersion(Long userId, Long fileId, int version) throws ObjectNotFoundException, InsufficientPermissionsException;
1217 14ad7326 pastith
1218 3eaf782f pastith
        /**
1219 3eaf782f pastith
         * Search the system for a user with the specified email address.
1220 3eaf782f pastith
         * If no such user is found, the method returns null.
1221 3eaf782f pastith
         */
1222 3eaf782f pastith
        public User findUserByEmail(String email);
1223 3eaf782f pastith
1224 3eaf782f pastith
        /**
1225 3eaf782f pastith
         * Update the user with the values from the supplied object.
1226 3eaf782f pastith
         */
1227 3eaf782f pastith
        public void updateUser(User user);
1228 8f128261 droutsis
1229 8f128261 droutsis
        /**
1230 8f128261 droutsis
         * Update accounting information for given user.
1231 8f128261 droutsis
         *
1232 8f128261 droutsis
         * @param user The user to update
1233 8f128261 droutsis
         * @param date Date of transaction
1234 8f128261 droutsis
         * @param bandwidthDiff Bandwidth used; positive for addition,
1235 8f128261 droutsis
         * negative for subtraction (e.g. to rollback)
1236 8f128261 droutsis
         */
1237 8f128261 droutsis
        public void updateAccounting(User user, Date date, long bandwidthDiff);
1238 77f75ac4 pastith
1239 77f75ac4 pastith
        /**
1240 77f75ac4 pastith
         * Check if the user with the specified ID has permission to read the
1241 77f75ac4 pastith
         * folder with the supplied ID.
1242 77f75ac4 pastith
         */
1243 77f75ac4 pastith
        public boolean canReadFolder(Long userId, Long folderId) throws ObjectNotFoundException;
1244 3ef7b691 Dimitris Routsis
1245 3ef7b691 Dimitris Routsis
        /**
1246 3ef7b691 Dimitris Routsis
         * Reset WebDAV password for given user.
1247 3ef7b691 Dimitris Routsis
         *
1248 3ef7b691 Dimitris Routsis
         * @param userId
1249 3ef7b691 Dimitris Routsis
         * @return the new password
1250 3ef7b691 Dimitris Routsis
         * @throws ObjectNotFoundException
1251 3ef7b691 Dimitris Routsis
         */
1252 3ef7b691 Dimitris Routsis
        public String resetWebDAVPassword(Long userId) throws ObjectNotFoundException;
1253 3ef7b691 Dimitris Routsis
1254 14ad7326 pastith
}