do not lock resource if entity object does not exist
[pithos] / src / gr / ebs / gss / server / ejb / ExternalAPI.java
index 2ea80f9..454b359 100644 (file)
@@ -24,11 +24,15 @@ import gr.ebs.gss.client.exceptions.InsufficientPermissionsException;
 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.FileHeader;
 import gr.ebs.gss.server.domain.FileUploadStatus;
+import gr.ebs.gss.server.domain.FileLock;
 import gr.ebs.gss.server.domain.Invitation;
 import gr.ebs.gss.server.domain.Nonce;
 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.WebDavNonce;
 import gr.ebs.gss.server.domain.dto.FileBodyDTO;
 import gr.ebs.gss.server.domain.dto.FileHeaderDTO;
 import gr.ebs.gss.server.domain.dto.FolderDTO;
@@ -48,6 +52,8 @@ import javax.ejb.Local;
 import javax.ejb.TransactionAttribute;
 import javax.ejb.TransactionAttributeType;
 
+import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
+
 /**
  * The External API for GSS clients.
  *
@@ -252,6 +258,7 @@ public interface ExternalAPI {
         * @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
@@ -261,7 +268,9 @@ public interface ExternalAPI {
         * @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, Set<PermissionDTO> permissions)
+       public FolderDTO updateFolder(Long userId, Long folderId, String folderName,
+                               Boolean readForAll,
+                               Set<PermissionDTO> permissions)
                        throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException;
 
        /**
@@ -338,19 +347,6 @@ public interface ExternalAPI {
        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
@@ -641,31 +637,6 @@ public interface ExternalAPI {
        public void removeFileFromTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
 
        /**
-        * Marks  the specified files as deleted in the specified user's namespace.
-        *
-        * @param userId the ID of the current user
-        * @param fileIds the IDs of the file 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 moveFilesToTrash(Long userId, List<Long> fileIds)
-                       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
@@ -985,7 +956,7 @@ public interface ExternalAPI {
         * @return list of files that match query
         * @throws ObjectNotFoundException if no user or query was specified
         */
-       public List<FileHeaderDTO> searchFiles(Long userId, String query) throws ObjectNotFoundException;
+       public List<FileHeader> searchFiles(Long userId, String query) throws ObjectNotFoundException;
 
        /**
         * Creates a nonce for the specified user.
@@ -1065,20 +1036,6 @@ public interface ExternalAPI {
                        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
@@ -1094,9 +1051,14 @@ public interface ExternalAPI {
        /**
         * It is used by the Solr mbean to rebuild the index.
         */
-       public void rebuildSolrIndex();
+       public String rebuildSolrIndex();
 
        /**
+        * It is used by the Solr mbean to refresh the index. It does not delete anything just re-add everything in the index
+        */
+       public String refreshSolrIndex();
+       
+       /**
         * Creates a new file with the specified owner, parent folder and name. The
         * new file has the same permissions as its parent folder. The file contents
         * are already uploaded outside of externalAPI and the uploaded file is used as a parameter.
@@ -1258,4 +1220,87 @@ public interface ExternalAPI {
         * Delete the actual file in the specified file system path.
         */
        public void deleteActualFile(String path);
+       
+       /**
+        * Update the userLogin with the values from the supplied object.
+        */
+       public void addUserLogin(UserLogin userLogin);
+       
+       /**
+        * Retrieves the user's current session login and the user's last login
+        * @param userId
+        * @return a list of last two user logins
+        * @throws ObjectNotFoundException 
+        */
+       public List<UserLogin> getLastUserLogins(Long userId) throws ObjectNotFoundException;
+
+       /**
+        * Posts the file specified by id to solr indexing server
+        *
+     * @param solr
+        * @param id
+        */
+       public void postFileToSolr(CommonsHttpSolrServer solr, Long id);
+
+       /**
+        * @param username
+        * @return
+        */
+       UserDTO 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
+        */
+       FileHeaderDTO 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);
+       
+
+
 }