Statistics
| Branch: | Tag: | Revision:

root / src / org / gss_project / gss / server / ejb / ExternalAPI.java @ 1206:292dec4eae08

History | View | Annotate | Download (49.9 kB)

1
/*
2
 * Copyright 2007, 2008, 2009, 2010 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 org.gss_project.gss.server.ejb;
20

    
21
import org.gss_project.gss.common.exceptions.DuplicateNameException;
22
import org.gss_project.gss.common.exceptions.GSSIOException;
23
import org.gss_project.gss.common.exceptions.InsufficientPermissionsException;
24
import org.gss_project.gss.common.exceptions.InvitationUsedException;
25
import org.gss_project.gss.common.exceptions.ObjectNotFoundException;
26
import org.gss_project.gss.common.exceptions.QuotaExceededException;
27
import org.gss_project.gss.server.domain.FileBody;
28
import org.gss_project.gss.server.domain.FileHeader;
29
import org.gss_project.gss.server.domain.FileLock;
30
import org.gss_project.gss.server.domain.FileUploadStatus;
31
import org.gss_project.gss.server.domain.Folder;
32
import org.gss_project.gss.server.domain.Group;
33
import org.gss_project.gss.server.domain.Invitation;
34
import org.gss_project.gss.server.domain.Nonce;
35
import org.gss_project.gss.server.domain.Permission;
36
import org.gss_project.gss.server.domain.User;
37
import org.gss_project.gss.server.domain.UserClass;
38
import org.gss_project.gss.server.domain.UserLogin;
39

    
40
import java.io.File;
41
import java.io.IOException;
42
import java.io.InputStream;
43
import java.util.Date;
44
import java.util.List;
45
import java.util.Set;
46

    
47
import javax.ejb.Local;
48
import javax.ejb.TransactionAttribute;
49
import javax.ejb.TransactionAttributeType;
50

    
51
import org.gss_project.gss.server.domain.WebDavNonce;
52
import org.gss_project.gss.common.dto.StatsDTO;
53
import org.gss_project.gss.common.dto.UserDTO;
54
import org.apache.solr.client.solrj.SolrServerException;
55

    
56
/**
57
 * The External API for GSS clients.
58
 *
59
 * @author past
60
 */
61
@Local
62
public interface ExternalAPI {
63

    
64
        /**
65
         * Retrieves the root folder for the specified user. The caller must ensure
66
         * that the userId exists.
67
         *
68
         * @param userId
69
         * @return Folder
70
         * @throws ObjectNotFoundException if no Folder or user was found
71
         */
72
        public Folder getRootFolder(Long userId) throws ObjectNotFoundException;
73

    
74
        /**
75
         * Retrieve the folder with the specified ID.
76
         *
77
         * @param userId the ID of the current user
78
         * @param folderId the ID of the folder to retrieve
79
         * @return the folder found
80
         * @throws ObjectNotFoundException if the folder or the user was not found
81
         * @throws InsufficientPermissionsException if ther user does not have read permissions for folder
82
         */
83
        public Folder getFolder(Long userId, Long folderId) throws ObjectNotFoundException,
84
                        InsufficientPermissionsException;
85

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

    
95
        /**
96
         * Returns the user with the specified ID.
97
         *
98
         * @param userId The ID of the User to be found
99
         * @return The User object
100
         * @throws ObjectNotFoundException if the user cannot be found
101
         */
102
        public UserDTO getUserDTO(Long userId) throws ObjectNotFoundException;
103

    
104
        /**
105
         * Returns the group with the specified ID.
106
         *
107
         * @param groupId The ID of the Group to be found
108
         * @return The Group object
109
         * @throws ObjectNotFoundException if the group cannot be found
110
         */
111
        public Group getGroup(Long groupId) throws ObjectNotFoundException;
112

    
113
        /**
114
         * Returns the group with the specified name that belongs to the
115
         * specified user.
116
         *
117
         * @param userId the ID of the user
118
         * @param name the name of the group
119
         * @return The Group object
120
         * @throws ObjectNotFoundException if the group cannot be found
121
         */
122
        public Group getGroup(Long userId, String name) throws ObjectNotFoundException;
123

    
124
        /**
125
         * Retrieve the list of groups for a particular user.
126
         *
127
         * @param userId the ID of the User
128
         * @return a List of Groups that belong to the specified User
129
         * @throws ObjectNotFoundException if the user was not found
130
         */
131
        public List<Group> getGroups(Long userId) throws ObjectNotFoundException;
132

    
133
        /**
134
         * Returns a list of files contained in the folder specified by its id.
135
         *
136
         * @param userId the ID of the User
137
         * @param folderId the ID of the folder containing the files
138
         * @param ignoreDeleted
139
         * @return the list of file header objects
140
         * @throws ObjectNotFoundException if the user or the folder cannot be found
141
         * @throws InsufficientPermissionsException
142
         */
143
        public List<FileHeader> getFiles(Long userId, Long folderId, boolean ignoreDeleted) throws ObjectNotFoundException,
144
                        InsufficientPermissionsException;
145

    
146
        /**
147
         * Returns a list of users for the specified group
148
         *
149
         * @param userId the ID of the User
150
         * @param groupId the ID of the requested group
151
         * @return List<User>
152
         * @throws ObjectNotFoundException if the user or group was not found, with
153
         *             the exception message mentioning the precise problem
154
         */
155
        public List<User> getUsers(Long userId, Long groupId) throws ObjectNotFoundException;
156

    
157
        /**
158
         * Returns a list of users matching the specified username
159
         *
160
         * @param username the username of the User
161
         * @return List<User>
162
         */
163
        public List<User> getUsersByUserNameLike(String username);
164

    
165
        /**
166
         * Creates a new folder with the specified owner, parent folder and name.
167
         * New folder has the same permissions as its parent
168
         *
169
         * @param userId
170
         * @param parentId
171
         * @param name
172
         * @return the new folder
173
         * @throws DuplicateNameException if the specified name already exists in
174
         *             the parent folder, as either a folder or file
175
         * @throws ObjectNotFoundException if the user or parent folder was not
176
         *             found, with the exception message mentioning the precise
177
         *             problem
178
         * @throws InsufficientPermissionsException
179
         */
180
        public Folder createFolder(Long userId, Long parentId, String name) throws DuplicateNameException,
181
                        ObjectNotFoundException, InsufficientPermissionsException;
182

    
183
        /**
184
         * Deletes the specified folder, if the specified user has the appropriate
185
         * permission.
186
         *
187
         * @param userId the ID of the current user
188
         * @param folderId the ID of the folder to delete
189
         * @throws InsufficientPermissionsException if the user does not have the
190
         *             appropriate privileges
191
         * @throws ObjectNotFoundException if the user or folder was not found, with
192
         *             the exception message mentioning the precise problem
193
         */
194
        public void deleteFolder(Long userId, Long folderId)
195
                        throws InsufficientPermissionsException, ObjectNotFoundException;
196

    
197
        /**
198
         * Retrieve the subfolders of the specified folder.
199
         *
200
         * @param userId the ID of the current user
201
         * @param folderId the ID of the folder to retrieve
202
         * @return the list of subfolders found
203
         * @throws ObjectNotFoundException if the folder or user was not found
204
         * @throws InsufficientPermissionsException
205
         */
206
        public List<Folder> getSubfolders(Long userId, Long folderId)
207
                        throws ObjectNotFoundException, InsufficientPermissionsException;
208

    
209
        /**
210
         * Retrieve the subfolders of the specified folder that are shared to others.
211
         *
212
         * @param userId the ID of the current user
213
         * @param folderId the ID of the folder to retrieve
214
         * @return the list of subfolders found
215
         * @throws ObjectNotFoundException if the folder or user was not found
216
         */
217
        public List<Folder> getSharedSubfolders(Long userId, Long folderId) throws ObjectNotFoundException;
218

    
219
        /**
220
         * Retrieve the subfolders of the specified folder that are shared to others.
221
         *
222
         * @param userId the ID of the current user
223
         * @param callingUserId the id of the user requesting this operation
224
         * @param folderId the ID of the folder to retrieve
225
         * @return the list of subfolders found
226
         * @throws ObjectNotFoundException if the folder or user was not found
227
         */
228
        public List<Folder> getSharedSubfolders(Long userId, Long callingUserId, Long folderId) throws ObjectNotFoundException;
229
        /**
230
         * Modifies the specified folder if the specified user has the appropriate
231
         * permission.
232
         *
233
         * @param userId the ID of the current user
234
         * @param folderId the ID of the folder to retrieve
235
         * @param folderName
236
         * @param readForAll
237
         * @param permissions
238
         * @return the updated folder
239
         * @throws InsufficientPermissionsException if the user does not have the
240
         *             appropriate privileges
241
         * @throws ObjectNotFoundException if the user or folder was not found, with
242
         *             the exception message mentioning the precise problem
243
         * @throws DuplicateNameException if the specified name already exists in
244
         *             the parent folder, as either a folder or file
245
         */
246
        public Folder updateFolder(Long userId, Long folderId, String folderName,
247
                                Boolean readForAll,
248
                                Set<Permission> permissions)
249
                        throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException;
250

    
251
        /**
252
         * Adds a user to the specified group
253
         *
254
         * @param userId the ID of the current user
255
         * @param groupId the id of the new group
256
         * @param userToAddId the id of the user to add
257
         * @throws DuplicateNameException if the user already exists in group
258
         * @throws ObjectNotFoundException if the user or group was not found, with
259
         *             the exception message mentioning the precise problem
260
         * @throws InsufficientPermissionsException
261
         */
262
        public void addUserToGroup(Long userId, Long groupId, Long userToAddId)
263
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException;
264

    
265
        /**
266
         * Creates a new group with the specified owner and name.
267
         *
268
         * @param userId the ID of the current user
269
         * @param name the name of the new group
270
         * @throws DuplicateNameException if the new group name already exists
271
         * @throws ObjectNotFoundException if the user or group was not found, with
272
         *             the exception message mentioning the precise problem
273
         */
274
        public void createGroup(Long userId, String name) throws ObjectNotFoundException, DuplicateNameException;
275

    
276
        /**
277
         * Deletes the specified group in the specified user's namespace.
278
         *
279
         * @param userId the ID of the current user
280
         * @param groupId the ID of the group to delete
281
         * @throws ObjectNotFoundException if the user or group was not found, with
282
         *             the exception message mentioning the precise problem
283
         * @throws InsufficientPermissionsException
284
         */
285
        public void deleteGroup(Long userId, Long groupId) throws ObjectNotFoundException, InsufficientPermissionsException;
286

    
287
        /**
288
         * Creates a new file with the specified owner, parent folder and name. The
289
         * new file has the same permissions as its parent folder. The file contents
290
         * are read from the input stream to a new File object.
291
         *
292
         * @param userId the ID of the current user
293
         * @param folderId the ID of the parent folder
294
         * @param name the name of the new file
295
         * @param mimeType the MIME type of the file
296
         * @param stream the input stream with the file contents
297
         * @return The FileHeader created
298
         * @throws DuplicateNameException if the specified name already exists in
299
         *             the parent folder, as either a folder or file
300
         * @throws ObjectNotFoundException if the user or parent folder was not
301
         *             found, with the exception message mentioning the precise
302
         *             problem
303
         * @throws GSSIOException if there was an error while storing the file contents
304
         * @throws InsufficientPermissionsException
305
         * @throws QuotaExceededException
306
         */
307
        public FileHeader createFile(Long userId, Long folderId, String name, String mimeType,
308
                                InputStream stream) throws DuplicateNameException, ObjectNotFoundException,
309
                                GSSIOException, InsufficientPermissionsException, QuotaExceededException;
310

    
311
        /**
312
         * Deletes the specified file, provided the specified user has
313
         * the necessary permissions.
314
         *
315
         * @param userId the ID of the current user
316
         * @param fileId the ID of the file to delete
317
         * @throws ObjectNotFoundException if the user or file was not found, with
318
         *             the exception message mentioning the precise problem
319
         * @throws InsufficientPermissionsException if the user does not have the
320
         *             appropriate privileges
321
         */
322
        public void deleteFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
323

    
324
        /**
325
         * Creates a new tag for the specified user and file.
326
         *
327
         * @param userId the creator of the tag
328
         * @param fileHeaderId the file that is tagged
329
         * @param tag the tag
330
         * @throws ObjectNotFoundException if the user or the file was not found
331
         */
332
        public void createTag(Long userId, Long fileHeaderId, String tag) throws ObjectNotFoundException;
333

    
334
        /**
335
         * Returns all tags defined by the specified user
336
         *
337
         * @param userId
338
         * @return Set<String>
339
         * @throws ObjectNotFoundException if the user was null
340
         */
341
        public Set<String> getUserTags(final Long userId) throws ObjectNotFoundException;
342

    
343
        /**
344
         * Updates the attributes of the specified file.
345
         *
346
         * @param userId
347
         * @param fileId
348
         * @param name
349
         * @param tagSet a String that contains tags separated by comma
350
         * @param modificationDate the modification date
351
         * @param versioned the new value of the versioned flag
352
         * @param readForAll
353
         * @param permissions
354
         * @throws DuplicateNameException
355
         * @throws ObjectNotFoundException
356
         * @throws InsufficientPermissionsException
357
         */
358
        public void updateFile(Long userId, Long fileId, String name, String tagSet,
359
                        Date modificationDate, Boolean versioned, Boolean readForAll,
360
                        Set<Permission> permissions)
361
                        throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException;
362

    
363
        /**
364
         * Retrieve the contents of the current body for the file
365
         * with the specified FileHeader ID. The file contents
366
         * are provided as an InputStream from which the caller can
367
         * retrieve the raw bytes.
368
         *
369
         * @param userId the ID of the current user
370
         * @param fileId the ID of the file to retrieve
371
         * @return an InputStream from the current file body contents
372
         * @throws ObjectNotFoundException if the file or the user was not found
373
         * @throws InsufficientPermissionsException  if the user does not have the
374
         *             appropriate privileges
375
         */
376
        public InputStream getFileContents(Long userId, Long fileId)
377
                        throws ObjectNotFoundException, InsufficientPermissionsException;
378

    
379
        /**
380
         * Retrieve the contents of the  body identified by bodyId for the file
381
         * with the specified FileHeader ID. The file contents
382
         * are provided as an InputStream from which the caller can
383
         * retrieve the raw bytes.
384
         *
385
         * @param userId the ID of the current user
386
         * @param fileId the ID of the file to retrieve
387
         * @param bodyId the body ID
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, Long bodyId)
394
                        throws ObjectNotFoundException, InsufficientPermissionsException;
395

    
396
        /**
397
         * Retrieve the file with the specified ID.
398
         *
399
         * @param userId the ID of the current user
400
         * @param fileId the ID of the file to retrieve
401
         * @return the file found
402
         * @throws ObjectNotFoundException if the file or the user was not found, with
403
         *                         the exception message mentioning the precise problem
404
         * @throws InsufficientPermissionsException
405
         */
406
        public FileHeader getFile(Long userId, Long fileId) throws ObjectNotFoundException,
407
                        InsufficientPermissionsException;
408

    
409
        /**
410
         * Retrieve the filebody with the specified ID.
411
         *
412
         * @param userId the ID of the current user
413
         * @param fileId the ID of the file to retrieve
414
         * @param bodyId the ID of the body
415
         * @return the file found
416
         * @throws ObjectNotFoundException if the file or the user was not found, with
417
         *                         the exception message mentioning the precise problem
418
         * @throws InsufficientPermissionsException
419
         */
420
        public FileBody getFileBody(Long userId, Long fileId, Long bodyId)
421
                        throws ObjectNotFoundException, InsufficientPermissionsException;
422

    
423
        /**
424
         * Get the resource (file or folder) at the specified path in
425
         * the specified user's namespace. The returned object will be of type
426
         * FileHeader or Folder.<p><strong>Note:</strong> this method does not
427
         * receive the current user as a parameter, therefore it is unable to perform
428
         * the necessary permission checks and should <strong>NOT</strong> be directly
429
         * exposed to remote clients. It is the caller's responsibility to verify that
430
         * the calling user has the required privileges for performing any subsequent
431
         * action on the resource through one of the other ExternalAPI methods.
432
         *
433
         * @param ownerId the ID of the user owning the namespace
434
         * @param path the absolute path in the user's namespace
435
         * @param ignoreDeleted if true, resources that have been moved to the trash
436
         *                         will be ignored
437
         * @throws ObjectNotFoundException if the user or resource was not found, with
438
         *                         the exception message mentioning the precise problem
439
         * @return the resource found
440
         */
441
        public Object getResourceAtPath(Long ownerId, String path, boolean ignoreDeleted)
442
                        throws ObjectNotFoundException;
443

    
444
        /**
445
         * Copy the provided file to the specified destination.
446
         *
447
         * @param userId the ID of the current user
448
         * @param fileId the IF of the provided file
449
         * @param dest the path of the new resource
450
         * @throws ObjectNotFoundException if the user, file or destination was not
451
         *                         found, with        the exception message mentioning the precise problem
452
         * @throws DuplicateNameException if the specified name already exists in
453
         *          the destination folder, as either a folder or file
454
         * @throws GSSIOException if there was an error while accessing the file contents
455
         * @throws InsufficientPermissionsException
456
         * @throws QuotaExceededException
457
         */
458
        public void copyFile(Long userId, Long fileId, String dest) throws ObjectNotFoundException,
459
                        DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
460

    
461
        /**
462
         * Copy the provided file to the specified destination.
463
         *
464
         * @param userId the ID of the current user
465
         * @param ownerId the ID of the owner of the destination namespace
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 copyFileToPath(Long userId, Long ownerId, 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 fileIds the IDs of the provided files
484
         * @param destId the ID of the destination folder
485
         * @throws ObjectNotFoundException if the user, file or destination was not
486
         *                         found, with        the exception message mentioning the precise problem
487
         * @throws GSSIOException if there was an error while accessing the file contents
488
         * @throws DuplicateNameException if the specified name already exists in
489
         *          the destination folder, as either a folder or file
490
         * @throws InsufficientPermissionsException
491
         * @throws QuotaExceededException
492
         */
493
        public void copyFiles(Long userId, List<Long> fileIds, Long destId)
494
                        throws ObjectNotFoundException, DuplicateNameException, GSSIOException,
495
                        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 fileId the IF of the provided file
502
         * @param destId the ID of the destination folder
503
         * @param destName the name of the new file
504
         * @throws ObjectNotFoundException if the user, file or destination was not
505
         *                         found, with        the exception message mentioning the precise problem
506
         * @throws GSSIOException if there was an error while accessing the file contents
507
         * @throws DuplicateNameException if the specified name already exists in
508
         *          the destination folder, as either a folder or file
509
         * @throws InsufficientPermissionsException
510
         * @throws QuotaExceededException
511
         */
512
        public void copyFile(Long userId, Long fileId, Long destId, String destName)
513
                        throws ObjectNotFoundException, DuplicateNameException, GSSIOException,
514
                        InsufficientPermissionsException, QuotaExceededException;
515

    
516
        /**
517
         * Copy the provided folder to the specified destination.
518
         *
519
         * @param userId the ID of the current user
520
         * @param folderId the IF of the provided folder
521
         * @param dest the path of the new folder
522
         * @throws ObjectNotFoundException if the user, folder or destination was not
523
         *                         found, with        the exception message mentioning the precise problem
524
         * @throws DuplicateNameException if the specified name already exists in
525
         *          the destination folder, as either a folder or file
526
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
527
         *          appropriate privileges
528
         */
529
        public void copyFolder(Long userId, Long folderId, String dest) throws ObjectNotFoundException,
530
                        DuplicateNameException, InsufficientPermissionsException;
531

    
532
        /**
533
         * Copy the provided folder to the specified destination.
534
         *
535
         * @param userId the ID of the current user
536
         * @param folderId the IF of the provided folder
537
         * @param destId the ID of the destination folder
538
         * @param destName the name 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
544
         *                         if the user does not have the appropriate privileges
545
         */
546
        public void copyFolder(Long userId, Long folderId, Long destId, String destName)
547
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException;
548

    
549
        /**
550
         * Copy the provided folder and all its subfolders and files to the specified destination.
551
         *
552
         * @param userId the ID of the current user
553
         * @param ownerId the ID of the owner of the destination namespace
554
         * @param folderId the IF of the provided folder
555
         * @param dest the path 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 if the user does not have the
561
         *          appropriate privileges
562
         * @throws QuotaExceededException if the user quota limit would be exceeded
563
         * @throws GSSIOException if there was an error while accessing the file contents
564
         */
565
        public void copyFolderStructureToPath(Long userId, Long ownerId, Long folderId, String dest) throws ObjectNotFoundException,
566
                        DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
567

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

    
588
        /**
589
         * Marks  the specified file as deleted in the specified user's namespace.
590
         *
591
         * @param userId the ID of the current user
592
         * @param fileId the ID of the file to delete
593
         * @throws ObjectNotFoundException if the user or file was not found, with
594
         *             the exception message mentioning the precise problem
595
         * @throws InsufficientPermissionsException if the user does not have the
596
         *             appropriate privileges
597
         */
598
        public void moveFileToTrash(Long userId, Long fileId) throws ObjectNotFoundException,
599
                        InsufficientPermissionsException;
600

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

    
614
        /**
615
         * Marks  the specified folder as deleted in the specified user's namespace.
616
         *
617
         * @param userId the ID of the current user
618
         * @param folderId the ID of the folder to delete
619
         * @throws ObjectNotFoundException if the user or file was not found, with
620
         *             the exception message mentioning the precise problem
621
         * @throws InsufficientPermissionsException if the user does not have the
622
         *             appropriate privileges
623
         */
624
        public void moveFolderToTrash(Long userId, Long folderId)
625
                        throws ObjectNotFoundException, InsufficientPermissionsException;
626

    
627
        /**
628
         * Marks  the specified deleted folder as undeleted in the specified user's namespace.
629
         *
630
         * @param userId the ID of the current user
631
         * @param folderId the ID of the folder to undelete
632
         * @throws ObjectNotFoundException if the user or file was not found, with
633
         *             the exception message mentioning the precise problem
634
         * @throws InsufficientPermissionsException if the user does not have the
635
         *          appropriate privileges
636
         *
637
         */
638
        public void removeFolderFromTrash(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
639

    
640
        /**
641
         * Move the provided folder and all its subfolders and files to the specified destination.
642
         *
643
         * @param userId the ID of the current user
644
         * @param folderId the IF of the provided folder
645
         * @param destId the ID of the destination folder
646
         * @param destName the name of the new folder
647
         * @throws ObjectNotFoundException if the user, folder or destination was not
648
         *                         found, with        the exception message mentioning the precise problem
649
         * @throws DuplicateNameException if the specified name already exists in
650
         *          the destination folder, as either a folder or file
651
         * @throws InsufficientPermissionsException if the user does not have the
652
         *          appropriate privileges
653
         * @throws GSSIOException
654
         * @throws QuotaExceededException
655
         */
656
        public void moveFolder(Long userId, Long folderId, Long destId, String destName)
657
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,
658
                        GSSIOException, QuotaExceededException;
659

    
660
        /**
661
         * Move the provided folder and all its subfolders and files to the specified destination.
662
         *
663
         * @param userId the ID of the current user
664
         * @param ownerId the owner of the destination namespace
665
         * @param folderId the IF of the provided folder
666
         * @param dest the path of the new folder
667
         * @throws ObjectNotFoundException if the user, folder or destination was not
668
         *                         found, with        the exception message mentioning the precise problem
669
         * @throws DuplicateNameException if the specified name already exists in
670
         *          the destination folder, as either a folder or file
671
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
672
         *          appropriate privileges
673
         * @throws GSSIOException
674
         * @throws QuotaExceededException
675
         */
676
        public void moveFolderToPath(Long userId, Long ownerId, Long folderId, String dest) throws ObjectNotFoundException,
677
                        DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
678

    
679
        /**
680
         * Move the provided file to the specified destination.
681
         *
682
         * @param userId the ID of the current user
683
         * @param fileId the IF of the provided file
684
         * @param destId the ID of the destination folder
685
         * @param destName the name of the new file
686
         * @throws InsufficientPermissionsException
687
         * @throws ObjectNotFoundException if the user, file or destination was not
688
         *                         found, with        the exception message mentioning the precise problem
689
         * @throws GSSIOException if there was an error while accessing the file contents
690
         * @throws DuplicateNameException if the specified name already exists in
691
         *          the destination folder, as either a folder or file
692
         * @throws QuotaExceededException
693
         */
694
        public void moveFile(Long userId, Long fileId, Long destId, String destName)
695
                        throws InsufficientPermissionsException, ObjectNotFoundException,
696
                        DuplicateNameException, GSSIOException, QuotaExceededException;
697

    
698
        /**
699
         * Move the provided file to the specified destination.
700
         *
701
         * @param userId the ID of the current user
702
         * @param ownerId the owner of the destination namespace
703
         * @param fileId the IF of the provided file
704
         * @param dest the path of the new file
705
         * @throws InsufficientPermissionsException
706
         * @throws ObjectNotFoundException if the user, file or destination was not
707
         *                         found, with        the exception message mentioning the precise problem
708
         * @throws GSSIOException if there was an error while accessing the file contents
709
         * @throws DuplicateNameException if the specified name already exists in
710
         *          the destination folder, as either a folder or file
711
         * @throws QuotaExceededException
712
         */
713
        public void moveFileToPath(Long userId, Long ownerId, Long fileId, String dest) throws ObjectNotFoundException, InsufficientPermissionsException, DuplicateNameException, GSSIOException, QuotaExceededException;
714

    
715
        /**
716
         * move the provided file to the specified destination.
717
         *
718
         * @param userId the ID of the current user
719
         * @param fileIds the IDs of the provided files
720
         * @param destId the ID of the destination folder
721
         * @throws InsufficientPermissionsException
722
         * @throws ObjectNotFoundException if the user, file or destination was not
723
         *                         found, with        the exception message mentioning the precise problem
724
         * @throws GSSIOException if there was an error while accessing the file contents
725
         * @throws DuplicateNameException if the specified name already exists in
726
         *          the destination folder, as either a folder or file
727
         * @throws QuotaExceededException
728
         */
729
        public void moveFiles(Long userId, List<Long> fileIds, Long destId)
730
                        throws InsufficientPermissionsException, ObjectNotFoundException,
731
                        DuplicateNameException, GSSIOException, QuotaExceededException;
732

    
733
        /**
734
         * Returns a list of All deleted files of a user.
735
         *
736
         * @param userId the ID of the User
737
         *          * @return the list of deleted file header objects
738
         * @throws ObjectNotFoundException if the user cannot be found
739
         */
740
        public List<FileHeader> getDeletedFiles(Long userId) throws ObjectNotFoundException;
741

    
742
        /**
743
         * Returns a list of All deleted root folders of a user.
744
         *
745
         * @param userId the ID of the User
746
         *          * @return the list of deleted file header objects
747
         * @throws ObjectNotFoundException if the user cannot be found
748
         */
749
        public List<Folder> getDeletedRootFolders(Long userId) throws ObjectNotFoundException;
750

    
751
        /**
752
         * Empty Trash by deleting all marked as deleted files and folders
753
         * @param userId
754
         * @throws ObjectNotFoundException if something goes wrong in the delete process
755
         * @throws InsufficientPermissionsException if something goes wrong in the delete process
756
         */
757
        public void emptyTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
758

    
759
        /**
760
         * Restores All Trashed Items by undeleting all marked as deleted files and folders
761
         * @param userId
762
         * @throws ObjectNotFoundException if something goes wrong in the delete process
763
         * @throws InsufficientPermissionsException
764
         */
765
        public void restoreTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
766

    
767
        /**
768
         * Search the system for a user with the specified username.
769
         * If no such user is found, the method returns null.
770
         *
771
         * @param username the username to search for
772
         * @return the User object with the specified username
773
         */
774
        public User findUser(String username);
775

    
776
        /**
777
         * Create a new user with the specified name, username and e-mail address.
778
         *
779
         * @param username the username of the new user
780
         * @param name the name of the new user
781
         * @param mail the e-mail of the new user
782
         * @param idp the IdP of the new user
783
         * @param idpid the IdP identifier of the new user
784
         * @return the newly-created User object
785
         * @throws DuplicateNameException if a user with the same username already exists
786
         * @throws ObjectNotFoundException if no username was provided
787
         */
788
        public User createUser(String username, String name, String mail, String idp, String idpid, String homeOrg)
789
                        throws DuplicateNameException, ObjectNotFoundException;
790

    
791
        /**
792
         * Updates the authentication token for the specified user.
793
         *
794
         * @param userId the ID of the user whose token should be updated
795
         * @return the updated user
796
         * @throws ObjectNotFoundException if the user could not be found
797
         */
798
        public User updateUserToken(Long userId) throws ObjectNotFoundException;
799

    
800
        /**
801
         * Updates the policy acceptance flag for the specified user.
802
         *
803
         * @param userId the ID of the user whose flag should be updated
804
         * @param isAccepted the new value of the flag
805
         * @return the updated user
806
         * @throws ObjectNotFoundException if the user could not be found
807
         */
808
        public User updateUserPolicyAcceptance(Long userId, boolean isAccepted) throws ObjectNotFoundException;
809

    
810
        /**
811
         * Invalidates the authentication token for the specified user.
812
         *
813
         * @param userId the ID of the user whose token should be updated
814
         * @throws ObjectNotFoundException if the user could not be found
815
         */
816
        public void invalidateUserToken(Long userId) throws ObjectNotFoundException;
817

    
818
        /**
819
         * Retrieve folder user and group permissions
820
         *
821
         * @param userId the ID of the user whose token should be updated
822
         * @param folderId the ID of the folder
823
         * @return the Set of permissions from requested folder
824
         * @throws ObjectNotFoundException if the user or folder could not be found
825
         * @throws InsufficientPermissionsException
826
         */
827
        public Set<Permission> getFolderPermissions(Long userId, Long folderId)
828
                        throws ObjectNotFoundException, InsufficientPermissionsException;
829

    
830
        /**
831
         * Retrieve file user and group permissions
832
         *
833
         * @param userId the ID of the user whose token should be updated
834
         * @param fileId the ID of the folder
835
         * @return the Set of permissions from requested folder
836
         * @throws ObjectNotFoundException if the user or folder could not be found
837
         * @throws InsufficientPermissionsException
838
         */
839
        public Set<Permission> getFilePermissions(Long userId, Long fileId)
840
                        throws ObjectNotFoundException, InsufficientPermissionsException;
841

    
842
        /**
843
         * Returns a list of all shared root folders of a user.
844
         *
845
         * @param userId the ID of the User
846
         * @return the list of shared root folders
847
         * @throws ObjectNotFoundException if the user cannot be found
848
         */
849
        public List<Folder> getSharedRootFolders(Long userId) throws ObjectNotFoundException;
850

    
851
        /**
852
         * Returns a list of all shared files of a user that are not
853
         * inside other shared folders.
854
         *
855
         * @param userId the ID of the User
856
         * @return the list of shared files
857
         * @throws ObjectNotFoundException if the user cannot be found
858
         */
859
        public List<FileHeader> getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException;
860

    
861
        /**
862
         * Returns a list of all shared files of a user.
863
         *
864
         * @param userId the ID of the User
865
         * @return the list of shared files
866
         * @throws ObjectNotFoundException if the user cannot be found
867
         */
868
        public List<FileHeader> getSharedFiles(Long userId) throws ObjectNotFoundException;
869

    
870
        /**
871
         * Returns a list of all shared folders of a user.
872
         *
873
         * @param userId the ID of the User
874
         * @return the list of shared folders
875
         * @throws ObjectNotFoundException if the user cannot be found
876
         */
877
        public List<Folder> getSharedFolders(Long userId) throws ObjectNotFoundException;
878

    
879
        /**
880
         * Returns a list of all shared root folders of a user that calling
881
         * user has at least read permissions.
882
         *
883
         * @param ownerId the ID of the User
884
         * @return the list of shared root folders
885
         * @param callingUserId
886
         *
887
         * @throws ObjectNotFoundException if the user cannot be found
888
         */
889
        public List<Folder> getSharedRootFolders(Long ownerId, Long callingUserId)
890
                        throws ObjectNotFoundException;
891

    
892
        /**
893
         * Returns a list of all shared  files of a user that calling user has
894
         * at least read permissions..
895
         *
896
         * @param ownerId the ID of the User
897
         * @return the list of shared files
898
         * @param callingUserId
899
         * @throws ObjectNotFoundException if the user cannot be found
900
         */
901
        public List<FileHeader> getSharedFiles(Long ownerId, Long callingUserId)
902
                        throws ObjectNotFoundException;
903

    
904
        /**
905
         * Remove a user member from a group
906
         *
907
         * @param userId the ID of the User owning the group
908
         * @param groupId the ID of the requested group
909
         * @param memberId the ID of the member to be removed
910
         *
911
         * @throws ObjectNotFoundException if the user or group was not found, with
912
         *             the exception message mentioning the precise problem
913
         * @throws InsufficientPermissionsException
914
         */
915
        public void removeMemberFromGroup(Long userId, Long groupId, Long memberId)
916
                        throws ObjectNotFoundException, InsufficientPermissionsException;
917

    
918
        /**
919
         * Retrieves the list of users sharing files to user identified by user id
920
         * @param userId
921
         * @return the List of users sharing files to user
922
         * @throws ObjectNotFoundException
923
         */
924
        public List<User> getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException;
925

    
926
        /**
927
         * Search Files
928
         *
929
         * @param userId
930
         * @param query
931
         * @return list of files that match query
932
         * @throws ObjectNotFoundException if no user or query was specified
933
         */
934
        public List<FileHeader> searchFiles(Long userId, String query) throws ObjectNotFoundException;
935

    
936
        /**
937
         * Creates a nonce for the specified user.
938
         *
939
         * @param userId the ID of the user
940
         * @return the new nonce
941
         * @throws ObjectNotFoundException if the user could not be found
942
         */
943
        public Nonce createNonce(Long userId) throws ObjectNotFoundException;
944

    
945
        /**
946
         * Find the nonce object for the specified encoded nonce, that should be
947
         * associated with the specified user.
948
         *
949
         * @param nonce the issued nonce in Base64 encoding
950
         * @param userId the ID of the user for whom this nonce should have been issued
951
         * @return the retrieved nonce object
952
         * @throws ObjectNotFoundException if the nonce or user were not found
953
         */
954
        public Nonce getNonce(String nonce, Long userId) throws ObjectNotFoundException;
955

    
956
        /**
957
         * Remove the specified nonce from the persistent store.
958
         *
959
         * @param id the ID of the nonce
960
         * @throws ObjectNotFoundException if the specified nonce could not be found
961
         */
962
        public void removeNonce(Long id) throws ObjectNotFoundException;
963

    
964
        /**
965
         * Activate the supplied nonce for the specified user.
966
         *
967
         * @param userId the ID of the user
968
         * @param nonce the nonce to activate
969
         * @param nonceExpiryDate the expiry date of the nonce
970
         * @throws ObjectNotFoundException
971
         */
972
        public void activateUserNonce(Long userId, String nonce, Date nonceExpiryDate) throws ObjectNotFoundException;
973

    
974
        /**
975
         * Retrieves user statistics.
976
         *
977
         * @param userId the ID of the user
978
         * @return the statistics
979
         * @throws ObjectNotFoundException
980
         *
981
         */
982
        public StatsDTO getUserStatistics(Long userId) throws ObjectNotFoundException;
983

    
984
        /**
985
         * Restore the file contents to the specified version.
986
         *
987
         * @param userId the ID of the user
988
         * @param fileId the ID of the file
989
         * @param version the version number of the desired file contents
990
         * @throws ObjectNotFoundException if the user or file was not
991
         *                         found, with        the exception message mentioning the precise problem
992
         * @throws InsufficientPermissionsException if the user does not have the
993
         *          appropriate privileges
994
         * @throws QuotaExceededException if the user quota limit would be exceeded
995
         * @throws GSSIOException if there was an error while accessing the file contents
996
         */
997
        public void restoreVersion(Long userId, Long fileId, int version)
998
                        throws ObjectNotFoundException, InsufficientPermissionsException,  GSSIOException, QuotaExceededException;
999

    
1000
        /**
1001
         * Removes all old file versions for specified file keeping only the current revision
1002
         *
1003
         * @param userId the ID of the user
1004
         * @param fileId the ID of the file
1005
         *
1006
         * @throws ObjectNotFoundException
1007
         * @throws InsufficientPermissionsException
1008
         *
1009
         */
1010
        public void removeOldVersions(Long userId, Long fileId)
1011
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1012

    
1013
        /**
1014
         * It is used by the Solr mbean to rebuild the index.
1015
         */
1016
        public String rebuildSolrIndex();
1017

    
1018
        /**
1019
         * It is used by the Solr mbean to refresh the index. It does not delete anything just re-add everything in the index
1020
         */
1021
        public String refreshSolrIndex();
1022
        
1023
        /**
1024
         * Creates a new file with the specified owner, parent folder and name. The
1025
         * new file has the same permissions as its parent folder. The file contents
1026
         * are already uploaded outside of externalAPI and the uploaded file is used as a parameter.
1027
         *
1028
         * @param userId the ID of the current user
1029
         * @param folderId the ID of the parent folder
1030
         * @param name the name of the new file
1031
         * @param mimeType the MIME type of the file
1032
         * @param fileSize the uploaded file size
1033
         * @param filePath the uploaded file full path
1034
         * @return The FileHeader created
1035
         * @throws DuplicateNameException if the specified name already exists in
1036
         *             the parent folder, as either a folder or file
1037
         * @throws ObjectNotFoundException if the user or parent folder was not
1038
         *             found, with the exception message mentioning the precise
1039
         *             problem
1040
         * @throws GSSIOException if there was an error while storing the file contents
1041
         * @throws InsufficientPermissionsException
1042
         * @throws QuotaExceededException
1043
         */
1044
        public FileHeader createFile(Long userId, Long folderId, String name, String mimeType, long fileSize, String filePath)
1045
                        throws DuplicateNameException, ObjectNotFoundException, GSSIOException,
1046
                        InsufficientPermissionsException, QuotaExceededException;
1047

    
1048
        /**
1049
         * Create a new FileBody with the supplied uploaded file as contents and make it the current body
1050
         * of the file.
1051
         *
1052
         * @param userId the ID of the current user
1053
         * @param fileId the ID of the file header object
1054
         * @param mimeType the content type of the file
1055
         * @param fileSize the uploaded file size
1056
         * @param filePath the uploaded file full path
1057
         * @return The FileHeader updated
1058
         * @throws ObjectNotFoundException if the user or file was not found, with
1059
         *                         the exception message mentioning the precise problem
1060
         * @throws GSSIOException when an IO exception occurs
1061
         * @throws InsufficientPermissionsException
1062
         * @throws QuotaExceededException
1063
         */
1064
        public FileHeader updateFileContents(Long userId, Long fileId, String mimeType,
1065
                                long fileSize, String filePath) throws ObjectNotFoundException, GSSIOException,
1066
                                InsufficientPermissionsException, QuotaExceededException;
1067

    
1068
        /**
1069
         * Create a file based on inputstream without using transaction.
1070
         *
1071
         * @param stream
1072
         * @param userId
1073
         * @return the file
1074
         * @throws IOException
1075
         * @throws ObjectNotFoundException
1076
         */
1077
        @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
1078
        public File uploadFile(InputStream stream, Long userId)
1079
                        throws IOException, ObjectNotFoundException;
1080

    
1081
        public void createFileUploadProgress(Long userId, String filename,
1082
                                Long bytesTransfered, Long fileSize) throws ObjectNotFoundException;
1083

    
1084
        public FileUploadStatus getFileUploadStatus(Long userId, String fileName);
1085

    
1086
        public void removeFileUploadProgress(Long userId, String filename)
1087
                        throws ObjectNotFoundException;
1088

    
1089
        /**
1090
         * Fetch the file body with the specified version number.
1091
         *
1092
         * @param userId the ID of the current user
1093
         * @param fileId the ID of the file header
1094
         * @param version the version number
1095
         * @return the file body
1096
         * @throws ObjectNotFoundException if the user file or version
1097
         *                         were not found
1098
         * @throws InsufficientPermissionsException if the user does not
1099
         *                         have enough privileges for reading this file
1100
         */
1101
        public FileBody getFileVersion(Long userId, Long fileId, int version) throws ObjectNotFoundException, InsufficientPermissionsException;
1102

    
1103
        /**
1104
         * Search the system for a user with the specified email address.
1105
         * If no such user is found, the method returns null.
1106
         */
1107
        public User findUserByEmail(String email);
1108

    
1109
        /**
1110
         * Update the user with the values from the supplied object.
1111
         */
1112
        public void updateUser(User user);
1113

    
1114
        /**
1115
         * Update accounting information for given user.
1116
         *
1117
         * @param user The user to update
1118
         * @param date Date of transaction
1119
         * @param bandwidthDiff Bandwidth used; positive for addition,
1120
         * negative for subtraction (e.g. to rollback)
1121
         */
1122
        public void updateAccounting(User user, Date date, long bandwidthDiff);
1123

    
1124
        /**
1125
         * Check if the user with the specified ID has permission to read the
1126
         * folder with the supplied ID.
1127
         */
1128
        public boolean canReadFolder(Long userId, Long folderId) throws ObjectNotFoundException;
1129

    
1130
        /**
1131
         * Reset WebDAV password for given user.
1132
         *
1133
         * @param userId
1134
         * @return the new password
1135
         * @throws ObjectNotFoundException
1136
         */
1137
        public String resetWebDAVPassword(Long userId) throws ObjectNotFoundException;
1138

    
1139
        /**
1140
         * Find the invite for the specified invitation code.
1141
         *
1142
         * @param code the invitation code
1143
         * @return the Invitation or null if not found
1144
         */
1145
        public Invitation findInvite(String code);
1146

    
1147
        /**
1148
         * Create a new user in the connected IdP.
1149
         *
1150
         * @param username the username of the new user
1151
         * @param firstname the first name of the new user
1152
         * @param lastname the last name of the new user
1153
         * @param email the e-mail of the new user
1154
         * @param password the password of the new user
1155
         */
1156
        public void createLdapUser(String username, String firstname, String lastname, String email, String password);
1157

    
1158
        /**
1159
         * Retrieves the available user classes.
1160
         */
1161
        public List<UserClass> getUserClasses();
1162

    
1163
        /**
1164
         * Upgrades the user class to the default "coupon bearer" class and marks
1165
         * the provided coupon as used.
1166
         *
1167
         * @param username the username of the user
1168
         * @param code the coupon code
1169
         * @return the new user class
1170
         * @throws InvitationUsedException when trying to reuse an already used invitation
1171
         * @throws ObjectNotFoundException if the user was not found
1172
         */
1173
        public UserClass upgradeUserClass(String username, String code)
1174
                        throws ObjectNotFoundException, InvitationUsedException;
1175

    
1176
        /**
1177
         * Retrieve the user class for coupon-bearing users.
1178
         */
1179
        public UserClass getCouponUserClass();
1180

    
1181
        /**
1182
         * Delete the actual file in the specified file system path.
1183
         */
1184
        public void deleteActualFile(String path);
1185
        
1186
        /**
1187
         * Update the userLogin with the values from the supplied object.
1188
         */
1189
        public void addUserLogin(UserLogin userLogin);
1190
        
1191
        /**
1192
         * Retrieves the user's current session login and the user's last login
1193
         * @param userId
1194
         * @return a list of last two user logins
1195
         * @throws ObjectNotFoundException 
1196
         */
1197
        public List<UserLogin> getLastUserLogins(Long userId) throws ObjectNotFoundException;
1198

    
1199
        /**
1200
         * Posts the file specified by id to solr indexing server
1201
         *
1202
         * @param id
1203
         */
1204
        public void postFileToSolr(Long id) throws IOException, SolrServerException, ObjectNotFoundException;
1205
        
1206
        /**
1207
         * @param folder
1208
         * @throws ObjectNotFoundException 
1209
         */
1210
        public Folder expandFolder(Folder folder) throws ObjectNotFoundException;
1211

    
1212
        /**
1213
         * @param folder
1214
         * @return
1215
         * @throws ObjectNotFoundException
1216
         */
1217
        FileHeader expandFile(FileHeader folder) throws ObjectNotFoundException;
1218

    
1219
        /**
1220
         * @param folder
1221
         * @return
1222
         * @throws ObjectNotFoundException
1223
         */
1224
        Group expandGroup(Group folder) throws ObjectNotFoundException;
1225

    
1226
        /**
1227
         * @param username
1228
         * @return
1229
         */
1230
        User getUserByUserName(String username);
1231

    
1232
        /**
1233
         * @param lock
1234
         * @return
1235
         */
1236
        FileLock saveOrUpdateLock(FileLock lock);
1237

    
1238
        /**
1239
         * @param lock
1240
         */
1241
        void removeLock(FileLock lock);
1242

    
1243
        /**
1244
         * @param tokenId
1245
         * @return
1246
         */
1247
        FileLock getLockByToken(String tokenId);
1248

    
1249
        /**
1250
         * @param id
1251
         * @return
1252
         */
1253
        FileLock getLockById(String id);
1254

    
1255
        /**
1256
         * @param userId
1257
         * @param folderId
1258
         * @param name
1259
         * @return
1260
         * @throws DuplicateNameException
1261
         * @throws ObjectNotFoundException
1262
         * @throws GSSIOException
1263
         * @throws InsufficientPermissionsException
1264
         * @throws QuotaExceededException
1265
         */
1266
        FileHeader createEmptyFile(Long userId, Long folderId, String name) throws DuplicateNameException, ObjectNotFoundException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
1267

    
1268
        /**
1269
         * @param nonce
1270
         * @return
1271
         */
1272
        WebDavNonce saveOrUpdateWebDavNonce(WebDavNonce nonce);
1273

    
1274
        /**
1275
         * @param nonce
1276
         */
1277
        void removeWebDavNonce(WebDavNonce nonce);
1278

    
1279
        /**
1280
         * @param tokenId
1281
         * @return
1282
         */
1283
        WebDavNonce getWebDavNonce(String tokenId);
1284

    
1285
        /**
1286
         * @param userId
1287
         * @param query
1288
         * @param start
1289
         * @return
1290
         * @throws ObjectNotFoundException
1291
         */
1292
        List<FileHeader> searchFiles(Long userId, String query, int start) throws ObjectNotFoundException;
1293

    
1294
        /**
1295
         * @param userId
1296
         * @param query
1297
         * @return
1298
         * @throws ObjectNotFoundException
1299
         */
1300
        long searchFilesCount(Long userId, String query) throws ObjectNotFoundException;
1301
                
1302
        
1303
}