Added special message for AUTH users
[pithos] / src / gr / ebs / gss / server / ejb / ExternalAPIRemote.java
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.FileHeader;
27 import gr.ebs.gss.server.domain.Folder;
28 import gr.ebs.gss.server.domain.Group;
29 import gr.ebs.gss.server.domain.Permission;
30 import gr.ebs.gss.server.domain.User;
31
32 import java.io.InputStream;
33 import java.util.Date;
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 Folder 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 Folder 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 group with the specified ID.
79          *
80          * @param groupId The ID of the Group to be found
81          * @return The Group object
82          * @throws ObjectNotFoundException if the group cannot be found
83          */
84         public Group getGroup(Long groupId) throws ObjectNotFoundException;
85
86         /**
87          * Retrieve the list of groups for a particular user.
88          *
89          * @param userId the ID of the User
90          * @return a List of Groups that belong to the specified User
91          * @throws ObjectNotFoundException if the user was not found
92          */
93         public List<Group> getGroups(Long userId) throws ObjectNotFoundException;
94
95         /**
96          * Returns a list of files contained in the folder specified by its id.
97          *
98          * @param userId the ID of the User
99          * @param folderId the ID of the folder containing the files
100          * @param ignoreDeleted
101          * @return the list of file header objects
102          * @throws ObjectNotFoundException if the user or the folder cannot be found
103          * @throws InsufficientPermissionsException
104          */
105         public List<FileHeader> getFiles(Long userId, Long folderId, boolean ignoreDeleted) throws ObjectNotFoundException, InsufficientPermissionsException;
106
107         /**
108          * Returns a list of users for the specified group
109          *
110          * @param userId the ID of the User
111          * @param groupId the ID of the requested group
112          * @return List<User>
113          * @throws ObjectNotFoundException if the user or group was not found, with
114          *             the exception message mentioning the precise problem
115          */
116         public List<User> getUsers(Long userId, Long groupId) throws ObjectNotFoundException;
117
118         /**
119          * Returns a list of users for the specified username
120          *
121          * @param username the username of the User
122          * @return List<User>
123          */
124         public List<User> getUsersByUserNameLike(String username);
125
126         /**
127          * Creates a new folder with the specified owner, parent folder and name.
128          * New folder has the same permissions as its parent
129          *
130          * @param userId
131          * @param parentId
132          * @param name
133          * @return the new folder
134          * @throws DuplicateNameException if the specified name already exists in
135          *             the parent folder, as either a folder or file
136          * @throws ObjectNotFoundException if the user or parent folder was not
137          *             found, with the exception message mentioning the precise
138          *             problem
139          * @throws InsufficientPermissionsException
140          */
141         public Folder createFolder(Long userId, Long parentId, String name) throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException;
142
143         /**
144          * Deletes the specified folder if the specified user has the appropriate
145          * permission
146          *
147          * @param userId
148          * @param folderId
149          * @throws InsufficientPermissionsException if the user does not have the
150          *             appropriate privileges
151          * @throws ObjectNotFoundException if the user or folder was not found, with
152          *             the exception message mentioning the precise problem
153          */
154         public void deleteFolder(Long userId, Long folderId) throws InsufficientPermissionsException, ObjectNotFoundException;
155
156         /**
157          * Retrieve the subfolders of the specified folder.
158          *
159          * @param userId the ID of the current user
160          * @param folderId the ID of the folder to retrieve
161          * @return the list of subfolders found
162          * @throws ObjectNotFoundException if the folder or user was not found
163          * @throws InsufficientPermissionsException
164          */
165         public List<Folder> getSubfolders(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
166
167
168         /**
169          * Retrieve the subfolders of the specified folder that are shared to others.
170          *
171          * @param userId the ID of the current user
172          * @param folderId the ID of the folder to retrieve
173          * @return the list of subfolders found
174          * @throws ObjectNotFoundException if the folder or user was not found
175          */
176         public List<Folder> getSharedSubfolders(Long userId, Long folderId) throws ObjectNotFoundException;
177
178         /**
179          * Modifies the specified folder if the specified user has the appropriate
180          * permission.
181          *
182          * @param userId the ID of the current user
183          * @param folderId the ID of the folder to retrieve
184          * @param folderName
185          * @param readForAll
186          * @param permissions
187          * @return the updated folder
188          * @throws InsufficientPermissionsException if the user does not have the
189          *             appropriate privileges
190          * @throws ObjectNotFoundException if the user or folder was not found, with
191          *             the exception message mentioning the precise problem
192          * @throws DuplicateNameException if the specified name already exists in
193          *             the parent folder, as either a folder or file
194          */
195         public Folder updateFolder(Long userId, Long folderId, String folderName,
196                                 Boolean readForAll,
197                                 Set<Permission> permissions)
198                         throws InsufficientPermissionsException, ObjectNotFoundException,
199                         DuplicateNameException;
200
201         /**
202          * Adds a user to the specified group
203          *
204          * @param userId the ID of the current user
205          * @param groupId the id of the new group
206          * @param userToAddId the id of the user to add
207          * @throws DuplicateNameException if the user already exists in group
208          * @throws ObjectNotFoundException if the user or group was not found, with
209          *             the exception message mentioning the precise problem
210          * @throws InsufficientPermissionsException
211          */
212         public void addUserToGroup(Long userId, Long groupId, Long userToAddId) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException;
213
214         /**
215          * Creates a new group with the specified owner and name.
216          *
217          * @param userId the ID of the current user
218          * @param name the name of the new group
219          * @throws DuplicateNameException if the new group name already exists
220          * @throws ObjectNotFoundException if the user or group was not found, with
221          *             the exception message mentioning the precise problem
222          */
223         public void createGroup(Long userId, String name) throws ObjectNotFoundException, DuplicateNameException;
224
225         /**
226          * Deletes the specified group in the specified user's namespace.
227          *
228          * @param userId the ID of the current user
229          * @param groupId the ID of the group to delete
230          * @throws ObjectNotFoundException if the user or group was not found, with
231          *             the exception message mentioning the precise problem
232          * @throws InsufficientPermissionsException
233          */
234         public void deleteGroup(Long userId, Long groupId) throws ObjectNotFoundException, InsufficientPermissionsException;
235
236         /**
237          * Creates a new file with the specified owner, parent folder and name. The
238          * new file has the same permissions as its parent folder. The file contents
239          * are read from the input stream to a new File object.
240          *
241          * @param userId the ID of the current user
242          * @param folderId the ID of the parent folder
243          * @param name the name of the new file
244          * @param mimeType the MIME type of the file
245          * @param stream the input stream with the file contents
246          * @return The FileHeader created
247          * @throws DuplicateNameException if the specified name already exists in
248          *             the parent folder, as either a folder or file
249          * @throws ObjectNotFoundException if the user or parent folder was not
250          *             found, with the exception message mentioning the precise
251          *             problem
252          * @throws GSSIOException if there was an error while storing the file contents
253          * @throws InsufficientPermissionsException
254          */
255         public FileHeader createFile(Long userId, Long folderId, String name, String mimeType, InputStream stream) throws DuplicateNameException, ObjectNotFoundException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
256
257         /**
258          * Deletes the specified file in the specified user's namespace.
259          *
260          * @param userId the ID of the current user
261          * @param fileId the ID of the file to delete
262          * @throws ObjectNotFoundException if the user or file was not found, with
263          *             the exception message mentioning the precise problem
264          * @throws InsufficientPermissionsException if the user does not have the
265          *             appropriate privileges
266          */
267         public void deleteFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
268
269         /**
270          * Creates a new tag for the specified user and file.
271          *
272          * @param userId the creator of the tag
273          * @param fileHeaderId the file that is tagged
274          * @param tag the tag
275          * @throws ObjectNotFoundException if the user or the file was not found
276          */
277         public void createTag(Long userId, Long fileHeaderId, String tag) throws ObjectNotFoundException;
278
279         /**
280          * Returns all tags defined by the specified user
281          *
282          * @param userId
283          * @return Set<String>
284          * @throws ObjectNotFoundException if the user was null
285          */
286         public Set<String> getUserTags(final Long userId) throws ObjectNotFoundException;
287
288         /**
289          * Updates the attributes of the specified file.
290          *
291          * @param userId
292          * @param fileId
293          * @param name
294          * @param tagSet a String that contains tags separated by comma
295          * @param modificationDate the modification date
296          * @param versioned the new value of the versioned flag
297          * @param readForAll
298          * @param permissions
299          * @throws DuplicateNameException
300          * @throws ObjectNotFoundException
301          * @throws InsufficientPermissionsException
302          */
303         public void updateFile(Long userId, Long fileId, String name, String tagSet,
304                         Date modificationDate, Boolean versioned, Boolean readForAll,
305                         Set<Permission> permissions)
306                         throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException;
307
308         /**
309          * Retrieve the contents of the current body for the file
310          * with the specified FileHeader ID. The file contents
311          * are provided as an InputStream from which the caller can
312          * retrieve the raw bytes.
313          *
314          * @param userId the ID of the current user
315          * @param fileId the ID of the file to retrieve
316          * @return an InputStream from the current file body contents
317          * @throws ObjectNotFoundException if the file or the user was not found
318          * @throws InsufficientPermissionsException  if the user does not have the
319          *             appropriate privileges
320          */
321         public InputStream getFileContents(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
322
323         /**
324          * Retrieve the file with the specified ID.
325          *
326          * @param userId the ID of the current user
327          * @param fileId the ID of the file to retrieve
328          * @return the file found
329          * @throws ObjectNotFoundException if the file or the user was not found, with
330          *                      the exception message mentioning the precise problem
331          * @throws InsufficientPermissionsException
332          */
333         public FileHeader getFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
334
335         /**
336          * Get the resource (file or folder) at the specified path in
337          * the specified user's namespace. The returned object will be of type
338          * FileHeader or Folder.<p><strong>Note:</strong> this method does not
339          * receive the current user as a parameter, therefore it is unable to perform
340          * the necessary permission checks and should <strong>NOT</strong> be directly
341          * exposed to remote clients. It is the caller's responsibility to verify that
342          * the calling user has the required privileges for performing any subsequent
343          * action on the resource through one of the other ExternalAPI methods.
344          *
345          * @param ownerId the ID of the user owning the namespace
346          * @param path the absolute path in the user's namespace
347          * @param ignoreDeleted if true, resources that have been moved to the trash
348          *                      will be ignored
349          * @throws ObjectNotFoundException if the user or resource was not found, with
350          *                      the exception message mentioning the precise problem
351          * @return the resource found
352          */
353         public Object getResourceAtPath(Long ownerId, String path, boolean ignoreDeleted)
354                         throws ObjectNotFoundException;
355
356         /**
357          * Copy the provided file to the specified destination.
358          *
359          * @param userId the ID of the current user
360          * @param fileId the IF of the provided file
361          * @param dest the path to the destination folder
362          * @throws ObjectNotFoundException if the user, file or destination was not
363          *                      found, with     the exception message mentioning the precise problem
364          * @throws GSSIOException if there was an error while accessing the file contents
365          * @throws DuplicateNameException if the specified name already exists in
366          *          the destination folder, as either a folder or file
367          * @throws InsufficientPermissionsException
368          */
369         public void copyFile(Long userId, Long fileId, String dest) throws ObjectNotFoundException, DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
370
371         /**
372          * Copy the provided file to the specified destination.
373          *
374          * @param userId the ID of the current user
375          * @param fileId the IF of the provided file
376          * @param destId the ID of the destination folder
377          * @param destName the name of the new file
378          * @throws ObjectNotFoundException if the user, file or destination was not
379          *                      found, with     the exception message mentioning the precise problem
380          * @throws GSSIOException if there was an error while accessing the file contents
381          * @throws DuplicateNameException if the specified name already exists in
382          *          the destination folder, as either a folder or file
383          * @throws InsufficientPermissionsException
384          */
385         public void copyFile(Long userId, Long fileId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
386
387         /**
388          * Copy the provided folder to the specified destination.
389          *
390          * @param userId the ID of the current user
391          * @param folderId the IF of the provided folder
392          * @param dest the path to the destination folder
393          * @throws ObjectNotFoundException if the user, folder or destination was not
394          *                      found, with     the exception message mentioning the precise problem
395          * @throws DuplicateNameException if the specified name already exists in
396          *          the destination folder, as either a folder or file
397          * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
398          *          appropriate privileges
399          */
400         public void copyFolder(Long userId, Long folderId, String dest) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException, QuotaExceededException;
401
402         /**
403          * Copy the provided folder to the specified destination.
404          *
405          * @param userId the ID of the current user
406          * @param folderId the IF of the provided folder
407          * @param destId the ID of the destination folder
408          * @param destName the name of the new folder
409          * @throws ObjectNotFoundException if the user, folder or destination was not
410          *                      found, with     the exception message mentioning the precise problem
411          * @throws DuplicateNameException if the specified name already exists in
412          *          the destination folder, as either a folder or file
413          * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
414          *          appropriate privileges
415          */
416         public void copyFolder(Long userId, Long folderId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException, QuotaExceededException;
417
418         /**
419          * Copy the provided folder and all its subfolders and files to the specified destination.
420          *
421          * @param userId the ID of the current user
422          * @param folderId the IF of the provided folder
423          * @param destId the ID of the destination folder
424          * @param destName the name of the new folder
425          * @throws ObjectNotFoundException if the user, folder or destination was not
426          *                      found, with     the exception message mentioning the precise problem
427          * @throws DuplicateNameException if the specified name already exists in
428          *          the destination folder, as either a folder or file
429          * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
430          *          appropriate privileges
431          * @throws GSSIOException
432          */
433         public void copyFolderStructure(Long userId, Long folderId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,GSSIOException, QuotaExceededException;
434
435         /**
436          * Marks  the specified file as deleted in the specified user's namespace.
437          *
438          * @param userId the ID of the current user
439          * @param fileId the ID of the file to delete
440          * @throws ObjectNotFoundException if the user or file was not found, with
441          *             the exception message mentioning the precise problem
442          * @throws InsufficientPermissionsException if the user does not have the
443          *             appropriate privileges
444          */
445         public void moveFileToTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
446
447         /**
448          * Marks  the specified deleted file as undeleted in the specified user's namespace.
449          *
450          * @param userId the ID of the current user
451          * @param fileId the ID of the file to undelete
452          * @throws ObjectNotFoundException if the user or file was not found, with
453          *             the exception message mentioning the precise problem
454          * @throws InsufficientPermissionsException if the user does not have the
455          *             appropriate privileges
456          */
457         public void removeFileFromTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
458
459         /**
460          * Marks  the specified folder as deleted in the specified user's namespace.
461          *
462          * @param userId the ID of the current user
463          * @param folderId the ID of the folder to delete
464          * @throws ObjectNotFoundException if the user or file was not found, with
465          *             the exception message mentioning the precise problem
466          * @throws InsufficientPermissionsException if the user does not have the
467          *             appropriate privileges
468          */
469         public void moveFolderToTrash(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
470
471         /**
472          * Marks  the specified deleted folder as undeleted in the specified user's namespace.
473          *
474          * @param userId the ID of the current user
475          * @param folderId the ID of the folder to undelete
476          * @throws ObjectNotFoundException if the user or file was not found, with
477          *             the exception message mentioning the precise problem
478          * @throws InsufficientPermissionsException if the user does not have the
479          *             appropriate privileges
480          */
481         public void removeFolderFromTrash(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
482
483         /**
484          * Move the provided folder and all its subfolders and files to the specified destination.
485          *
486          * @param userId the ID of the current user
487          * @param folderId the IF of the provided folder
488          * @param destId the ID of the destination folder
489          * @param destName the name of the new folder
490          * @throws ObjectNotFoundException if the user, folder or destination was not
491          *                      found, with     the exception message mentioning the precise problem
492          * @throws DuplicateNameException if the specified name already exists in
493          *          the destination folder, as either a folder or file
494          * @throws InsufficientPermissionsException if the user does not have the
495          *          appropriate privileges
496          * @throws GSSIOException
497          */
498         public void moveFolder(Long userId, Long folderId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
499
500         /**
501          * move the provided file to the specified destination.
502          *
503          * @param userId the ID of the current user
504          * @param fileId the IF of the provided file
505          * @param destId the ID of the destination folder
506          * @param destName the name of the new file
507          * @throws InsufficientPermissionsException
508          * @throws ObjectNotFoundException if the user, file or destination was not
509          *                      found, with     the exception message mentioning the precise problem
510          * @throws GSSIOException if there was an error while accessing the file contents
511          * @throws DuplicateNameException if the specified name already exists in
512          *          the destination folder, as either a folder or file
513          */
514         public void moveFile(Long userId, Long fileId, Long destId, String destName) throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException, GSSIOException, QuotaExceededException;
515
516         /**
517          * Returns a list of All deleted files of a user.
518          *
519          * @param userId the ID of the User
520          *       * @return the list of deleted file header objects
521          * @throws ObjectNotFoundException if the user cannot be found
522          */
523         public List<FileHeader> getDeletedFiles(Long userId) throws ObjectNotFoundException;
524
525         /**
526          * Returns a list of All deleted root folders of a user.
527          *
528          * @param userId the ID of the User
529          *       * @return the list of deleted file header objects
530          * @throws ObjectNotFoundException if the user cannot be found
531          */
532         public List<Folder> getDeletedRootFolders(Long userId) throws ObjectNotFoundException;
533
534         /**
535          * Empty Trash by deleting all marked as deleted files and folders
536          * @param userId
537          * @throws ObjectNotFoundException if something goes wrong in the delete process
538          * @throws InsufficientPermissionsException  if something goes wrong in the delete process
539          */
540         public void emptyTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
541
542         /**
543          * Restores All Trashed Items by undeleting all marked as deleted files and folders
544          * @param userId
545          * @throws ObjectNotFoundException if something goes wrong in the delete process
546          * @throws InsufficientPermissionsException if the user does not have the
547          *          appropriate privileges
548          */
549         public void restoreTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
550
551         /**
552          * Search the system for a user with the specified username.
553          * If no such user is found, the method returns null.
554          *
555          * @param username the username to search for
556          * @return the User object with the specified username
557          */
558         public User findUser(String username);
559
560         /**
561          * Create a new user with the specified name, username and e-mail address.
562          *
563          * @param username the username of the new user
564          * @param name the full name of the new user
565          * @param mail the e-mail of the new user
566          * @param idp the IdP of the new user
567          * @param idpid the IdP ID of the new user
568          * @return the newly-created User object
569          * @throws DuplicateNameException if a user with the same username already exists
570          * @throws ObjectNotFoundException if no username was provided
571          */
572         public User createUser(String username, String name, String mail,
573                                 String idp, String idpid, String homeOrg) throws DuplicateNameException,
574                                 ObjectNotFoundException;
575
576         /**
577          * Updates the authentication token for the specified user.
578          *
579          * @param userId the ID of the user whose token should be updated
580          * @return the updated user
581          * @throws ObjectNotFoundException if the user could not be found
582          */
583         public User updateUserToken(Long userId) throws ObjectNotFoundException;
584
585         /**
586          * Invalidates the authentication token for the specified user.
587          *
588          * @param userId the ID of the user whose token should be updated
589          * @throws ObjectNotFoundException if the user could not be found
590          */
591         public void invalidateUserToken(Long userId) throws ObjectNotFoundException;
592
593         /**
594          * Retrieve folder user and group permissions
595          *
596          * @param userId the ID of the user whose token should be updated
597          * @param folderId the ID of the folder
598          * @return the Set of permissions from requested folder
599          * @throws ObjectNotFoundException if the user or folder could not be found
600          * @throws InsufficientPermissionsException
601          */
602         public Set<Permission> getFolderPermissions(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
603
604         /**
605          * Retrieve file user and group permissions
606          *
607          * @param userId the ID of the user whose token should be updated
608          * @param fileId the ID of the folder
609          * @return the Set of permissions from requested folder
610          * @throws ObjectNotFoundException if the user or folder could not be found
611          * @throws InsufficientPermissionsException
612          */
613         public Set<Permission> getFilePermissions(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
614
615         /**
616          * Returns a list of All Shared root folders of a user.
617          *
618          * @param userId the ID of the User
619          *       * @return the list of shared root folders
620          * @throws ObjectNotFoundException if the user cannot be found
621          */
622         public List<Folder> getSharedRootFolders(Long userId) throws ObjectNotFoundException;
623
624         /**
625          * Returns a list of All Shared  files of a user.
626          *
627          * @param userId the ID of the User
628          *       * @return the list of shared files
629          * @throws ObjectNotFoundException if the user cannot be found
630          */
631         public List<FileHeader> getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException;
632
633         /**
634          * Returns a list of All Shared root folders of a user that calling user has at least read permissions.
635          *
636          * @param ownerId the ID of the User
637          * @return the list of shared root folders
638          * @param callingUserId
639          *
640          * @throws ObjectNotFoundException if the user cannot be found
641          */
642         public List<Folder> getSharedRootFolders(Long ownerId, Long callingUserId) throws ObjectNotFoundException;
643
644         /**
645          * Returns a list of All Shared  files of a user that calling user has at least read permissions..
646          *
647          * @param ownerId the ID of the User
648          * @return the list of shared files
649          * @param callingUserId
650          * @throws ObjectNotFoundException if the user cannot be found
651          */
652         public List<FileHeader> getSharedFiles(Long ownerId, Long callingUserId) throws ObjectNotFoundException;
653
654         /**
655          * Remove a user member from a group
656          *
657          * @param userId the ID of the User owning the group
658          * @param groupId the ID of the requested group
659          * @param memberId the ID of the member to be removed
660          *
661          * @throws ObjectNotFoundException if the user or group was not found, with
662          *             the exception message mentioning the precise problem
663          * @throws InsufficientPermissionsException
664          */
665         public void removeMemberFromGroup(Long userId, Long groupId, Long memberId) throws ObjectNotFoundException, InsufficientPermissionsException;
666
667         /**
668          * Retrieves the list of users sharing files to user identified by user id
669          * @param userId
670          * @return the List of users sharing files to user
671          * @throws ObjectNotFoundException
672          */
673         public List<User> getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException;
674
675         /**
676          * Search Files
677          *
678          * @param userId
679          * @param query
680          * @return list of files that match query
681          * @throws ObjectNotFoundException
682          */
683         public List<FileHeader> searchFiles(Long userId, String query) throws ObjectNotFoundException;
684
685         /**
686          * It is used by the Solr mbean to rebuild the index.
687          */
688         public String rebuildSolrIndex();
689
690         /**
691          * Search the system for a user with the specified email address.
692          * If no such user is found, the method returns null.
693          */
694         public User findUserByEmail(String email);
695
696         /**
697          * Update the user with the values from the supplied object.
698          */
699         public void updateUser(User user);
700
701         /**
702          * Check if the user with the specified ID has permission to read the
703          * folder with the supplied ID.
704          */
705         public boolean canReadFolder(Long userId, Long folderId) throws ObjectNotFoundException;
706 }