import gr.ebs.gss.client.exceptions.InvitationUsedException;
import gr.ebs.gss.client.exceptions.ObjectNotFoundException;
import gr.ebs.gss.client.exceptions.QuotaExceededException;
+import gr.ebs.gss.server.domain.FileBody;
import gr.ebs.gss.server.domain.FileHeader;
+import gr.ebs.gss.server.domain.FileLock;
import gr.ebs.gss.server.domain.FileUploadStatus;
+import gr.ebs.gss.server.domain.Folder;
+import gr.ebs.gss.server.domain.Group;
import gr.ebs.gss.server.domain.Invitation;
import gr.ebs.gss.server.domain.Nonce;
+import gr.ebs.gss.server.domain.Permission;
import gr.ebs.gss.server.domain.User;
import gr.ebs.gss.server.domain.UserClass;
import gr.ebs.gss.server.domain.UserLogin;
-import gr.ebs.gss.server.domain.dto.FileBodyDTO;
-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.StatsDTO;
-import gr.ebs.gss.server.domain.dto.UserDTO;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
import java.util.Date;
import java.util.List;
import java.util.Set;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
+import gr.ebs.gss.server.domain.WebDavNonce;
+import gr.ebs.gss.server.domain.dto.FileHeaderDTO;
+import gr.ebs.gss.server.domain.dto.StatsDTO;
+import gr.ebs.gss.server.domain.dto.UserDTO;
+import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
/**
* @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.
* @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,
+ public Folder getFolder(Long userId, Long folderId) throws ObjectNotFoundException,
InsufficientPermissionsException;
/**
* @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;
/**
* Returns the group with the specified name that belongs to the
* @return The Group object
* @throws ObjectNotFoundException if the group cannot be found
*/
- public GroupDTO getGroup(Long userId, String name) throws ObjectNotFoundException;
+ public Group getGroup(Long userId, String name) throws ObjectNotFoundException;
/**
* Retrieve the list of groups for a particular user.
* @return a List of Groups that belong to the specified User
* @throws ObjectNotFoundException if the user was not found
*/
- public List<GroupDTO> getGroups(Long userId) throws ObjectNotFoundException;
+ public List<Group> getGroups(Long userId) throws ObjectNotFoundException;
/**
* Returns a list of files contained in the folder specified by its id.
* @throws ObjectNotFoundException if the user or the folder cannot be found
* @throws InsufficientPermissionsException
*/
- public List<FileHeaderDTO> getFiles(Long userId, Long folderId, boolean ignoreDeleted) throws ObjectNotFoundException,
+ public List<FileHeader> getFiles(Long userId, Long folderId, boolean ignoreDeleted) throws ObjectNotFoundException,
InsufficientPermissionsException;
/**
*
* @param userId the ID of the User
* @param groupId the ID of the requested group
- * @return List<UserDTO>
+ * @return List<User>
* @throws ObjectNotFoundException if the user or group was not found, with
* the exception message mentioning the precise problem
*/
- public List<UserDTO> getUsers(Long userId, Long groupId) throws ObjectNotFoundException;
+ public List<User> getUsers(Long userId, Long groupId) throws ObjectNotFoundException;
/**
* Returns a list of users matching the specified username
*
* @param username the username of the User
- * @return List<UserDTO>
+ * @return List<User>
*/
- public List<UserDTO> getUsersByUserNameLike(String username);
+ public List<User> getUsersByUserNameLike(String username);
/**
* Creates a new folder with the specified owner, parent folder and name.
* problem
* @throws InsufficientPermissionsException
*/
- public FolderDTO createFolder(Long userId, Long parentId, String name) throws DuplicateNameException,
+ public Folder createFolder(Long userId, Long parentId, String name) throws DuplicateNameException,
ObjectNotFoundException, InsufficientPermissionsException;
/**
* @throws ObjectNotFoundException if the folder or user was not found
* @throws InsufficientPermissionsException
*/
- public List<FolderDTO> getSubfolders(Long userId, Long folderId)
- throws ObjectNotFoundException, InsufficientPermissionsException;
-
- /**
- * Retrieve the folder with the specified ID with subfolders.
- *
- * @param userId the ID of the current user
- * @param folderId the ID of the folder to retrieve
- * @return the folder found
- * @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 getFolderWithSubfolders(Long userId, Long folderId)
+ public List<Folder> getSubfolders(Long userId, Long folderId)
throws ObjectNotFoundException, InsufficientPermissionsException;
/**
- * Retrieve the folder with the specified ID with subfolders.
- *
- * @param userId the ID of the current user
- * @param callingUserId the ID of the user requesting this operation
- * @param folderId the ID of the folder to retrieve
- * @return the folder found
- * @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 getFolderWithSubfolders(Long userId, Long callingUserId, Long folderId)
- throws ObjectNotFoundException, InsufficientPermissionsException;
- /**
* Retrieve the subfolders of the specified folder that are shared to others.
*
* @param userId the ID of the current user
* @return the list of subfolders found
* @throws ObjectNotFoundException if the folder or user was not found
*/
- public List<FolderDTO> getSharedSubfolders(Long userId, Long folderId) throws ObjectNotFoundException;
+ public List<Folder> getSharedSubfolders(Long userId, Long folderId) throws ObjectNotFoundException;
/**
* Retrieve the subfolders of the specified folder that are shared to others.
* @return the list of subfolders found
* @throws ObjectNotFoundException if the folder or user was not found
*/
- public List<FolderDTO> getSharedSubfolders(Long userId, Long callingUserId, Long folderId) throws ObjectNotFoundException;
+ public List<Folder> getSharedSubfolders(Long userId, Long callingUserId, Long folderId) throws ObjectNotFoundException;
/**
* Modifies the specified folder if the specified user has the appropriate
* permission.
* @throws DuplicateNameException if the specified name already exists in
* the parent folder, as either a folder or file
*/
- public FolderDTO updateFolder(Long userId, Long folderId, String folderName,
+ public Folder updateFolder(Long userId, Long folderId, String folderName,
Boolean readForAll,
- Set<PermissionDTO> permissions)
+ Set<Permission> permissions)
throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException;
/**
* @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
* @throws InsufficientPermissionsException
* @throws QuotaExceededException
*/
- public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType,
+ public FileHeader createFile(Long userId, Long folderId, String name, String mimeType,
InputStream stream) throws DuplicateNameException, ObjectNotFoundException,
GSSIOException, InsufficientPermissionsException, QuotaExceededException;
public void deleteFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
/**
- * Deletes the specified file in the specified user's namespace.
- *
- * @param userId the ID of the current user
- * @param fileIds the IDs of the files to delete
- * @throws ObjectNotFoundException if the user or file was not found, with
- * the exception message mentioning the precise problem
- * @throws InsufficientPermissionsException if the user does not have the
- * appropriate privileges
- */
- public void deleteFiles(Long userId, List<Long> fileIds)
- throws ObjectNotFoundException, InsufficientPermissionsException;
-
- /**
* Creates a new tag for the specified user and file.
*
* @param userId the creator of the tag
*/
public void updateFile(Long userId, Long fileId, String name, String tagSet,
Date modificationDate, Boolean versioned, Boolean readForAll,
- Set<PermissionDTO> permissions)
+ Set<Permission> permissions)
throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException;
/**
* the exception message mentioning the precise problem
* @throws InsufficientPermissionsException
*/
- public FileHeaderDTO getFile(Long userId, Long fileId) throws ObjectNotFoundException,
+ public FileHeader getFile(Long userId, Long fileId) throws ObjectNotFoundException,
InsufficientPermissionsException;
/**
* the exception message mentioning the precise problem
* @throws InsufficientPermissionsException
*/
- public FileBodyDTO getFileBody(Long userId, Long fileId, Long bodyId)
+ public FileBody getFileBody(Long userId, Long fileId, Long bodyId)
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.<p><strong>Note:</strong> this method does not
+ * FileHeader or Folder.<p><strong>Note:</strong> this method does not
* receive the current user as a parameter, therefore it is unable to perform
* the necessary permission checks and should <strong>NOT</strong> be directly
* exposed to remote clients. It is the caller's responsibility to verify that
public void removeFileFromTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
/**
- * Marks the specified deleted files as undeleted in the specified user's namespace.
- *
- * @param userId the ID of the current user
- * @param fileIds the IDs of the file to undelete
- * @throws ObjectNotFoundException if the user or file was not found, with
- * the exception message mentioning the precise problem
- * @throws InsufficientPermissionsException if the user does not have the
- * appropriate privileges
- */
- public void removeFilesFromTrash(Long userId, List<Long> fileIds) throws ObjectNotFoundException, InsufficientPermissionsException;
-
- /**
* Marks the specified folder as deleted in the specified user's namespace.
*
* @param userId the ID of the current user
* * @return the list of deleted file header objects
* @throws ObjectNotFoundException if the user cannot be found
*/
- public List<FileHeaderDTO> getDeletedFiles(Long userId) throws ObjectNotFoundException;
+ public List<FileHeader> getDeletedFiles(Long userId) throws ObjectNotFoundException;
/**
* Returns a list of All deleted root folders of a user.
* * @return the list of deleted file header objects
* @throws ObjectNotFoundException if the user cannot be found
*/
- public List<FolderDTO> getDeletedRootFolders(Long userId) throws ObjectNotFoundException;
+ public List<Folder> getDeletedRootFolders(Long userId) throws ObjectNotFoundException;
/**
* Empty Trash by deleting all marked as deleted files and folders
* @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, String idp, String idpid)
+ public User createUser(String username, String name, String mail, String idp, String idpid, String homeOrg)
throws DuplicateNameException, ObjectNotFoundException;
/**
* @throws ObjectNotFoundException if the user or folder could not be found
* @throws InsufficientPermissionsException
*/
- public Set<PermissionDTO> getFolderPermissions(Long userId, Long folderId)
+ public Set<Permission> getFolderPermissions(Long userId, Long folderId)
throws ObjectNotFoundException, InsufficientPermissionsException;
/**
* @throws ObjectNotFoundException if the user or folder could not be found
* @throws InsufficientPermissionsException
*/
- public Set<PermissionDTO> getFilePermissions(Long userId, Long fileId)
+ public Set<Permission> getFilePermissions(Long userId, Long fileId)
throws ObjectNotFoundException, InsufficientPermissionsException;
/**
* @return the list of shared root folders
* @throws ObjectNotFoundException if the user cannot be found
*/
- public List<FolderDTO> getSharedRootFolders(Long userId) throws ObjectNotFoundException;
+ public List<Folder> getSharedRootFolders(Long userId) throws ObjectNotFoundException;
/**
* Returns a list of all shared files of a user that are not
* @return the list of shared files
* @throws ObjectNotFoundException if the user cannot be found
*/
- public List<FileHeaderDTO> getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException;
+ public List<FileHeader> getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException;
/**
* Returns a list of all shared files of a user.
* @return the list of shared files
* @throws ObjectNotFoundException if the user cannot be found
*/
- public List<FileHeaderDTO> getSharedFiles(Long userId) throws ObjectNotFoundException;
+ public List<FileHeader> getSharedFiles(Long userId) throws ObjectNotFoundException;
/**
* Returns a list of all shared folders of a user.
* @return the list of shared folders
* @throws ObjectNotFoundException if the user cannot be found
*/
- public List<FolderDTO> getSharedFolders(Long userId) throws ObjectNotFoundException;
+ public List<Folder> getSharedFolders(Long userId) throws ObjectNotFoundException;
/**
* Returns a list of all shared root folders of a user that calling
*
* @throws ObjectNotFoundException if the user cannot be found
*/
- public List<FolderDTO> getSharedRootFolders(Long ownerId, Long callingUserId)
+ public List<Folder> getSharedRootFolders(Long ownerId, Long callingUserId)
throws ObjectNotFoundException;
/**
* @param callingUserId
* @throws ObjectNotFoundException if the user cannot be found
*/
- public List<FileHeaderDTO> getSharedFiles(Long ownerId, Long callingUserId)
+ public List<FileHeader> getSharedFiles(Long ownerId, Long callingUserId)
throws ObjectNotFoundException;
/**
* @return the List of users sharing files to user
* @throws ObjectNotFoundException
*/
- public List<UserDTO> getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException;
+ public List<User> getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException;
/**
* Search Files
public StatsDTO getUserStatistics(Long userId) throws ObjectNotFoundException;
/**
- * Retrieves file versions
- *
- * @param userId the ID of the user
- * @param fileId the ID of the file
- * @return the list of filebodies
- * @throws ObjectNotFoundException
- * @throws InsufficientPermissionsException
- *
- */
- public List<FileBodyDTO> getVersions(Long userId, Long fileId)
- throws ObjectNotFoundException, InsufficientPermissionsException;
-
- /**
* Restore the file contents to the specified version.
*
* @param userId the ID of the user
throws ObjectNotFoundException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
/**
- * Remove file version identified by bodyId
- *
- * @param userId the ID of the user
- * @param fileId the ID of the file
- * @param bodyId the ID of the body
- *
- * @throws ObjectNotFoundException
- * @throws InsufficientPermissionsException
- *
- */
- public void removeVersion(Long userId, Long fileId, Long bodyId)
- throws ObjectNotFoundException, InsufficientPermissionsException;
-
- /**
* Removes all old file versions for specified file keeping only the current revision
*
* @param userId the ID of the user
* @param mimeType the MIME type of the file
* @param fileSize the uploaded file size
* @param filePath the uploaded file full path
- * @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
* @throws InsufficientPermissionsException
* @throws QuotaExceededException
*/
- public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType, long fileSize, String filePath)
+ public FileHeader createFile(Long userId, Long folderId, String name, String mimeType, long fileSize, String filePath)
throws DuplicateNameException, ObjectNotFoundException, GSSIOException,
InsufficientPermissionsException, QuotaExceededException;
* @param mimeType the content type of the file
* @param fileSize the uploaded file size
* @param filePath the uploaded file full path
- * @return The FileHeaderDTO updated
+ * @return The FileHeader updated
* @throws ObjectNotFoundException if the user or file was not found, with
* the exception message mentioning the precise problem
* @throws GSSIOException when an IO exception occurs
* @throws InsufficientPermissionsException
* @throws QuotaExceededException
*/
- public FileHeaderDTO updateFileContents(Long userId, Long fileId, String mimeType,
+ public FileHeader updateFileContents(Long userId, Long fileId, String mimeType,
long fileSize, String filePath) throws ObjectNotFoundException, GSSIOException,
InsufficientPermissionsException, QuotaExceededException;
* @throws InsufficientPermissionsException if the user does not
* have enough privileges for reading this file
*/
- public FileBodyDTO getFileVersion(Long userId, Long fileId, int version) throws ObjectNotFoundException, InsufficientPermissionsException;
+ public FileBody getFileVersion(Long userId, Long fileId, int version) throws ObjectNotFoundException, InsufficientPermissionsException;
/**
* Search the system for a user with the specified email address.
/**
* Posts the file specified by id to solr indexing server
*
- * @param solr
* @param id
*/
- public void postFileToSolr(CommonsHttpSolrServer solr, Long id);
+ public void postFileToSolr(Long id) throws IOException, SolrServerException, ObjectNotFoundException;
+ /**
+ * @param folder
+ * @throws ObjectNotFoundException
+ */
+ public Folder expandFolder(Folder folder) throws ObjectNotFoundException;
+ /**
+ * @param folder
+ * @return
+ * @throws ObjectNotFoundException
+ */
+ FileHeader expandFile(FileHeader folder) throws ObjectNotFoundException;
+
+ /**
+ * @param folder
+ * @return
+ * @throws ObjectNotFoundException
+ */
+ Group expandGroup(Group folder) throws ObjectNotFoundException;
+ /**
+ * @param username
+ * @return
+ */
+ User getUserByUserName(String username);
+
+ /**
+ * @param lock
+ * @return
+ */
+ FileLock saveOrUpdateLock(FileLock lock);
+
+ /**
+ * @param lock
+ */
+ void removeLock(FileLock lock);
+
+ /**
+ * @param tokenId
+ * @return
+ */
+ FileLock getLockByToken(String tokenId);
+
+ /**
+ * @param id
+ * @return
+ */
+ FileLock getLockById(String id);
+
+ /**
+ * @param userId
+ * @param folderId
+ * @param name
+ * @return
+ * @throws DuplicateNameException
+ * @throws ObjectNotFoundException
+ * @throws GSSIOException
+ * @throws InsufficientPermissionsException
+ * @throws QuotaExceededException
+ */
+ FileHeader createEmptyFile(Long userId, Long folderId, String name) throws DuplicateNameException, ObjectNotFoundException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
+
+ /**
+ * @param nonce
+ * @return
+ */
+ WebDavNonce saveOrUpdateWebDavNonce(WebDavNonce nonce);
+
+ /**
+ * @param nonce
+ */
+ void removeWebDavNonce(WebDavNonce nonce);
+
+ /**
+ * @param tokenId
+ * @return
+ */
+ WebDavNonce getWebDavNonce(String tokenId);
}