Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (30 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.User;
27
import gr.ebs.gss.server.domain.dto.FileHeaderDTO;
28
import gr.ebs.gss.server.domain.dto.FolderDTO;
29
import gr.ebs.gss.server.domain.dto.GroupDTO;
30
import gr.ebs.gss.server.domain.dto.PermissionDTO;
31
import gr.ebs.gss.server.domain.dto.UserDTO;
32

    
33
import java.io.InputStream;
34
import java.util.List;
35
import java.util.Set;
36

    
37
import javax.ejb.Remote;
38

    
39
/**
40
 * The External API for GSS clients.
41
 *
42
 * @author chstath
43
 */
44
@Remote
45
public interface ExternalAPIRemote {
46

    
47
        /**
48
         * Retrieves the root folder for the specified user. The caller must ensure
49
         * that the userId exists.
50
         *
51
         * @param userId
52
         * @return Folder
53
         * @throws ObjectNotFoundException if no Folder or user was found
54
         */
55
        public FolderDTO getRootFolder(Long userId) throws ObjectNotFoundException;
56

    
57
        /**
58
         * Retrieve the folder with the specified ID.
59
         *
60
         * @param userId the ID of the current user
61
         * @param folderId the ID of the folder to retrieve
62
         * @return the folder found
63
         * @throws ObjectNotFoundException if the folder or the user was not found
64
         * @throws InsufficientPermissionsException if ther user does not have read permissions for folder
65
         */
66
        public FolderDTO getFolder(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
67

    
68
        /**
69
         * Returns the user with the specified ID.
70
         *
71
         * @param userId The ID of the User to be found
72
         * @return The User object
73
         * @throws ObjectNotFoundException if the user cannot be found
74
         */
75
        public User getUser(Long userId) throws ObjectNotFoundException;
76

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

    
86
        /**
87
         * Returns the group with the specified ID.
88
         *
89
         * @param groupId The ID of the Group to be found
90
         * @return The Group object
91
         * @throws ObjectNotFoundException if the group cannot be found
92
         */
93
        public GroupDTO getGroup(Long groupId) throws ObjectNotFoundException;
94

    
95
        /**
96
         * Retrieve the list of groups for a particular user.
97
         *
98
         * @param userId the ID of the User
99
         * @return a List of Groups that belong to the specified User
100
         * @throws ObjectNotFoundException if the user was not found
101
         */
102
        public List<GroupDTO> getGroups(Long userId) throws ObjectNotFoundException;
103

    
104
        /**
105
         * Returns a list of files contained in the folder specified by its id.
106
         *
107
         * @param userId the ID of the User
108
         * @param folderId the ID of the folder containing the files
109
         * @param ignoreDeleted
110
         * @return the list of file header objects
111
         * @throws ObjectNotFoundException if the user or the folder cannot be found
112
         * @throws InsufficientPermissionsException
113
         */
114
        public List<FileHeaderDTO> getFiles(Long userId, Long folderId, boolean ignoreDeleted) throws ObjectNotFoundException, InsufficientPermissionsException;
115

    
116
        /**
117
         * Returns a list of users for the specified group
118
         *
119
         * @param userId the ID of the User
120
         * @param groupId the ID of the requested group
121
         * @return List<UserDTO>
122
         * @throws ObjectNotFoundException if the user or group was not found, with
123
         *             the exception message mentioning the precise problem
124
         */
125
        public List<UserDTO> getUsers(Long userId, Long groupId) throws ObjectNotFoundException;
126

    
127
        /**
128
         * Returns a list of users for the specified username
129
         *
130
         * @param username the username of the User
131
         * @return List<UserDTO>
132
         */
133
        public List<UserDTO> getUsersByUserNameLike(String username);
134

    
135
        /**
136
         * Creates a new folder with the specified owner, parent folder and name.
137
         * New folder has the same permissions as its parent
138
         *
139
         * @param userId
140
         * @param parentId
141
         * @param name
142
         * @return the new folder
143
         * @throws DuplicateNameException if the specified name already exists in
144
         *             the parent folder, as either a folder or file
145
         * @throws ObjectNotFoundException if the user or parent folder was not
146
         *             found, with the exception message mentioning the precise
147
         *             problem
148
         * @throws InsufficientPermissionsException
149
         */
150
        public FolderDTO createFolder(Long userId, Long parentId, String name) throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException;
151

    
152
        /**
153
         * Deletes the specified folder if the specified user has the appropriate
154
         * permission
155
         *
156
         * @param userId
157
         * @param folderId
158
         * @throws InsufficientPermissionsException if the user does not have the
159
         *             appropriate privileges
160
         * @throws ObjectNotFoundException if the user or folder was not found, with
161
         *             the exception message mentioning the precise problem
162
         */
163
        public void deleteFolder(Long userId, Long folderId) throws InsufficientPermissionsException, ObjectNotFoundException;
164

    
165
        /**
166
         * Retrieve the subfolders of the specified folder.
167
         *
168
         * @param userId the ID of the current user
169
         * @param folderId the ID of the folder to retrieve
170
         * @return the list of subfolders found
171
         * @throws ObjectNotFoundException if the folder or user was not found
172
         * @throws InsufficientPermissionsException
173
         */
174
        public List<FolderDTO> getSubfolders(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
175

    
176

    
177
        /**
178
         * Retrieve the subfolders of the specified folder that are shared to others.
179
         *
180
         * @param userId the ID of the current user
181
         * @param folderId the ID of the folder to retrieve
182
         * @return the list of subfolders found
183
         * @throws ObjectNotFoundException if the folder or user was not found
184
         */
185
        public List<FolderDTO> getSharedSubfolders(Long userId, Long folderId) throws ObjectNotFoundException;
186

    
187
        /**
188
         * Modifies the specified folder if the specified user has the appropriate
189
         * permission.
190
         *
191
         * @param userId the ID of the current user
192
         * @param folderId the ID of the folder to retrieve
193
         * @param folderName
194
         * @return the updated folder
195
         * @throws InsufficientPermissionsException if the user does not have the
196
         *             appropriate privileges
197
         * @throws ObjectNotFoundException if the user or folder was not found, with
198
         *             the exception message mentioning the precise problem
199
         * @throws DuplicateNameException if the specified name already exists in
200
         *             the parent folder, as either a folder or file
201
         */
202
        public FolderDTO modifyFolder(Long userId, Long folderId, String folderName) throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException;
203

    
204
        /**
205
         * Adds a user to the specified group
206
         *
207
         * @param userId the ID of the current user
208
         * @param groupId the id of the new group
209
         * @param userToAddId the id of the user to add
210
         * @throws DuplicateNameException if the user already exists in group
211
         * @throws ObjectNotFoundException if the user or group was not found, with
212
         *             the exception message mentioning the precise problem
213
         * @throws InsufficientPermissionsException
214
         */
215
        public void addUserToGroup(Long userId, Long groupId, Long userToAddId) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException;
216

    
217
        /**
218
         * Creates a new group with the specified owner and name.
219
         *
220
         * @param userId the ID of the current user
221
         * @param name the name of the new group
222
         * @throws DuplicateNameException if the new group name already exists
223
         * @throws ObjectNotFoundException if the user or group was not found, with
224
         *             the exception message mentioning the precise problem
225
         */
226
        public void createGroup(Long userId, String name) throws ObjectNotFoundException, DuplicateNameException;
227

    
228
        /**
229
         * Deletes the specified group in the specified user's namespace.
230
         *
231
         * @param userId the ID of the current user
232
         * @param groupId the ID of the group to delete
233
         * @throws ObjectNotFoundException if the user or group was not found, with
234
         *             the exception message mentioning the precise problem
235
         * @throws InsufficientPermissionsException
236
         */
237
        public void deleteGroup(Long userId, Long groupId) throws ObjectNotFoundException, InsufficientPermissionsException;
238

    
239
        /**
240
         * Creates a new file with the specified owner, parent folder and name. The
241
         * new file has the same permissions as its parent folder. The file contents
242
         * are read from the input stream to a new File object.
243
         *
244
         * @param userId the ID of the current user
245
         * @param folderId the ID of the parent folder
246
         * @param name the name of the new file
247
         * @param mimeType the MIME type of the file
248
         * @param stream the input stream with the file contents
249
         * @return The FileHeaderDTO created
250
         * @throws DuplicateNameException if the specified name already exists in
251
         *             the parent folder, as either a folder or file
252
         * @throws ObjectNotFoundException if the user or parent folder was not
253
         *             found, with the exception message mentioning the precise
254
         *             problem
255
         * @throws GSSIOException if there was an error while storing the file contents
256
         * @throws InsufficientPermissionsException
257
         */
258
        public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType, InputStream stream) throws DuplicateNameException, ObjectNotFoundException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
259

    
260
        /**
261
         * Deletes the specified file in the specified user's namespace.
262
         *
263
         * @param userId the ID of the current user
264
         * @param fileId the ID of the file to delete
265
         * @throws ObjectNotFoundException if the user or file was not found, with
266
         *             the exception message mentioning the precise problem
267
         * @throws InsufficientPermissionsException if the user does not have the
268
         *             appropriate privileges
269
         */
270
        public void deleteFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
271

    
272
        /**
273
         * Creates a new tag for the specified user and file.
274
         *
275
         * @param userId the creator of the tag
276
         * @param fileHeaderId the file that is tagged
277
         * @param tag the tag
278
         * @throws ObjectNotFoundException if the user or the file was not found
279
         */
280
        public void createTag(Long userId, Long fileHeaderId, String tag) throws ObjectNotFoundException;
281

    
282
        /**
283
         * Returns all tags defined by the specified user
284
         *
285
         * @param userId
286
         * @return Set<String>
287
         * @throws ObjectNotFoundException if the user was null
288
         */
289
        public Set<String> getUserTags(final Long userId) throws ObjectNotFoundException;
290

    
291
        /**
292
         * Updates name and tags for the specified file
293
         *
294
         * @param userId
295
         * @param fileId
296
         * @param name
297
         * @param tagSet a String that contains tags separated by comma
298
         * @throws ObjectNotFoundException
299
         * @throws InsufficientPermissionsException
300
         */
301
        public void updateFile(Long userId, Long fileId, String name, String tagSet) throws ObjectNotFoundException, InsufficientPermissionsException;
302

    
303
        /**
304
         * Retrieve the contents of the current body for the file
305
         * with the specified FileHeader ID. The file contents
306
         * are provided as an InputStream from which the caller can
307
         * retrieve the raw bytes.
308
         *
309
         * @param userId the ID of the current user
310
         * @param fileId the ID of the file to retrieve
311
         * @return an InputStream from the current file body contents
312
         * @throws ObjectNotFoundException if the file or the user was not found
313
         * @throws InsufficientPermissionsException  if the user does not have the
314
         *             appropriate privileges
315
         */
316
        public InputStream getFileContents(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
317

    
318
        /**
319
         * Retrieve the file with the specified ID.
320
         *
321
         * @param userId the ID of the current user
322
         * @param fileId the ID of the file to retrieve
323
         * @return the file found
324
         * @throws ObjectNotFoundException if the file or the user was not found, with
325
         *                         the exception message mentioning the precise problem
326
         * @throws InsufficientPermissionsException
327
         */
328
        public FileHeaderDTO getFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
329

    
330
        /**
331
         * Get the resource (file or folder) at the specified path in
332
         * the specified user's namespace. The returned object will be of type
333
         * FileHeaderDTO or FolderDTO.<p><strong>Note:</strong> this method does not
334
         * receive the current user as a parameter, therefore it is unable to perform
335
         * the necessary permission checks and should <strong>NOT</strong> be directly
336
         * exposed to remote clients. It is the caller's responsibility to verify that
337
         * the calling user has the required privileges for performing any subsequent
338
         * action on the resource through one of the other ExternalAPI methods.
339
         *
340
         * @param ownerId the ID of the user owning the namespace
341
         * @param path the absolute path in the user's namespace
342
         * @param ignoreDeleted if true, resources that have been moved to the trash
343
         *                         will be ignored
344
         * @throws ObjectNotFoundException if the user or resource was not found, with
345
         *                         the exception message mentioning the precise problem
346
         * @return the resource found
347
         */
348
        public Object getResourceAtPath(Long ownerId, String path, boolean ignoreDeleted)
349
                        throws ObjectNotFoundException;
350

    
351
        /**
352
         * Copy the provided file to the specified destination.
353
         *
354
         * @param userId the ID of the current user
355
         * @param fileId the IF of the provided file
356
         * @param dest the path to the destination folder
357
         * @throws ObjectNotFoundException if the user, file or destination was not
358
         *                         found, with        the exception message mentioning the precise problem
359
         * @throws GSSIOException if there was an error while accessing the file contents
360
         * @throws DuplicateNameException if the specified name already exists in
361
         *          the destination folder, as either a folder or file
362
         * @throws InsufficientPermissionsException
363
         */
364
        public void copyFile(Long userId, Long fileId, String dest) throws ObjectNotFoundException, DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
365

    
366
        /**
367
         * Copy the provided file to the specified destination.
368
         *
369
         * @param userId the ID of the current user
370
         * @param fileId the IF of the provided file
371
         * @param destId the ID of the destination folder
372
         * @param destName the name of the new file
373
         * @throws ObjectNotFoundException if the user, file or destination was not
374
         *                         found, with        the exception message mentioning the precise problem
375
         * @throws GSSIOException if there was an error while accessing the file contents
376
         * @throws DuplicateNameException if the specified name already exists in
377
         *          the destination folder, as either a folder or file
378
         * @throws InsufficientPermissionsException
379
         */
380
        public void copyFile(Long userId, Long fileId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
381

    
382
        /**
383
         * Copy the provided folder to the specified destination.
384
         *
385
         * @param userId the ID of the current user
386
         * @param folderId the IF of the provided folder
387
         * @param dest the path to the destination folder
388
         * @throws ObjectNotFoundException if the user, folder or destination was not
389
         *                         found, with        the exception message mentioning the precise problem
390
         * @throws DuplicateNameException if the specified name already exists in
391
         *          the destination folder, as either a folder or file
392
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
393
         *          appropriate privileges
394
         */
395
        public void copyFolder(Long userId, Long folderId, String dest) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException, QuotaExceededException;
396

    
397
        /**
398
         * Copy the provided folder to the specified destination.
399
         *
400
         * @param userId the ID of the current user
401
         * @param folderId the IF of the provided folder
402
         * @param destId the ID of the destination folder
403
         * @param destName the name of the new folder
404
         * @throws ObjectNotFoundException if the user, folder or destination was not
405
         *                         found, with        the exception message mentioning the precise problem
406
         * @throws DuplicateNameException if the specified name already exists in
407
         *          the destination folder, as either a folder or file
408
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
409
         *          appropriate privileges
410
         */
411
        public void copyFolder(Long userId, Long folderId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException, QuotaExceededException;
412

    
413
        /**
414
         * Copy the provided folder and all its subfolders and files to the specified destination.
415
         *
416
         * @param userId the ID of the current user
417
         * @param folderId the IF of the provided folder
418
         * @param destId the ID of the destination folder
419
         * @param destName the name of the new folder
420
         * @throws ObjectNotFoundException if the user, folder or destination was not
421
         *                         found, with        the exception message mentioning the precise problem
422
         * @throws DuplicateNameException if the specified name already exists in
423
         *          the destination folder, as either a folder or file
424
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
425
         *          appropriate privileges
426
         * @throws GSSIOException
427
         */
428
        public void copyFolderStructure(Long userId, Long folderId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,GSSIOException, QuotaExceededException;
429

    
430
        /**
431
         * Marks  the specified file as deleted in the specified user's namespace.
432
         *
433
         * @param userId the ID of the current user
434
         * @param fileId the ID of the file to delete
435
         * @throws ObjectNotFoundException if the user or file was not found, with
436
         *             the exception message mentioning the precise problem
437
         * @throws InsufficientPermissionsException if the user does not have the
438
         *             appropriate privileges
439
         */
440
        public void moveFileToTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
441

    
442
        /**
443
         * Marks  the specified deleted file as undeleted in the specified user's namespace.
444
         *
445
         * @param userId the ID of the current user
446
         * @param fileId the ID of the file to undelete
447
         * @throws ObjectNotFoundException if the user or file was not found, with
448
         *             the exception message mentioning the precise problem
449
         * @throws InsufficientPermissionsException if the user does not have the
450
         *             appropriate privileges
451
         */
452
        public void removeFileFromTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
453

    
454
        /**
455
         * Marks  the specified folder as deleted in the specified user's namespace.
456
         *
457
         * @param userId the ID of the current user
458
         * @param folderId the ID of the folder to delete
459
         * @throws ObjectNotFoundException if the user or file was not found, with
460
         *             the exception message mentioning the precise problem
461
         * @throws InsufficientPermissionsException if the user does not have the
462
         *             appropriate privileges
463
         */
464
        public void moveFolderToTrash(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
465

    
466
        /**
467
         * Marks  the specified deleted folder as undeleted in the specified user's namespace.
468
         *
469
         * @param userId the ID of the current user
470
         * @param folderId the ID of the folder to undelete
471
         * @throws ObjectNotFoundException if the user or file was not found, with
472
         *             the exception message mentioning the precise problem
473
         * @throws InsufficientPermissionsException if the user does not have the
474
         *             appropriate privileges
475
         */
476
        public void removeFolderFromTrash(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
477

    
478
        /**
479
         * Move the provided folder and all its subfolders and files to the specified destination.
480
         *
481
         * @param userId the ID of the current user
482
         * @param folderId the IF of the provided folder
483
         * @param destId the ID of the destination folder
484
         * @param destName the name of the new folder
485
         * @throws ObjectNotFoundException if the user, folder 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 InsufficientPermissionsException if the user does not have the
490
         *          appropriate privileges
491
         * @throws GSSIOException
492
         */
493
        public void moveFolder(Long userId, Long folderId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
494

    
495
        /**
496
         * move the provided file to the specified destination.
497
         *
498
         * @param userId the ID of the current user
499
         * @param fileId the IF of the provided file
500
         * @param destId the ID of the destination folder
501
         * @param destName the name of the new file
502
         * @throws InsufficientPermissionsException
503
         * @throws ObjectNotFoundException if the user, file or destination was not
504
         *                         found, with        the exception message mentioning the precise problem
505
         * @throws GSSIOException if there was an error while accessing the file contents
506
         * @throws DuplicateNameException if the specified name already exists in
507
         *          the destination folder, as either a folder or file
508
         */
509
        public void moveFile(Long userId, Long fileId, Long destId, String destName) throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException, GSSIOException, QuotaExceededException;
510

    
511
        /**
512
         * Returns a list of All deleted files of a user.
513
         *
514
         * @param userId the ID of the User
515
         *          * @return the list of deleted file header objects
516
         * @throws ObjectNotFoundException if the user cannot be found
517
         */
518
        public List<FileHeaderDTO> getDeletedFiles(Long userId) throws ObjectNotFoundException;
519

    
520
        /**
521
         * Returns a list of All deleted root folders of a user.
522
         *
523
         * @param userId the ID of the User
524
         *          * @return the list of deleted file header objects
525
         * @throws ObjectNotFoundException if the user cannot be found
526
         */
527
        public List<FolderDTO> getDeletedRootFolders(Long userId) throws ObjectNotFoundException;
528

    
529
        /**
530
         * Empty Trash by deleting all marked as deleted files and folders
531
         * @param userId
532
         * @throws ObjectNotFoundException if something goes wrong in the delete process
533
         * @throws InsufficientPermissionsException  if something goes wrong in the delete process
534
         */
535
        public void emptyTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
536

    
537
        /**
538
         * Restores All Trashed Items by undeleting all marked as deleted files and folders
539
         * @param userId
540
         * @throws ObjectNotFoundException if something goes wrong in the delete process
541
         * @throws InsufficientPermissionsException if the user does not have the
542
         *          appropriate privileges
543
         */
544
        public void restoreTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
545

    
546
        /**
547
         * Search the system for a user with the specified username.
548
         * If no such user is found, the method returns null.
549
         *
550
         * @param username the username to search for
551
         * @return the User object with the specified username
552
         */
553
        public User findUser(String username);
554

    
555
        /**
556
         * Create a new user with the specified name, username and e-mail address.
557
         *
558
         * @param username the username of the new user
559
         * @param name the full name of the new user
560
         * @param mail the e-mail of the new user
561
         * @return the newly-created User object
562
         * @throws DuplicateNameException if a user with the same username already exists
563
         * @throws ObjectNotFoundException if no username was provided
564
         */
565
        public User createUser(String username, String name, String mail) throws DuplicateNameException, ObjectNotFoundException;
566

    
567
        /**
568
         * Updates the authentication token for the specified user.
569
         *
570
         * @param userId the ID of the user whose token should be updated
571
         * @return the updated user
572
         * @throws ObjectNotFoundException if the user could not be found
573
         */
574
        public User updateUserToken(Long userId) throws ObjectNotFoundException;
575

    
576
        /**
577
         * Invalidates the authentication token for the specified user.
578
         *
579
         * @param userId the ID of the user whose token should be updated
580
         * @throws ObjectNotFoundException if the user could not be found
581
         */
582
        public void invalidateUserToken(Long userId) throws ObjectNotFoundException;
583

    
584
        /**
585
         * Retrieve folder user and group permissions
586
         *
587
         * @param userId the ID of the user whose token should be updated
588
         * @param folderId the ID of the folder
589
         * @return the Set of permissions from requested folder
590
         * @throws ObjectNotFoundException if the user or folder could not be found
591
         * @throws InsufficientPermissionsException
592
         */
593
        public Set<PermissionDTO> getFolderPermissions(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
594

    
595

    
596
        /**
597
         * update folder permissions
598
         * @param userId
599
         * @param folderId
600
         * @param permissions
601
         * @throws ObjectNotFoundException
602
         * @throws InsufficientPermissionsException
603
         */
604
        public void setFolderPermissions(Long userId, Long folderId, Set<PermissionDTO> permissions) throws ObjectNotFoundException, InsufficientPermissionsException;
605

    
606

    
607
        /**
608
         * Retrieve file user and group permissions
609
         *
610
         * @param userId the ID of the user whose token should be updated
611
         * @param fileId the ID of the folder
612
         * @return the Set of permissions from requested folder
613
         * @throws ObjectNotFoundException if the user or folder could not be found
614
         * @throws InsufficientPermissionsException
615
         */
616
        public Set<PermissionDTO> getFilePermissions(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
617

    
618

    
619
        /**
620
         * update file permissions
621
         * @param userId
622
         * @param fileId
623
         * @param permissions
624
         * @throws ObjectNotFoundException
625
         * @throws InsufficientPermissionsException
626
         */
627
        public void setFilePermissions(Long userId, Long fileId, Boolean ReadForAll, Set<PermissionDTO> permissions) throws ObjectNotFoundException, InsufficientPermissionsException;
628

    
629
        /**
630
         * Returns a list of All Shared root folders of a user.
631
         *
632
         * @param userId the ID of the User
633
         *          * @return the list of shared root folders
634
         * @throws ObjectNotFoundException if the user cannot be found
635
         */
636
        public List<FolderDTO> getSharedRootFolders(Long userId) throws ObjectNotFoundException;
637

    
638
        /**
639
         * Returns a list of All Shared  files of a user.
640
         *
641
         * @param userId the ID of the User
642
         *          * @return the list of shared files
643
         * @throws ObjectNotFoundException if the user cannot be found
644
         */
645
        public List<FileHeaderDTO> getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException;
646

    
647
        /**
648
         * Returns a list of All Shared root folders of a user that calling user has at least read permissions.
649
         *
650
         * @param ownerId the ID of the User
651
         * @return the list of shared root folders
652
         * @param callingUserId
653
         *
654
         * @throws ObjectNotFoundException if the user cannot be found
655
         */
656
        public List<FolderDTO> getSharedRootFolders(Long ownerId, Long callingUserId) throws ObjectNotFoundException;
657

    
658
        /**
659
         * Returns a list of All Shared  files of a user that calling user has at least read permissions..
660
         *
661
         * @param ownerId the ID of the User
662
         * @return the list of shared files
663
         * @param callingUserId
664
         * @throws ObjectNotFoundException if the user cannot be found
665
         */
666
        public List<FileHeaderDTO> getSharedFiles(Long ownerId, Long callingUserId) throws ObjectNotFoundException;
667

    
668
        /**
669
         * Remove a user member from a group
670
         *
671
         * @param userId the ID of the User owning the group
672
         * @param groupId the ID of the requested group
673
         * @param memberId the ID of the member to be removed
674
         *
675
         * @throws ObjectNotFoundException if the user or group was not found, with
676
         *             the exception message mentioning the precise problem
677
         * @throws InsufficientPermissionsException
678
         */
679
        public void removeMemberFromGroup(Long userId, Long groupId, Long memberId) throws ObjectNotFoundException, InsufficientPermissionsException;
680

    
681
        /**
682
         * Retrieves the list of users sharing files to user identified by user id
683
         * @param userId
684
         * @return the List of users sharing files to user
685
         * @throws ObjectNotFoundException
686
         */
687
        public List<UserDTO> getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException;
688

    
689
        /**
690
         * Indexes the file meta-data and contents. It actually sends the info to be indexed to a message queue
691
         * and the actual indexing will be done in the background
692
         *
693
         * @param fileId The id of the file to be indexed. The message processor will retreive all file data
694
         * by using this id
695
         * @param delete if true the file is removed from the index
696
         */
697
        public void indexFile(Long fileId, boolean delete);
698

    
699
        /**
700
         * Search Files
701
         *
702
         * @param userId
703
         * @param query
704
         * @return list of files that match query
705
         * @throws ObjectNotFoundException
706
         */
707
        public List<FileHeaderDTO> searchFiles(Long userId, String query) throws ObjectNotFoundException;
708

    
709
        /**
710
         * It is used by the Solr mbean to rebuild the index.
711
         */
712
        public void rebuildSolrIndex();
713

    
714
        /**
715
         * Search the system for a user with the specified email address.
716
         * If no such user is found, the method returns null.
717
         */
718
        public User findUserByEmail(String email);
719

    
720
        /**
721
         * Update the user with the values from the supplied object.
722
         */
723
        public void updateUser(User user);
724

    
725
        /**
726
         * Check if the user with the specified ID has permission to read the
727
         * folder with the supplied ID.
728
         */
729
        public boolean canReadFolder(Long userId, Long folderId) throws ObjectNotFoundException;
730
}