Class AnyFoldersManager

java.lang.Object
eu.c6.gibraltar.api.common.AbstractManager
eu.c6.gibraltar.api.managers.folders.AnyFoldersManager

public class AnyFoldersManager extends AbstractManager
The Class AnyFoldersManager to manage folders in Any.
  • Constructor Details

    • AnyFoldersManager

      public AnyFoldersManager(AnySession anySession)
      Instantiates a new Any folders manager from user session.
      Parameters:
      anySession - the Any session
  • Method Details

    • get

      public IAnyFolder get(String roomId, String folderId) throws Exception
      Gets the folder object in a room.
      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier (@see IAnyRoom.getId()).
      folderId - the folder unique global identifier (@see IAnyFolder.getId())
      Returns:
      the Any folder
      Throws:
      Exception - the exception if current user does not have the permission to access to the room/folder or room/folder is not found.
    • getFromFolderPath

      public IAnyFolder getFromFolderPath(String roomid, String folderPath) throws Exception
      Gets the folder object in a room by its path.
      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier (@see IAnyRoom.getId()).
      folderPath - a folder path in the room ( folder01/folder02/folder03)
      Returns:
      the Any folder
      Throws:
      Exception - the exception if current user does not have the permission to access to the room/folder or room/folder is not found.
    • create

      public boolean create(String roomId, String ancestorPath, IAnyFolder folder) throws Exception
      Creates the folder in a room or another folder in the room with the specified folder name, titles, descriptions and security.

      Example :

       
       IAnyFolder newFolder = new AnyFolder();
       newFolder.setName("folder03");
       Map<Locale,String> titles = new HashMap<>();
       titles.put(Locale.FR, "My folder 03 French");
       titles.put(Locale.EN, "My folder 03 English");
       newFolder.setTitles(titles);
       boolean created = userSession.getFoldersManager().create("demo_room_001", "folder01/folder02", newFolder);
       
       
      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier (@see IAnyRoom.getId()).
      ancestorPath - the ancestor path
      folder - the folder you want to create.

      Settings managed by the folder creation (refer to corresponding function in IAnyFolder) :

      • id : Not used. Computed automatically.
      • name : Optional, it not set a folder name will be computed automatically. If you set it, it must be unique in the list of direct parent folder children. It must only contains letters and numbers in lower case, no special characters are accepted.
      • titles : Localized titles.
      • descriptions : Localized descriptions.
      • security overwrite : Set it to TRUE if you want to overwrite folder security inherited from the room. In this case you must also set the list of contributors.
      • contributors : list of contributors of the folder to replace room contributors. Only used when security is overwritten.
      Returns:
      true, if successfully created
      Throws:
      Exception - the exception if :
      • Current user does not have permission to create folders
      • Folder with same name already exists.
      • Folder name is not correct.
      • Cannot find the room or parent folder.
      • Cannot create the folder.
    • update

      public boolean update(String roomId, String folderId, IAnyFolder folder) throws Exception
      Update the folder in a room or a another folder in the room with the specified folder name, titles, descriptions and security.

      Only sets the folder settings you want to update. You must specify at least the folder identifier or folder name to identify it.

      Example :

       
       IAnyFolder updatedFolder = new AnyFolder();
       Map<Locale, String> titles = new HashMap<>();
       titles.put(Locale.FR, "My folder 03 French Updated");
       titles.put(Locale.EN, "My folder 03 English Updated");
       updatedFolder.setTitles(titles);
       boolean updated = userSession.getFoldersManager().update("demo_room_001", "folder01/folder02/folder03", updatedFolder);
       
       
      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier (@see IAnyRoom.getId()).
      folderId - the folder identifier. Can be the folder path in the room or its unique global identifier (@see IAnyFolder.getId()).
      folder - the folder to update
      • id : Not used.
      • name : Not used, you cannot rename a created folder.
      • (optional) titles : Localized titles.
      • (optional)descriptions : Localized descriptions.
      • (optional)security overwrite : Set it to TRUE if you want to overwrite folder security inherited from the room. In this case you must also set the list of contributors.
      • (optional)contributors : list of contributors of the folder to replace room contributors. Only used when security is overwritten.
      Returns:
      true, if successfully updated
      Throws:
      Exception - the exception if :
      • Current user does not have permission to update folders
      • Cannot find the room or parent folder.
      • Cannot update the folder.
    • getMetadata

      public ICObject getMetadata(String roomId, String folderId) throws Exception
      Gets the folder metadata.
      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier (@see IAnyRoom.getId()).
      folderId - the folder identifier. Can be the folder path in the room or its unique global identifier (@see IAnyFolder.getId())
      Returns:
      the metadata object
      Throws:
      Exception - the exception if current user does not have the permission to access to the room/folder or room/folder is not found.
    • updateMetadata

      public boolean updateMetadata(String roomId, String folderId, ICObject metadata) throws Exception
      Update folder metadata.
      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier IAnyRoom.getId()).
      folderId - the folder identifier. Can be the folder path in the room or its unique global identifier IAnyFolder.getId())
      metadata - the metadata object
      Returns:
      true, if successfully updated
      Throws:
      Exception - the exception if current user does not have the permission to access or update the room/folder or room/folder is not found.
    • getContents

      public ScrollResult getContents(String roomId, String folderId, int fromIndex, List<String> printedFields) throws Exception
      Gets the direct folder contents.

      Returned contents is limited to 25 each call.

      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier (IAnyRoom.getId()).
      folderId - the folder identifier. Can be the folder path in the room or its unique global identifier (IAnyFolder.getId())
      fromIndex - the from index you want to get next 25 contents. Use ScrollResult.getTotalCount() from the result to get total count.
      printedFields - the printed fields you want to have in the result
      Returns:
      ScrollResult containing the list of abstract contents (ScrollResult.getResults()) and total count of contents ( ScrollResult.getTotalCount()).
      Throws:
      Exception - the exception if current user does not have the permission to access to the room/folder or room/folder is not found.
    • getContentsFromFolderPath

      public ScrollResult getContentsFromFolderPath(String roomId, String folderPath, int fromIndex, List<String> printedFields) throws Exception
      Gets the direct folder contents by path.

      Returned contents is limited to 25 each call.

      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier (IAnyRoom.getId()).
      folderPath - a folder path in the room ( folder01/folder02/folder03)
      fromIndex - the from index you want to get next 25 contents. Use ScrollResult.getTotalCount() from the result to get total count.
      printedFields - the printed fields you want to have in the result
      Returns:
      ScrollResult containing the list of abstract contents (ScrollResult.getResults()) and total count of contents ( ScrollResult.getTotalCount()).
      Throws:
      Exception - the exception if current user does not have the permission to access to the room/folder or room/folder is not found.
    • delete

      public boolean delete(String roomId, String folderId) throws Exception
      Delete.
      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier (@see IAnyRoom.getId()).
      folderId - the folder identifier. Can be the folder path in the room or its unique global identifier (@see IAnyFolder.getId())
      Returns:
      true, if successfully deleted
      Throws:
      Exception - the exception if current user does not have the permission to access or update the room/folder, room/folder is not found or folder is not empty.