Statistics
| Branch: | Tag: | Revision:

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

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 name and tags for 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
         * @throws ObjectNotFoundException
376
         * @throws InsufficientPermissionsException
377
         */
378
        public void updateFile(Long userId, Long fileId, String name, String tagSet)
379
                        throws ObjectNotFoundException, InsufficientPermissionsException;
380

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
906

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1253
}