X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/77dcb3f10732baf7c4efe5c3c3f07a1fbc002cee..6b5bd65e5ebd1dc17c51a70fa82cd1514bf96005:/src/gr/ebs/gss/server/ejb/ExternalAPIRemote.java diff --git a/src/gr/ebs/gss/server/ejb/ExternalAPIRemote.java b/src/gr/ebs/gss/server/ejb/ExternalAPIRemote.java index 6c2c9e3..96fac30 100644 --- a/src/gr/ebs/gss/server/ejb/ExternalAPIRemote.java +++ b/src/gr/ebs/gss/server/ejb/ExternalAPIRemote.java @@ -23,14 +23,14 @@ import gr.ebs.gss.client.exceptions.GSSIOException; import gr.ebs.gss.client.exceptions.InsufficientPermissionsException; import gr.ebs.gss.client.exceptions.ObjectNotFoundException; import gr.ebs.gss.client.exceptions.QuotaExceededException; +import gr.ebs.gss.server.domain.FileHeader; +import gr.ebs.gss.server.domain.Folder; +import gr.ebs.gss.server.domain.Group; +import gr.ebs.gss.server.domain.Permission; import gr.ebs.gss.server.domain.User; -import gr.ebs.gss.server.domain.dto.FileHeaderDTO; -import gr.ebs.gss.server.domain.dto.FolderDTO; -import gr.ebs.gss.server.domain.dto.GroupDTO; -import gr.ebs.gss.server.domain.dto.PermissionDTO; -import gr.ebs.gss.server.domain.dto.UserDTO; import java.io.InputStream; +import java.util.Date; import java.util.List; import java.util.Set; @@ -52,7 +52,7 @@ public interface ExternalAPIRemote { * @return Folder * @throws ObjectNotFoundException if no Folder or user was found */ - public FolderDTO getRootFolder(Long userId) throws ObjectNotFoundException; + public Folder getRootFolder(Long userId) throws ObjectNotFoundException; /** * Retrieve the folder with the specified ID. @@ -63,7 +63,7 @@ public interface ExternalAPIRemote { * @throws ObjectNotFoundException if the folder or the user was not found * @throws InsufficientPermissionsException if ther user does not have read permissions for folder */ - public FolderDTO getFolder(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException; + public Folder getFolder(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException; /** * Returns the user with the specified ID. @@ -75,22 +75,13 @@ public interface ExternalAPIRemote { public User getUser(Long userId) throws ObjectNotFoundException; /** - * Returns the user with the specified ID. - * - * @param userId The ID of the User to be found - * @return The User object - * @throws ObjectNotFoundException if the user cannot be found - */ - public UserDTO getUserDTO(Long userId) throws ObjectNotFoundException; - - /** * Returns the group with the specified ID. * * @param groupId The ID of the Group to be found * @return The Group object * @throws ObjectNotFoundException if the group cannot be found */ - public GroupDTO getGroup(Long groupId) throws ObjectNotFoundException; + public Group getGroup(Long groupId) throws ObjectNotFoundException; /** * Retrieve the list of groups for a particular user. @@ -99,7 +90,7 @@ public interface ExternalAPIRemote { * @return a List of Groups that belong to the specified User * @throws ObjectNotFoundException if the user was not found */ - public List getGroups(Long userId) throws ObjectNotFoundException; + public List getGroups(Long userId) throws ObjectNotFoundException; /** * Returns a list of files contained in the folder specified by its id. @@ -111,26 +102,26 @@ public interface ExternalAPIRemote { * @throws ObjectNotFoundException if the user or the folder cannot be found * @throws InsufficientPermissionsException */ - public List getFiles(Long userId, Long folderId, boolean ignoreDeleted) throws ObjectNotFoundException, InsufficientPermissionsException; + public List getFiles(Long userId, Long folderId, boolean ignoreDeleted) throws ObjectNotFoundException, InsufficientPermissionsException; /** * Returns a list of users for the specified group * * @param userId the ID of the User * @param groupId the ID of the requested group - * @return List + * @return List * @throws ObjectNotFoundException if the user or group was not found, with * the exception message mentioning the precise problem */ - public List getUsers(Long userId, Long groupId) throws ObjectNotFoundException; + public List getUsers(Long userId, Long groupId) throws ObjectNotFoundException; /** * Returns a list of users for the specified username * * @param username the username of the User - * @return List + * @return List */ - public List getUsersByUserNameLike(String username); + public List getUsersByUserNameLike(String username); /** * Creates a new folder with the specified owner, parent folder and name. @@ -139,6 +130,7 @@ public interface ExternalAPIRemote { * @param userId * @param parentId * @param name + * @return the new folder * @throws DuplicateNameException if the specified name already exists in * the parent folder, as either a folder or file * @throws ObjectNotFoundException if the user or parent folder was not @@ -146,7 +138,7 @@ public interface ExternalAPIRemote { * problem * @throws InsufficientPermissionsException */ - public void createFolder(Long userId, Long parentId, String name) throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException; + public Folder createFolder(Long userId, Long parentId, String name) throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException; /** * Deletes the specified folder if the specified user has the appropriate @@ -170,7 +162,7 @@ public interface ExternalAPIRemote { * @throws ObjectNotFoundException if the folder or user was not found * @throws InsufficientPermissionsException */ - public List getSubfolders(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException; + public List getSubfolders(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException; /** @@ -181,7 +173,7 @@ public interface ExternalAPIRemote { * @return the list of subfolders found * @throws ObjectNotFoundException if the folder or user was not found */ - public List getSharedSubfolders(Long userId, Long folderId) throws ObjectNotFoundException; + public List getSharedSubfolders(Long userId, Long folderId) throws ObjectNotFoundException; /** * Modifies the specified folder if the specified user has the appropriate @@ -190,6 +182,8 @@ public interface ExternalAPIRemote { * @param userId the ID of the current user * @param folderId the ID of the folder to retrieve * @param folderName + * @param readForAll + * @param permissions * @return the updated folder * @throws InsufficientPermissionsException if the user does not have the * appropriate privileges @@ -198,7 +192,11 @@ public interface ExternalAPIRemote { * @throws DuplicateNameException if the specified name already exists in * the parent folder, as either a folder or file */ - public FolderDTO modifyFolder(Long userId, Long folderId, String folderName) throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException; + public Folder updateFolder(Long userId, Long folderId, String folderName, + Boolean readForAll, + Set permissions) + throws InsufficientPermissionsException, ObjectNotFoundException, + DuplicateNameException; /** * Adds a user to the specified group @@ -245,7 +243,7 @@ public interface ExternalAPIRemote { * @param name the name of the new file * @param mimeType the MIME type of the file * @param stream the input stream with the file contents - * @return The FileHeaderDTO created + * @return The FileHeader created * @throws DuplicateNameException if the specified name already exists in * the parent folder, as either a folder or file * @throws ObjectNotFoundException if the user or parent folder was not @@ -254,7 +252,7 @@ public interface ExternalAPIRemote { * @throws GSSIOException if there was an error while storing the file contents * @throws InsufficientPermissionsException */ - public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType, InputStream stream) throws DuplicateNameException, ObjectNotFoundException, GSSIOException, InsufficientPermissionsException, QuotaExceededException; + public FileHeader createFile(Long userId, Long folderId, String name, String mimeType, InputStream stream) throws DuplicateNameException, ObjectNotFoundException, GSSIOException, InsufficientPermissionsException, QuotaExceededException; /** * Deletes the specified file in the specified user's namespace. @@ -288,16 +286,24 @@ public interface ExternalAPIRemote { public Set getUserTags(final Long userId) throws ObjectNotFoundException; /** - * Updates name and tags for the specified file + * Updates the attributes of the specified file. * * @param userId * @param fileId * @param name * @param tagSet a String that contains tags separated by comma + * @param modificationDate the modification date + * @param versioned the new value of the versioned flag + * @param readForAll + * @param permissions + * @throws DuplicateNameException * @throws ObjectNotFoundException * @throws InsufficientPermissionsException */ - public void updateFile(Long userId, Long fileId, String name, String tagSet) throws ObjectNotFoundException, InsufficientPermissionsException; + public void updateFile(Long userId, Long fileId, String name, String tagSet, + Date modificationDate, Boolean versioned, Boolean readForAll, + Set permissions) + throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException; /** * Retrieve the contents of the current body for the file @@ -324,12 +330,12 @@ public interface ExternalAPIRemote { * the exception message mentioning the precise problem * @throws InsufficientPermissionsException */ - public FileHeaderDTO getFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException; + public FileHeader getFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException; /** * Get the resource (file or folder) at the specified path in * the specified user's namespace. The returned object will be of type - * FileHeaderDTO or FolderDTO.

Note: this method does not + * FileHeader or Folder.

Note: this method does not * receive the current user as a parameter, therefore it is unable to perform * the necessary permission checks and should NOT be directly * exposed to remote clients. It is the caller's responsibility to verify that @@ -514,7 +520,7 @@ public interface ExternalAPIRemote { * * @return the list of deleted file header objects * @throws ObjectNotFoundException if the user cannot be found */ - public List getDeletedFiles(Long userId) throws ObjectNotFoundException; + public List getDeletedFiles(Long userId) throws ObjectNotFoundException; /** * Returns a list of All deleted root folders of a user. @@ -523,7 +529,7 @@ public interface ExternalAPIRemote { * * @return the list of deleted file header objects * @throws ObjectNotFoundException if the user cannot be found */ - public List getDeletedRootFolders(Long userId) throws ObjectNotFoundException; + public List getDeletedRootFolders(Long userId) throws ObjectNotFoundException; /** * Empty Trash by deleting all marked as deleted files and folders @@ -557,11 +563,15 @@ public interface ExternalAPIRemote { * @param username the username of the new user * @param name the full name of the new user * @param mail the e-mail of the new user + * @param idp the IdP of the new user + * @param idpid the IdP ID of the new user * @return the newly-created User object * @throws DuplicateNameException if a user with the same username already exists * @throws ObjectNotFoundException if no username was provided */ - public User createUser(String username, String name, String mail) throws DuplicateNameException, ObjectNotFoundException; + public User createUser(String username, String name, String mail, + String idp, String idpid, String homeOrg) throws DuplicateNameException, + ObjectNotFoundException; /** * Updates the authentication token for the specified user. @@ -589,19 +599,7 @@ public interface ExternalAPIRemote { * @throws ObjectNotFoundException if the user or folder could not be found * @throws InsufficientPermissionsException */ - public Set getFolderPermissions(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException; - - - /** - * update folder permissions - * @param userId - * @param folderId - * @param permissions - * @throws ObjectNotFoundException - * @throws InsufficientPermissionsException - */ - public void setFolderPermissions(Long userId, Long folderId, Set permissions) throws ObjectNotFoundException, InsufficientPermissionsException; - + public Set getFolderPermissions(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException; /** * Retrieve file user and group permissions @@ -612,18 +610,7 @@ public interface ExternalAPIRemote { * @throws ObjectNotFoundException if the user or folder could not be found * @throws InsufficientPermissionsException */ - public Set getFilePermissions(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException; - - - /** - * update file permissions - * @param userId - * @param fileId - * @param permissions - * @throws ObjectNotFoundException - * @throws InsufficientPermissionsException - */ - public void setFilePermissions(Long userId, Long fileId, Boolean ReadForAll, Set permissions) throws ObjectNotFoundException, InsufficientPermissionsException; + public Set getFilePermissions(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException; /** * Returns a list of All Shared root folders of a user. @@ -632,7 +619,7 @@ public interface ExternalAPIRemote { * * @return the list of shared root folders * @throws ObjectNotFoundException if the user cannot be found */ - public List getSharedRootFolders(Long userId) throws ObjectNotFoundException; + public List getSharedRootFolders(Long userId) throws ObjectNotFoundException; /** * Returns a list of All Shared files of a user. @@ -641,7 +628,7 @@ public interface ExternalAPIRemote { * * @return the list of shared files * @throws ObjectNotFoundException if the user cannot be found */ - public List getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException; + public List getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException; /** * Returns a list of All Shared root folders of a user that calling user has at least read permissions. @@ -652,7 +639,7 @@ public interface ExternalAPIRemote { * * @throws ObjectNotFoundException if the user cannot be found */ - public List getSharedRootFolders(Long ownerId, Long callingUserId) throws ObjectNotFoundException; + public List getSharedRootFolders(Long ownerId, Long callingUserId) throws ObjectNotFoundException; /** * Returns a list of All Shared files of a user that calling user has at least read permissions.. @@ -662,7 +649,7 @@ public interface ExternalAPIRemote { * @param callingUserId * @throws ObjectNotFoundException if the user cannot be found */ - public List getSharedFiles(Long ownerId, Long callingUserId) throws ObjectNotFoundException; + public List getSharedFiles(Long ownerId, Long callingUserId) throws ObjectNotFoundException; /** * Remove a user member from a group @@ -683,17 +670,7 @@ public interface ExternalAPIRemote { * @return the List of users sharing files to user * @throws ObjectNotFoundException */ - public List getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException; - - /** - * Indexes the file meta-data and contents. It actually sends the info to be indexed to a message queue - * and the actual indexing will be done in the background - * - * @param fileId The id of the file to be indexed. The message processor will retreive all file data - * by using this id - * @param delete if true the file is removed from the index - */ - public void indexFile(Long fileId, boolean delete); + public List getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException; /** * Search Files @@ -703,12 +680,12 @@ public interface ExternalAPIRemote { * @return list of files that match query * @throws ObjectNotFoundException */ - public List searchFiles(Long userId, String query) throws ObjectNotFoundException; + public List searchFiles(Long userId, String query) throws ObjectNotFoundException; /** * It is used by the Solr mbean to rebuild the index. */ - public void rebuildSolrIndex(); + public String rebuildSolrIndex(); /** * Search the system for a user with the specified email address.