Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (50 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
         * @throws DuplicateNameException if the specified name already exists in
165
         *             the parent folder, as either a folder or file
166
         * @throws ObjectNotFoundException if the user or parent folder was not
167
         *             found, with the exception message mentioning the precise
168
         *             problem
169
         * @throws InsufficientPermissionsException
170
         */
171
        public void createFolder(Long userId, Long parentId, String name) throws DuplicateNameException,
172
                        ObjectNotFoundException, InsufficientPermissionsException;
173

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

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

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

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

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

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

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

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

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

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

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

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

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

    
367
        /**
368
         * Updates name and tags for the specified file
369
         *
370
         * @param userId
371
         * @param fileId
372
         * @param name
373
         * @param tagSet a String that contains tags separated by comma
374
         * @throws ObjectNotFoundException
375
         * @throws InsufficientPermissionsException
376
         */
377
        public void updateFile(Long userId, Long fileId, String name, String tagSet)
378
                        throws ObjectNotFoundException, InsufficientPermissionsException;
379

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
905

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1252
}