Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (50.1 kB)

1
/*
2
 * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd.
3
 *
4
 * This file is part of GSS.
5
 *
6
 * GSS is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * GSS is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with GSS.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
package gr.ebs.gss.server.ejb;
20

    
21
import gr.ebs.gss.client.exceptions.DuplicateNameException;
22
import gr.ebs.gss.client.exceptions.GSSIOException;
23
import gr.ebs.gss.client.exceptions.InsufficientPermissionsException;
24
import gr.ebs.gss.client.exceptions.ObjectNotFoundException;
25
import gr.ebs.gss.client.exceptions.QuotaExceededException;
26
import gr.ebs.gss.server.domain.FileUploadStatus;
27
import gr.ebs.gss.server.domain.Nonce;
28
import gr.ebs.gss.server.domain.User;
29
import gr.ebs.gss.server.domain.dto.FileBodyDTO;
30
import gr.ebs.gss.server.domain.dto.FileHeaderDTO;
31
import gr.ebs.gss.server.domain.dto.FolderDTO;
32
import gr.ebs.gss.server.domain.dto.GroupDTO;
33
import gr.ebs.gss.server.domain.dto.PermissionDTO;
34
import gr.ebs.gss.server.domain.dto.StatsDTO;
35
import gr.ebs.gss.server.domain.dto.UserDTO;
36

    
37
import java.io.File;
38
import java.io.IOException;
39
import java.io.InputStream;
40
import java.util.Date;
41
import java.util.List;
42
import java.util.Set;
43

    
44
import javax.ejb.Local;
45
import javax.ejb.TransactionAttribute;
46
import javax.ejb.TransactionAttributeType;
47

    
48
/**
49
 * The External API for GSS clients.
50
 *
51
 * @author past
52
 */
53
@Local
54
public interface ExternalAPI {
55

    
56
        /**
57
         * Retrieves the root folder for the specified user. The caller must ensure
58
         * that the userId exists.
59
         *
60
         * @param userId
61
         * @return Folder
62
         * @throws ObjectNotFoundException if no Folder or user was found
63
         */
64
        public FolderDTO getRootFolder(Long userId) throws ObjectNotFoundException;
65

    
66
        /**
67
         * Retrieve the folder with the specified ID.
68
         *
69
         * @param userId the ID of the current user
70
         * @param folderId the ID of the folder to retrieve
71
         * @return the folder found
72
         * @throws ObjectNotFoundException if the folder or the user was not found
73
         * @throws InsufficientPermissionsException if ther user does not have read permissions for folder
74
         */
75
        public FolderDTO getFolder(Long userId, Long folderId) throws ObjectNotFoundException,
76
                        InsufficientPermissionsException;
77

    
78
        /**
79
         * Returns the user with the specified ID.
80
         *
81
         * @param userId The ID of the User to be found
82
         * @return The User object
83
         * @throws ObjectNotFoundException if the user cannot be found
84
         */
85
        public User getUser(Long userId) throws ObjectNotFoundException;
86

    
87
        /**
88
         * Returns the user with the specified ID.
89
         *
90
         * @param userId The ID of the User to be found
91
         * @return The User object
92
         * @throws ObjectNotFoundException if the user cannot be found
93
         */
94
        public UserDTO getUserDTO(Long userId) throws ObjectNotFoundException;
95

    
96
        /**
97
         * Returns the group with the specified ID.
98
         *
99
         * @param groupId The ID of the Group to be found
100
         * @return The Group object
101
         * @throws ObjectNotFoundException if the group cannot be found
102
         */
103
        public GroupDTO getGroup(Long groupId) throws ObjectNotFoundException;
104

    
105
        /**
106
         * Returns the group with the specified name that belongs to the
107
         * specified user.
108
         *
109
         * @param userId the ID of the user
110
         * @param name the name of the group
111
         * @return The Group object
112
         * @throws ObjectNotFoundException if the group cannot be found
113
         */
114
        public GroupDTO getGroup(Long userId, String name) throws ObjectNotFoundException;
115

    
116
        /**
117
         * Retrieve the list of groups for a particular user.
118
         *
119
         * @param userId the ID of the User
120
         * @return a List of Groups that belong to the specified User
121
         * @throws ObjectNotFoundException if the user was not found
122
         */
123
        public List<GroupDTO> getGroups(Long userId) throws ObjectNotFoundException;
124

    
125
        /**
126
         * Returns a list of files contained in the folder specified by its id.
127
         *
128
         * @param userId the ID of the User
129
         * @param folderId the ID of the folder containing the files
130
         * @param ignoreDeleted
131
         * @return the list of file header objects
132
         * @throws ObjectNotFoundException if the user or the folder cannot be found
133
         * @throws InsufficientPermissionsException
134
         */
135
        public List<FileHeaderDTO> getFiles(Long userId, Long folderId, boolean ignoreDeleted) throws ObjectNotFoundException,
136
                        InsufficientPermissionsException;
137

    
138
        /**
139
         * Returns a list of users for the specified group
140
         *
141
         * @param userId the ID of the User
142
         * @param groupId the ID of the requested group
143
         * @return List<UserDTO>
144
         * @throws ObjectNotFoundException if the user or group was not found, with
145
         *             the exception message mentioning the precise problem
146
         */
147
        public List<UserDTO> getUsers(Long userId, Long groupId) throws ObjectNotFoundException;
148

    
149
        /**
150
         * Returns a list of users matching the specified username
151
         *
152
         * @param username the username of the User
153
         * @return List<UserDTO>
154
         */
155
        public List<UserDTO> getUsersByUserNameLike(String username);
156

    
157
        /**
158
         * Creates a new folder with the specified owner, parent folder and name.
159
         * New folder has the same permissions as its parent
160
         *
161
         * @param userId
162
         * @param parentId
163
         * @param name
164
         * @return the new folder
165
         * @throws DuplicateNameException if the specified name already exists in
166
         *             the parent folder, as either a folder or file
167
         * @throws ObjectNotFoundException if the user or parent folder was not
168
         *             found, with the exception message mentioning the precise
169
         *             problem
170
         * @throws InsufficientPermissionsException
171
         */
172
        public FolderDTO createFolder(Long userId, Long parentId, String name) throws DuplicateNameException,
173
                        ObjectNotFoundException, InsufficientPermissionsException;
174

    
175
        /**
176
         * Deletes the specified folder, if the specified user has the appropriate
177
         * permission.
178
         *
179
         * @param userId the ID of the current user
180
         * @param folderId the ID of the folder to delete
181
         * @throws InsufficientPermissionsException if the user does not have the
182
         *             appropriate privileges
183
         * @throws ObjectNotFoundException if the user or folder was not found, with
184
         *             the exception message mentioning the precise problem
185
         */
186
        public void deleteFolder(Long userId, Long folderId)
187
                        throws InsufficientPermissionsException, ObjectNotFoundException;
188

    
189
        /**
190
         * Retrieve the subfolders of the specified folder.
191
         *
192
         * @param userId the ID of the current user
193
         * @param folderId the ID of the folder to retrieve
194
         * @return the list of subfolders found
195
         * @throws ObjectNotFoundException if the folder or user was not found
196
         * @throws InsufficientPermissionsException
197
         */
198
        public List<FolderDTO> getSubfolders(Long userId, Long folderId)
199
                        throws ObjectNotFoundException, InsufficientPermissionsException;
200

    
201
        /**
202
         * Retrieve the folder with the specified ID with subfolders.
203
         *
204
         * @param userId the ID of the current user
205
         * @param folderId the ID of the folder to retrieve
206
         * @return the folder found
207
         * @throws ObjectNotFoundException if the folder or the user was not found
208
         * @throws InsufficientPermissionsException if ther user does not have read permissions for folder
209
         */
210
        public FolderDTO getFolderWithSubfolders(Long userId, Long folderId)
211
                        throws ObjectNotFoundException, InsufficientPermissionsException;
212

    
213
        /**
214
         * Retrieve the folder with the specified ID with subfolders.
215
         *
216
         * @param userId the ID of the current user
217
         * @param callingUserId the ID of the user requesting this operation
218
         * @param folderId the ID of the folder to retrieve
219
         * @return the folder found
220
         * @throws ObjectNotFoundException if the folder or the user was not found
221
         * @throws InsufficientPermissionsException if ther user does not have read permissions for folder
222
         */
223
        public FolderDTO getFolderWithSubfolders(Long userId, Long callingUserId, Long folderId)
224
                        throws ObjectNotFoundException, InsufficientPermissionsException;
225
        /**
226
         * Retrieve the subfolders of the specified folder that are shared to others.
227
         *
228
         * @param userId the ID of the current user
229
         * @param folderId the ID of the folder to retrieve
230
         * @return the list of subfolders found
231
         * @throws ObjectNotFoundException if the folder or user was not found
232
         */
233
        public List<FolderDTO> getSharedSubfolders(Long userId, Long folderId) throws ObjectNotFoundException;
234

    
235
        /**
236
         * Retrieve the subfolders of the specified folder that are shared to others.
237
         *
238
         * @param userId the ID of the current user
239
         * @param callingUserId the id of the user requesting this operation
240
         * @param folderId the ID of the folder to retrieve
241
         * @return the list of subfolders found
242
         * @throws ObjectNotFoundException if the folder or user was not found
243
         */
244
        public List<FolderDTO> getSharedSubfolders(Long userId, Long callingUserId, Long folderId) throws ObjectNotFoundException;
245
        /**
246
         * Modifies the specified folder if the specified user has the appropriate
247
         * permission.
248
         *
249
         * @param userId the ID of the current user
250
         * @param folderId the ID of the folder to retrieve
251
         * @param folderName
252
         * @return the updated folder
253
         * @throws InsufficientPermissionsException if the user does not have the
254
         *             appropriate privileges
255
         * @throws ObjectNotFoundException if the user or folder was not found, with
256
         *             the exception message mentioning the precise problem
257
         * @throws DuplicateNameException if the specified name already exists in
258
         *             the parent folder, as either a folder or file
259
         */
260
        public FolderDTO modifyFolder(Long userId, Long folderId, String folderName)
261
                        throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException;
262

    
263
        /**
264
         * Adds a user to the specified group
265
         *
266
         * @param userId the ID of the current user
267
         * @param groupId the id of the new group
268
         * @param userToAddId the id of the user to add
269
         * @throws DuplicateNameException if the user already exists in group
270
         * @throws ObjectNotFoundException if the user or group was not found, with
271
         *             the exception message mentioning the precise problem
272
         * @throws InsufficientPermissionsException
273
         */
274
        public void addUserToGroup(Long userId, Long groupId, Long userToAddId)
275
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException;
276

    
277
        /**
278
         * Creates a new group with the specified owner and name.
279
         *
280
         * @param userId the ID of the current user
281
         * @param name the name of the new group
282
         * @throws DuplicateNameException if the new group name already exists
283
         * @throws ObjectNotFoundException if the user or group was not found, with
284
         *             the exception message mentioning the precise problem
285
         */
286
        public void createGroup(Long userId, String name) throws ObjectNotFoundException, DuplicateNameException;
287

    
288
        /**
289
         * Deletes the specified group in the specified user's namespace.
290
         *
291
         * @param userId the ID of the current user
292
         * @param groupId the ID of the group to delete
293
         * @throws ObjectNotFoundException if the user or group was not found, with
294
         *             the exception message mentioning the precise problem
295
         * @throws InsufficientPermissionsException
296
         */
297
        public void deleteGroup(Long userId, Long groupId) throws ObjectNotFoundException, InsufficientPermissionsException;
298

    
299
        /**
300
         * Creates a new file with the specified owner, parent folder and name. The
301
         * new file has the same permissions as its parent folder. The file contents
302
         * are read from the input stream to a new File object.
303
         *
304
         * @param userId the ID of the current user
305
         * @param folderId the ID of the parent folder
306
         * @param name the name of the new file
307
         * @param mimeType the MIME type of the file
308
         * @param stream the input stream with the file contents
309
         * @return The FileHeaderDTO created
310
         * @throws DuplicateNameException if the specified name already exists in
311
         *             the parent folder, as either a folder or file
312
         * @throws ObjectNotFoundException if the user or parent folder was not
313
         *             found, with the exception message mentioning the precise
314
         *             problem
315
         * @throws GSSIOException if there was an error while storing the file contents
316
         * @throws InsufficientPermissionsException
317
         * @throws QuotaExceededException
318
         */
319
        public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType,
320
                                InputStream stream) throws DuplicateNameException, ObjectNotFoundException,
321
                                GSSIOException, InsufficientPermissionsException, QuotaExceededException;
322

    
323
        /**
324
         * Deletes the specified file, provided the specified user has
325
         * the necessary permissions.
326
         *
327
         * @param userId the ID of the current user
328
         * @param fileId the ID of the file to delete
329
         * @throws ObjectNotFoundException if the user or file was not found, with
330
         *             the exception message mentioning the precise problem
331
         * @throws InsufficientPermissionsException if the user does not have the
332
         *             appropriate privileges
333
         */
334
        public void deleteFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
335

    
336
        /**
337
         * Deletes the specified file in the specified user's namespace.
338
         *
339
         * @param userId the ID of the current user
340
         * @param fileIds the IDs of the files to delete
341
         * @throws ObjectNotFoundException if the user or file was not found, with
342
         *             the exception message mentioning the precise problem
343
         * @throws InsufficientPermissionsException if the user does not have the
344
         *             appropriate privileges
345
         */
346
        public void deleteFiles(Long userId, List<Long> fileIds)
347
                        throws ObjectNotFoundException, InsufficientPermissionsException;
348

    
349
        /**
350
         * Creates a new tag for the specified user and file.
351
         *
352
         * @param userId the creator of the tag
353
         * @param fileHeaderId the file that is tagged
354
         * @param tag the tag
355
         * @throws ObjectNotFoundException if the user or the file was not found
356
         */
357
        public void createTag(Long userId, Long fileHeaderId, String tag) throws ObjectNotFoundException;
358

    
359
        /**
360
         * Returns all tags defined by the specified user
361
         *
362
         * @param userId
363
         * @return Set<String>
364
         * @throws ObjectNotFoundException if the user was null
365
         */
366
        public Set<String> getUserTags(final Long userId) throws ObjectNotFoundException;
367

    
368
        /**
369
         * Updates the attributes of the specified file.
370
         *
371
         * @param userId
372
         * @param fileId
373
         * @param name
374
         * @param tagSet a String that contains tags separated by comma
375
         * @param modificationDate the modification date
376
         * @throws ObjectNotFoundException
377
         * @throws InsufficientPermissionsException
378
         */
379
        public void updateFile(Long userId, Long fileId, String name, String tagSet, Date modificationDate)
380
                        throws ObjectNotFoundException, InsufficientPermissionsException;
381

    
382
        /**
383
         * Retrieve the contents of the current body for the file
384
         * with the specified FileHeader ID. The file contents
385
         * are provided as an InputStream from which the caller can
386
         * retrieve the raw bytes.
387
         *
388
         * @param userId the ID of the current user
389
         * @param fileId the ID of the file to retrieve
390
         * @return an InputStream from the current file body contents
391
         * @throws ObjectNotFoundException if the file or the user was not found
392
         * @throws InsufficientPermissionsException  if the user does not have the
393
         *             appropriate privileges
394
         */
395
        public InputStream getFileContents(Long userId, Long fileId)
396
                        throws ObjectNotFoundException, InsufficientPermissionsException;
397

    
398
        /**
399
         * Retrieve the contents of the  body identified by bodyId for the file
400
         * with the specified FileHeader ID. The file contents
401
         * are provided as an InputStream from which the caller can
402
         * retrieve the raw bytes.
403
         *
404
         * @param userId the ID of the current user
405
         * @param fileId the ID of the file to retrieve
406
         * @param bodyId the body ID
407
         * @return an InputStream from the current file body contents
408
         * @throws ObjectNotFoundException if the file or the user was not found
409
         * @throws InsufficientPermissionsException  if the user does not have the
410
         *             appropriate privileges
411
         */
412
        public InputStream getFileContents(Long userId, Long fileId, Long bodyId)
413
                        throws ObjectNotFoundException, InsufficientPermissionsException;
414

    
415
        /**
416
         * Retrieve the file with the specified ID.
417
         *
418
         * @param userId the ID of the current user
419
         * @param fileId the ID of the file to retrieve
420
         * @return the file found
421
         * @throws ObjectNotFoundException if the file or the user was not found, with
422
         *                         the exception message mentioning the precise problem
423
         * @throws InsufficientPermissionsException
424
         */
425
        public FileHeaderDTO getFile(Long userId, Long fileId) throws ObjectNotFoundException,
426
                        InsufficientPermissionsException;
427

    
428
        /**
429
         * Retrieve the filebody with the specified ID.
430
         *
431
         * @param userId the ID of the current user
432
         * @param fileId the ID of the file to retrieve
433
         * @param bodyId the ID of the body
434
         * @return the file found
435
         * @throws ObjectNotFoundException if the file or the user was not found, with
436
         *                         the exception message mentioning the precise problem
437
         * @throws InsufficientPermissionsException
438
         */
439
        public FileBodyDTO getFileBody(Long userId, Long fileId, Long bodyId)
440
                        throws ObjectNotFoundException, InsufficientPermissionsException;
441

    
442
        /**
443
         * Get the resource (file or folder) at the specified path in
444
         * the specified user's namespace. The returned object will be of type
445
         * FileHeaderDTO or FolderDTO.<p><strong>Note:</strong> this method does not
446
         * receive the current user as a parameter, therefore it is unable to perform
447
         * the necessary permission checks and should <strong>NOT</strong> be directly
448
         * exposed to remote clients. It is the caller's responsibility to verify that
449
         * the calling user has the required privileges for performing any subsequent
450
         * action on the resource through one of the other ExternalAPI methods.
451
         *
452
         * @param ownerId the ID of the user owning the namespace
453
         * @param path the absolute path in the user's namespace
454
         * @param ignoreDeleted if true, resources that have been moved to the trash
455
         *                         will be ignored
456
         * @throws ObjectNotFoundException if the user or resource was not found, with
457
         *                         the exception message mentioning the precise problem
458
         * @return the resource found
459
         */
460
        public Object getResourceAtPath(Long ownerId, String path, boolean ignoreDeleted)
461
                        throws ObjectNotFoundException;
462

    
463
        /**
464
         * Copy the provided file to the specified destination.
465
         *
466
         * @param userId the ID of the current user
467
         * @param fileId the IF of the provided file
468
         * @param dest the path of the new resource
469
         * @throws ObjectNotFoundException if the user, file or destination was not
470
         *                         found, with        the exception message mentioning the precise problem
471
         * @throws DuplicateNameException if the specified name already exists in
472
         *          the destination folder, as either a folder or file
473
         * @throws GSSIOException if there was an error while accessing the file contents
474
         * @throws InsufficientPermissionsException
475
         * @throws QuotaExceededException
476
         */
477
        public void copyFile(Long userId, Long fileId, String dest) throws ObjectNotFoundException,
478
                        DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
479

    
480
        /**
481
         * Copy the provided file to the specified destination.
482
         *
483
         * @param userId the ID of the current user
484
         * @param ownerId the ID of the owner of the destination namespace
485
         * @param fileId the IF of the provided file
486
         * @param dest the path of the new resource
487
         * @throws ObjectNotFoundException if the user, file or destination was not
488
         *                         found, with        the exception message mentioning the precise problem
489
         * @throws DuplicateNameException if the specified name already exists in
490
         *          the destination folder, as either a folder or file
491
         * @throws GSSIOException if there was an error while accessing the file contents
492
         * @throws InsufficientPermissionsException
493
         * @throws QuotaExceededException
494
         */
495
        public void copyFileToPath(Long userId, Long ownerId, Long fileId, String dest) throws ObjectNotFoundException,
496
                        DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
497

    
498
        /**
499
         * Copy the provided file to the specified destination.
500
         *
501
         * @param userId the ID of the current user
502
         * @param fileIds the IDs of the provided files
503
         * @param destId the ID of the destination folder
504
         * @throws ObjectNotFoundException if the user, file or destination was not
505
         *                         found, with        the exception message mentioning the precise problem
506
         * @throws GSSIOException if there was an error while accessing the file contents
507
         * @throws DuplicateNameException if the specified name already exists in
508
         *          the destination folder, as either a folder or file
509
         * @throws InsufficientPermissionsException
510
         * @throws QuotaExceededException
511
         */
512
        public void copyFiles(Long userId, List<Long> fileIds, Long destId)
513
                        throws ObjectNotFoundException, DuplicateNameException, GSSIOException,
514
                        InsufficientPermissionsException, QuotaExceededException;
515

    
516
        /**
517
         * Copy the provided file to the specified destination.
518
         *
519
         * @param userId the ID of the current user
520
         * @param fileId the IF of the provided file
521
         * @param destId the ID of the destination folder
522
         * @param destName the name of the new file
523
         * @throws ObjectNotFoundException if the user, file or destination was not
524
         *                         found, with        the exception message mentioning the precise problem
525
         * @throws GSSIOException if there was an error while accessing the file contents
526
         * @throws DuplicateNameException if the specified name already exists in
527
         *          the destination folder, as either a folder or file
528
         * @throws InsufficientPermissionsException
529
         * @throws QuotaExceededException
530
         */
531
        public void copyFile(Long userId, Long fileId, Long destId, String destName)
532
                        throws ObjectNotFoundException, DuplicateNameException, GSSIOException,
533
                        InsufficientPermissionsException, QuotaExceededException;
534

    
535
        /**
536
         * Copy the provided folder to the specified destination.
537
         *
538
         * @param userId the ID of the current user
539
         * @param folderId the IF of the provided folder
540
         * @param dest the path of the new folder
541
         * @throws ObjectNotFoundException if the user, folder or destination was not
542
         *                         found, with        the exception message mentioning the precise problem
543
         * @throws DuplicateNameException if the specified name already exists in
544
         *          the destination folder, as either a folder or file
545
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
546
         *          appropriate privileges
547
         */
548
        public void copyFolder(Long userId, Long folderId, String dest) throws ObjectNotFoundException,
549
                        DuplicateNameException, InsufficientPermissionsException;
550

    
551
        /**
552
         * Copy the provided folder to the specified destination.
553
         *
554
         * @param userId the ID of the current user
555
         * @param folderId the IF of the provided folder
556
         * @param destId the ID of the destination folder
557
         * @param destName the name of the new folder
558
         * @throws ObjectNotFoundException if the user, folder or destination was not
559
         *                         found, with        the exception message mentioning the precise problem
560
         * @throws DuplicateNameException if the specified name already exists in
561
         *          the destination folder, as either a folder or file
562
         * @throws InsufficientPermissionsException InsufficientPermissionsException
563
         *                         if the user does not have the appropriate privileges
564
         */
565
        public void copyFolder(Long userId, Long folderId, Long destId, String destName)
566
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException;
567

    
568
        /**
569
         * Copy the provided folder and all its subfolders and files to the specified destination.
570
         *
571
         * @param userId the ID of the current user
572
         * @param ownerId the ID of the owner of the destination namespace
573
         * @param folderId the IF of the provided folder
574
         * @param dest the path of the new folder
575
         * @throws ObjectNotFoundException if the user, folder or destination was not
576
         *                         found, with        the exception message mentioning the precise problem
577
         * @throws DuplicateNameException if the specified name already exists in
578
         *          the destination folder, as either a folder or file
579
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
580
         *          appropriate privileges
581
         * @throws QuotaExceededException if the user quota limit would be exceeded
582
         * @throws GSSIOException if there was an error while accessing the file contents
583
         */
584
        public void copyFolderStructureToPath(Long userId, Long ownerId, Long folderId, String dest) throws ObjectNotFoundException,
585
                        DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
586

    
587
        /**
588
         * Copy the provided folder and all its subfolders and files to the specified destination.
589
         *
590
         * @param userId the ID of the current user
591
         * @param folderId the IF of the provided folder
592
         * @param destId the ID of the destination folder
593
         * @param destName the name of the new folder
594
         * @throws ObjectNotFoundException if the user, folder or destination was not
595
         *                         found, with        the exception message mentioning the precise problem
596
         * @throws DuplicateNameException if the specified name already exists in
597
         *          the destination folder, as either a folder or file
598
         * @throws InsufficientPermissionsException InsufficientPermissionsException
599
         *                         if the user does not have the appropriate privileges
600
         * @throws GSSIOException if there was an error while accessing the file contents
601
         * @throws QuotaExceededException if the user quota limit would be exceeded
602
         */
603
        public void copyFolderStructure(Long userId, Long folderId, Long destId, String destName)
604
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,
605
                        GSSIOException, QuotaExceededException;
606

    
607
        /**
608
         * Marks  the specified file as deleted in the specified user's namespace.
609
         *
610
         * @param userId the ID of the current user
611
         * @param fileId the ID of the file to delete
612
         * @throws ObjectNotFoundException if the user or file was not found, with
613
         *             the exception message mentioning the precise problem
614
         * @throws InsufficientPermissionsException if the user does not have the
615
         *             appropriate privileges
616
         */
617
        public void moveFileToTrash(Long userId, Long fileId) throws ObjectNotFoundException,
618
                        InsufficientPermissionsException;
619

    
620
        /**
621
         * Marks  the specified deleted file as undeleted in the specified user's namespace.
622
         *
623
         * @param userId the ID of the current user
624
         * @param fileId the ID of the file to undelete
625
         * @throws ObjectNotFoundException if the user or file was not found, with
626
         *             the exception message mentioning the precise problem
627
         * @throws InsufficientPermissionsException if the user does not have the
628
         *             appropriate privileges
629
         *
630
         */
631
        public void removeFileFromTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
632

    
633
        /**
634
         * Marks  the specified files as deleted in the specified user's namespace.
635
         *
636
         * @param userId the ID of the current user
637
         * @param fileIds the IDs of the file to delete
638
         * @throws ObjectNotFoundException if the user or file was not found, with
639
         *             the exception message mentioning the precise problem
640
         * @throws InsufficientPermissionsException if the user does not have the
641
         *             appropriate privileges
642
         */
643
        public void moveFilesToTrash(Long userId, List<Long> fileIds)
644
                        throws ObjectNotFoundException, InsufficientPermissionsException;
645

    
646
        /**
647
         * Marks  the specified deleted files as undeleted in the specified user's namespace.
648
         *
649
         * @param userId the ID of the current user
650
         * @param fileIds the IDs of the file to undelete
651
         * @throws ObjectNotFoundException if the user or file was not found, with
652
         *             the exception message mentioning the precise problem
653
         * @throws InsufficientPermissionsException if the user does not have the
654
         *             appropriate privileges
655
         */
656
        public void removeFilesFromTrash(Long userId, List<Long> fileIds) throws ObjectNotFoundException, InsufficientPermissionsException;
657

    
658
        /**
659
         * Marks  the specified folder as deleted in the specified user's namespace.
660
         *
661
         * @param userId the ID of the current user
662
         * @param folderId the ID of the folder to delete
663
         * @throws ObjectNotFoundException if the user or file was not found, with
664
         *             the exception message mentioning the precise problem
665
         * @throws InsufficientPermissionsException if the user does not have the
666
         *             appropriate privileges
667
         */
668
        public void moveFolderToTrash(Long userId, Long folderId)
669
                        throws ObjectNotFoundException, InsufficientPermissionsException;
670

    
671
        /**
672
         * Marks  the specified deleted folder as undeleted in the specified user's namespace.
673
         *
674
         * @param userId the ID of the current user
675
         * @param folderId the ID of the folder to undelete
676
         * @throws ObjectNotFoundException if the user or file was not found, with
677
         *             the exception message mentioning the precise problem
678
         * @throws InsufficientPermissionsException if the user does not have the
679
         *          appropriate privileges
680
         *
681
         */
682
        public void removeFolderFromTrash(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
683

    
684
        /**
685
         * Move the provided folder and all its subfolders and files to the specified destination.
686
         *
687
         * @param userId the ID of the current user
688
         * @param folderId the IF of the provided folder
689
         * @param destId the ID of the destination folder
690
         * @param destName the name of the new folder
691
         * @throws ObjectNotFoundException if the user, folder or destination was not
692
         *                         found, with        the exception message mentioning the precise problem
693
         * @throws DuplicateNameException if the specified name already exists in
694
         *          the destination folder, as either a folder or file
695
         * @throws InsufficientPermissionsException if the user does not have the
696
         *          appropriate privileges
697
         * @throws GSSIOException
698
         * @throws QuotaExceededException
699
         */
700
        public void moveFolder(Long userId, Long folderId, Long destId, String destName)
701
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,
702
                        GSSIOException, QuotaExceededException;
703

    
704
        /**
705
         * Move the provided folder and all its subfolders and files to the specified destination.
706
         *
707
         * @param userId the ID of the current user
708
         * @param ownerId the owner of the destination namespace
709
         * @param folderId the IF of the provided folder
710
         * @param dest the path of the new folder
711
         * @throws ObjectNotFoundException if the user, folder or destination was not
712
         *                         found, with        the exception message mentioning the precise problem
713
         * @throws DuplicateNameException if the specified name already exists in
714
         *          the destination folder, as either a folder or file
715
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
716
         *          appropriate privileges
717
         * @throws GSSIOException
718
         * @throws QuotaExceededException
719
         */
720
        public void moveFolderToPath(Long userId, Long ownerId, Long folderId, String dest) throws ObjectNotFoundException,
721
                        DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
722

    
723
        /**
724
         * Move the provided file to the specified destination.
725
         *
726
         * @param userId the ID of the current user
727
         * @param fileId the IF of the provided file
728
         * @param destId the ID of the destination folder
729
         * @param destName the name of the new file
730
         * @throws InsufficientPermissionsException
731
         * @throws ObjectNotFoundException if the user, file or destination was not
732
         *                         found, with        the exception message mentioning the precise problem
733
         * @throws GSSIOException if there was an error while accessing the file contents
734
         * @throws DuplicateNameException if the specified name already exists in
735
         *          the destination folder, as either a folder or file
736
         * @throws QuotaExceededException
737
         */
738
        public void moveFile(Long userId, Long fileId, Long destId, String destName)
739
                        throws InsufficientPermissionsException, ObjectNotFoundException,
740
                        DuplicateNameException, GSSIOException, QuotaExceededException;
741

    
742
        /**
743
         * Move the provided file to the specified destination.
744
         *
745
         * @param userId the ID of the current user
746
         * @param ownerId the owner of the destination namespace
747
         * @param fileId the IF of the provided file
748
         * @param dest the path of the new file
749
         * @throws InsufficientPermissionsException
750
         * @throws ObjectNotFoundException if the user, file or destination was not
751
         *                         found, with        the exception message mentioning the precise problem
752
         * @throws GSSIOException if there was an error while accessing the file contents
753
         * @throws DuplicateNameException if the specified name already exists in
754
         *          the destination folder, as either a folder or file
755
         * @throws QuotaExceededException
756
         */
757
        public void moveFileToPath(Long userId, Long ownerId, Long fileId, String dest) throws ObjectNotFoundException, InsufficientPermissionsException, DuplicateNameException, GSSIOException, QuotaExceededException;
758

    
759
        /**
760
         * move the provided file to the specified destination.
761
         *
762
         * @param userId the ID of the current user
763
         * @param fileIds the IDs of the provided files
764
         * @param destId the ID of the destination folder
765
         * @throws InsufficientPermissionsException
766
         * @throws ObjectNotFoundException if the user, file or destination was not
767
         *                         found, with        the exception message mentioning the precise problem
768
         * @throws GSSIOException if there was an error while accessing the file contents
769
         * @throws DuplicateNameException if the specified name already exists in
770
         *          the destination folder, as either a folder or file
771
         * @throws QuotaExceededException
772
         */
773
        public void moveFiles(Long userId, List<Long> fileIds, Long destId)
774
                        throws InsufficientPermissionsException, ObjectNotFoundException,
775
                        DuplicateNameException, GSSIOException, QuotaExceededException;
776

    
777
        /**
778
         * Returns a list of All deleted files of a user.
779
         *
780
         * @param userId the ID of the User
781
         *          * @return the list of deleted file header objects
782
         * @throws ObjectNotFoundException if the user cannot be found
783
         */
784
        public List<FileHeaderDTO> getDeletedFiles(Long userId) throws ObjectNotFoundException;
785

    
786
        /**
787
         * Returns a list of All deleted root folders of a user.
788
         *
789
         * @param userId the ID of the User
790
         *          * @return the list of deleted file header objects
791
         * @throws ObjectNotFoundException if the user cannot be found
792
         */
793
        public List<FolderDTO> getDeletedRootFolders(Long userId) throws ObjectNotFoundException;
794

    
795
        /**
796
         * Empty Trash by deleting all marked as deleted files and folders
797
         * @param userId
798
         * @throws ObjectNotFoundException if something goes wrong in the delete process
799
         * @throws InsufficientPermissionsException if something goes wrong in the delete process
800
         */
801
        public void emptyTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
802

    
803
        /**
804
         * Restores All Trashed Items by undeleting all marked as deleted files and folders
805
         * @param userId
806
         * @throws ObjectNotFoundException if something goes wrong in the delete process
807
         * @throws InsufficientPermissionsException
808
         */
809
        public void restoreTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
810

    
811
        /**
812
         * Search the system for a user with the specified username.
813
         * If no such user is found, the method returns null.
814
         *
815
         * @param username the username to search for
816
         * @return the User object with the specified username
817
         */
818
        public User findUser(String username);
819

    
820
        /**
821
         * Create a new user with the specified name, username and e-mail address.
822
         *
823
         * @param username the username of the new user
824
         * @param name the full name of the new user
825
         * @param mail the e-mail of the new user
826
         * @return the newly-created User object
827
         * @throws DuplicateNameException if a user with the same username already exists
828
         * @throws ObjectNotFoundException if no username was provided
829
         */
830
        public User createUser(String username, String name, String mail)
831
                        throws DuplicateNameException, ObjectNotFoundException;
832

    
833
        /**
834
         * Update the user with the specified username with the provided name
835
         * and e-mail address.
836
         *
837
         * @param username the username of the user
838
         * @param name the modified full name of the user
839
         * @param mail the modified e-mail of the user
840
         * @return the updated User object
841
         * @throws ObjectNotFoundException if no username was provided
842
         */
843
        public User updateUser(String username, String name, String mail) throws ObjectNotFoundException;
844

    
845
        /**
846
         * Updates the authentication token for the specified user.
847
         *
848
         * @param userId the ID of the user whose token should be updated
849
         * @return the updated user
850
         * @throws ObjectNotFoundException if the user could not be found
851
         */
852
        public User updateUserToken(Long userId) throws ObjectNotFoundException;
853

    
854
        /**
855
         * Updates the policy acceptance flag for the specified user.
856
         *
857
         * @param userId the ID of the user whose flag should be updated
858
         * @param isAccepted the new value of the flag
859
         * @return the updated user
860
         * @throws ObjectNotFoundException if the user could not be found
861
         */
862
        public User updateUserPolicyAcceptance(Long userId, boolean isAccepted) throws ObjectNotFoundException;
863

    
864
        /**
865
         * Invalidates the authentication token for the specified user.
866
         *
867
         * @param userId the ID of the user whose token should be updated
868
         * @throws ObjectNotFoundException if the user could not be found
869
         */
870
        public void invalidateUserToken(Long userId) throws ObjectNotFoundException;
871

    
872
        /**
873
         * Retrieve folder user and group permissions
874
         *
875
         * @param userId the ID of the user whose token should be updated
876
         * @param folderId the ID of the folder
877
         * @return the Set of permissions from requested folder
878
         * @throws ObjectNotFoundException if the user or folder could not be found
879
         * @throws InsufficientPermissionsException
880
         */
881
        public Set<PermissionDTO> getFolderPermissions(Long userId, Long folderId)
882
                        throws ObjectNotFoundException, InsufficientPermissionsException;
883

    
884
        /**
885
         * update folder permissions
886
         * @param userId
887
         * @param folderId
888
         * @param permissions
889
         * @throws ObjectNotFoundException
890
         * @throws InsufficientPermissionsException
891
         */
892
        public void setFolderPermissions(Long userId, Long folderId, Set<PermissionDTO> permissions)
893
                        throws ObjectNotFoundException, InsufficientPermissionsException;
894

    
895
        /**
896
         * Retrieve file user and group permissions
897
         *
898
         * @param userId the ID of the user whose token should be updated
899
         * @param fileId the ID of the folder
900
         * @return the Set of permissions from requested folder
901
         * @throws ObjectNotFoundException if the user or folder could not be found
902
         * @throws InsufficientPermissionsException
903
         */
904
        public Set<PermissionDTO> getFilePermissions(Long userId, Long fileId)
905
                        throws ObjectNotFoundException, InsufficientPermissionsException;
906

    
907

    
908
        /**
909
         * update file permissions
910
         * @param userId
911
         * @param fileId
912
         * @param readForAll
913
         * @param permissions
914
         * @throws ObjectNotFoundException
915
         * @throws InsufficientPermissionsException
916
         */
917
        public void setFilePermissions(Long userId, Long fileId, Boolean readForAll,
918
                                Set<PermissionDTO> permissions)
919
                        throws ObjectNotFoundException, InsufficientPermissionsException;
920

    
921
        /**
922
         * Returns a list of all shared root folders of a user.
923
         *
924
         * @param userId the ID of the User
925
         * @return the list of shared root folders
926
         * @throws ObjectNotFoundException if the user cannot be found
927
         */
928
        public List<FolderDTO> getSharedRootFolders(Long userId) throws ObjectNotFoundException;
929

    
930
        /**
931
         * Returns a list of all shared files of a user that are not
932
         * inside other shared folders.
933
         *
934
         * @param userId the ID of the User
935
         * @return the list of shared files
936
         * @throws ObjectNotFoundException if the user cannot be found
937
         */
938
        public List<FileHeaderDTO> getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException;
939

    
940
        /**
941
         * Returns a list of all shared files of a user.
942
         *
943
         * @param userId the ID of the User
944
         * @return the list of shared files
945
         * @throws ObjectNotFoundException if the user cannot be found
946
         */
947
        public List<FileHeaderDTO> getSharedFiles(Long userId) throws ObjectNotFoundException;
948

    
949
        /**
950
         * Returns a list of all shared folders of a user.
951
         *
952
         * @param userId the ID of the User
953
         * @return the list of shared folders
954
         * @throws ObjectNotFoundException if the user cannot be found
955
         */
956
        public List<FolderDTO> getSharedFolders(Long userId) throws ObjectNotFoundException;
957

    
958
        /**
959
         * Returns a list of all shared root folders of a user that calling
960
         * user has at least read permissions.
961
         *
962
         * @param ownerId the ID of the User
963
         * @return the list of shared root folders
964
         * @param callingUserId
965
         *
966
         * @throws ObjectNotFoundException if the user cannot be found
967
         */
968
        public List<FolderDTO> getSharedRootFolders(Long ownerId, Long callingUserId)
969
                        throws ObjectNotFoundException;
970

    
971
        /**
972
         * Returns a list of all shared  files of a user that calling user has
973
         * at least read permissions..
974
         *
975
         * @param ownerId the ID of the User
976
         * @return the list of shared files
977
         * @param callingUserId
978
         * @throws ObjectNotFoundException if the user cannot be found
979
         */
980
        public List<FileHeaderDTO> getSharedFiles(Long ownerId, Long callingUserId)
981
                        throws ObjectNotFoundException;
982

    
983
        /**
984
         * Remove a user member from a group
985
         *
986
         * @param userId the ID of the User owning the group
987
         * @param groupId the ID of the requested group
988
         * @param memberId the ID of the member to be removed
989
         *
990
         * @throws ObjectNotFoundException if the user or group was not found, with
991
         *             the exception message mentioning the precise problem
992
         * @throws InsufficientPermissionsException
993
         */
994
        public void removeMemberFromGroup(Long userId, Long groupId, Long memberId)
995
                        throws ObjectNotFoundException, InsufficientPermissionsException;
996

    
997
        /**
998
         * Retrieves the list of users sharing files to user identified by user id
999
         * @param userId
1000
         * @return the List of users sharing files to user
1001
         * @throws ObjectNotFoundException
1002
         */
1003
        public List<UserDTO> getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException;
1004

    
1005
        /**
1006
         * Search Files
1007
         *
1008
         * @param userId
1009
         * @param query
1010
         * @return list of files that match query
1011
         * @throws ObjectNotFoundException if no user or query was specified
1012
         */
1013
        public List<FileHeaderDTO> searchFiles(Long userId, String query) throws ObjectNotFoundException;
1014

    
1015
        /**
1016
         * Creates a nonce for the specified user.
1017
         *
1018
         * @param userId the ID of the user
1019
         * @return the new nonce
1020
         * @throws ObjectNotFoundException if the user could not be found
1021
         */
1022
        public Nonce createNonce(Long userId) throws ObjectNotFoundException;
1023

    
1024
        /**
1025
         * Find the nonce object for the specified encoded nonce, that should be
1026
         * associated with the specified user.
1027
         *
1028
         * @param nonce the issued nonce in Base64 encoding
1029
         * @param userId the ID of the user for whom this nonce should have been issued
1030
         * @return the retrieved nonce object
1031
         * @throws ObjectNotFoundException if the nonce or user were not found
1032
         */
1033
        public Nonce getNonce(String nonce, Long userId) throws ObjectNotFoundException;
1034

    
1035
        /**
1036
         * Remove the specified nonce from the persistent store.
1037
         *
1038
         * @param id the ID of the nonce
1039
         * @throws ObjectNotFoundException if the specified nonce could not be found
1040
         */
1041
        public void removeNonce(Long id) throws ObjectNotFoundException;
1042

    
1043
        /**
1044
         * Activate the supplied nonce for the specified user.
1045
         *
1046
         * @param userId the ID of the user
1047
         * @param nonce the nonce to activate
1048
         * @param nonceExpiryDate the expiry date of the nonce
1049
         * @throws ObjectNotFoundException
1050
         */
1051
        public void activateUserNonce(Long userId, String nonce, Date nonceExpiryDate) throws ObjectNotFoundException;
1052

    
1053
        /**
1054
         * Retrieves user statistics.
1055
         *
1056
         * @param userId the ID of the user
1057
         * @return the statistics
1058
         * @throws ObjectNotFoundException
1059
         *
1060
         */
1061
        public StatsDTO getUserStatistics(Long userId) throws ObjectNotFoundException;
1062

    
1063
        /**
1064
         * Retrieves file versions
1065
         *
1066
         * @param userId the ID of the user
1067
         * @param fileId the ID of the file
1068
         * @return the list of filebodies
1069
         * @throws ObjectNotFoundException
1070
         * @throws InsufficientPermissionsException
1071
         *
1072
         */
1073
        public List<FileBodyDTO> getVersions(Long userId, Long fileId)
1074
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1075

    
1076
        /**
1077
         * Restore the file contents to the specified version.
1078
         *
1079
         * @param userId the ID of the user
1080
         * @param fileId the ID of the file
1081
         * @param version the version number of the desired file contents
1082
         * @throws ObjectNotFoundException if the user or file was not
1083
         *                         found, with        the exception message mentioning the precise problem
1084
         * @throws InsufficientPermissionsException if the user does not have the
1085
         *          appropriate privileges
1086
         * @throws QuotaExceededException if the user quota limit would be exceeded
1087
         * @throws GSSIOException if there was an error while accessing the file contents
1088
         */
1089
        public void restoreVersion(Long userId, Long fileId, int version)
1090
                        throws ObjectNotFoundException, InsufficientPermissionsException,  GSSIOException, QuotaExceededException;
1091

    
1092
        /**
1093
         * Remove file version identified by bodyId
1094
         *
1095
         * @param userId the ID of the user
1096
         * @param fileId the ID of the file
1097
         * @param bodyId the ID of the body
1098
         *
1099
         * @throws ObjectNotFoundException
1100
         * @throws InsufficientPermissionsException
1101
         *
1102
         */
1103
        public void removeVersion(Long userId, Long fileId, Long bodyId)
1104
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1105

    
1106
        /**
1107
         * Removes all old file versions for specified file keeping only the current revision
1108
         *
1109
         * @param userId the ID of the user
1110
         * @param fileId the ID of the file
1111
         *
1112
         * @throws ObjectNotFoundException
1113
         * @throws InsufficientPermissionsException
1114
         *
1115
         */
1116
        public void removeOldVersions(Long userId, Long fileId)
1117
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1118

    
1119
        /**
1120
         * Toggle between file being versioned or not.
1121
         *
1122
         * @param userId the ID of the user
1123
         * @param fileId the ID of the file
1124
         * @param versioned the new value of the flag
1125
         *
1126
         * @throws ObjectNotFoundException
1127
         * @throws InsufficientPermissionsException
1128
         *
1129
         */
1130
        public void toggleFileVersioning(Long userId, Long fileId, boolean versioned)
1131
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1132

    
1133
        /**
1134
         * It is used by the Solr mbean to rebuild the index.
1135
         */
1136
        public void rebuildSolrIndex();
1137

    
1138
        /**
1139
         * Creates a new file with the specified owner, parent folder and name. The
1140
         * new file has the same permissions as its parent folder. The file contents
1141
         * are already uploaded outside of externalAPI and the uploaded file is used as a parameter.
1142
         *
1143
         * @param userId the ID of the current user
1144
         * @param folderId the ID of the parent folder
1145
         * @param name the name of the new file
1146
         * @param mimeType the MIME type of the file
1147
         * @param fileSize the uploaded file size
1148
         * @param filePath the uploaded file full path
1149
         * @return The FileHeaderDTO created
1150
         * @throws DuplicateNameException if the specified name already exists in
1151
         *             the parent folder, as either a folder or file
1152
         * @throws ObjectNotFoundException if the user or parent folder was not
1153
         *             found, with the exception message mentioning the precise
1154
         *             problem
1155
         * @throws GSSIOException if there was an error while storing the file contents
1156
         * @throws InsufficientPermissionsException
1157
         * @throws QuotaExceededException
1158
         */
1159
        public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType, long fileSize, String filePath)
1160
                        throws DuplicateNameException, ObjectNotFoundException, GSSIOException,
1161
                        InsufficientPermissionsException, QuotaExceededException;
1162

    
1163
        /**
1164
         * Create a new FileBody with the supplied uploaded file as contents and make it the current body
1165
         * of the file.
1166
         *
1167
         * @param userId the ID of the current user
1168
         * @param fileId the ID of the file header object
1169
         * @param mimeType the content type of the file
1170
         * @param fileSize the uploaded file size
1171
         * @param filePath the uploaded file full path
1172
         * @return The FileHeaderDTO updated
1173
         * @throws ObjectNotFoundException if the user or file was not found, with
1174
         *                         the exception message mentioning the precise problem
1175
         * @throws GSSIOException when an IO exception occurs
1176
         * @throws InsufficientPermissionsException
1177
         * @throws QuotaExceededException
1178
         */
1179
        public FileHeaderDTO updateFileContents(Long userId, Long fileId, String mimeType,
1180
                                long fileSize, String filePath) throws ObjectNotFoundException, GSSIOException,
1181
                                InsufficientPermissionsException, QuotaExceededException;
1182

    
1183
        /**
1184
         * Create a file based on inputstream without using transaction.
1185
         *
1186
         * @param stream
1187
         * @param userId
1188
         * @return the file
1189
         * @throws IOException
1190
         * @throws ObjectNotFoundException
1191
         */
1192
        @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
1193
        public File uploadFile(InputStream stream, Long userId)
1194
                        throws IOException, ObjectNotFoundException;
1195

    
1196
        public void createFileUploadProgress(Long userId, String filename,
1197
                                Long bytesTransfered, Long fileSize) throws ObjectNotFoundException;
1198

    
1199
        public FileUploadStatus getFileUploadStatus(Long userId, String fileName);
1200

    
1201
        public void removeFileUploadProgress(Long userId, String filename)
1202
                        throws ObjectNotFoundException;
1203

    
1204
        /**
1205
         * Fetch the file body with the specified version number.
1206
         *
1207
         * @param userId the ID of the current user
1208
         * @param fileId the ID of the file header
1209
         * @param version the version number
1210
         * @return the file body
1211
         * @throws ObjectNotFoundException if the user file or version
1212
         *                         were not found
1213
         * @throws InsufficientPermissionsException if the user does not
1214
         *                         have enough privileges for reading this file
1215
         */
1216
        public FileBodyDTO getFileVersion(Long userId, Long fileId, int version) throws ObjectNotFoundException, InsufficientPermissionsException;
1217

    
1218
        /**
1219
         * Search the system for a user with the specified email address.
1220
         * If no such user is found, the method returns null.
1221
         */
1222
        public User findUserByEmail(String email);
1223

    
1224
        /**
1225
         * Update the user with the values from the supplied object.
1226
         */
1227
        public void updateUser(User user);
1228

    
1229
        /**
1230
         * Update accounting information for given user.
1231
         *
1232
         * @param user The user to update
1233
         * @param date Date of transaction
1234
         * @param bandwidthDiff Bandwidth used; positive for addition,
1235
         * negative for subtraction (e.g. to rollback)
1236
         */
1237
        public void updateAccounting(User user, Date date, long bandwidthDiff);
1238

    
1239
        /**
1240
         * Check if the user with the specified ID has permission to read the
1241
         * folder with the supplied ID.
1242
         */
1243
        public boolean canReadFolder(Long userId, Long folderId) throws ObjectNotFoundException;
1244

    
1245
        /**
1246
         * Reset WebDAV password for given user.
1247
         *
1248
         * @param userId
1249
         * @return the new password
1250
         * @throws ObjectNotFoundException
1251
         */
1252
        public String resetWebDAVPassword(Long userId) throws ObjectNotFoundException;
1253

    
1254
}