Statistics
| Branch: | Tag: | Revision:

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

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