Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (50.6 kB)

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