Class AnyFoldersManager
java.lang.Object
eu.c6.gibraltar.api.common.AbstractManager
eu.c6.gibraltar.api.managers.folders.AnyFoldersManager
The Class AnyFoldersManager to manage folders in Any.
-
Field Summary
Fields inherited from class eu.c6.gibraltar.api.common.AbstractManager
APPLICATION_XLS, APPLICATION_XLS_TYPE, APPLICATION_XLSX, APPLICATION_XLSX_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionAnyFoldersManager(AnySession anySession) Instantiates a new Any folders manager from user session. -
Method Summary
Modifier and TypeMethodDescriptionbooleancreate(String roomId, String ancestorPath, IAnyFolder folder) Creates the folder in a room or another folder in the room with the specified folder name, titles, descriptions and security.booleanDelete.Gets the folder object in a room.getContents(String roomId, String folderId, int fromIndex, List<String> printedFields) Gets the direct folder contents.getContentsFromFolderPath(String roomId, String folderPath, int fromIndex, List<String> printedFields) Gets the direct folder contents by path.getFromFolderPath(String roomid, String folderPath) Gets the folder object in a room by its path.getMetadata(String roomId, String folderId) Gets the folder metadata.booleanupdate(String roomId, String folderId, IAnyFolder folder) Update the folder in a room or a another folder in the room with the specified folder name, titles, descriptions and security.booleanupdateMetadata(String roomId, String folderId, ICObject metadata) Update folder metadata.
-
Constructor Details
-
AnyFoldersManager
Instantiates a new Any folders manager from user session.- Parameters:
anySession- the Any session
-
-
Method Details
-
get
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 (@seeIAnyRoom.getId()).folderId- the folder unique global identifier (@seeIAnyFolder.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
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 (@seeIAnyRoom.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
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 (@seeIAnyRoom.getId()).ancestorPath- the ancestor pathfolder- 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
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 (@seeIAnyRoom.getId()).folderId- the folder identifier. Can be the folder path in the room or its unique global identifier (@seeIAnyFolder.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
Gets the folder metadata.- Parameters:
roomId- the room identifier. Can be the room name in the application or its unique global identifier (@seeIAnyRoom.getId()).folderId- the folder identifier. Can be the folder path in the room or its unique global identifier (@seeIAnyFolder.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
Update folder metadata.- Parameters:
roomId- the room identifier. Can be the room name in the application or its unique global identifierIAnyRoom.getId()).folderId- the folder identifier. Can be the folder path in the room or its unique global identifierIAnyFolder.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. UseScrollResult.getTotalCount()from the result to get total count.printedFields- the printed fields you want to have in the result- Returns:
ScrollResultcontaining 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. UseScrollResult.getTotalCount()from the result to get total count.printedFields- the printed fields you want to have in the result- Returns:
ScrollResultcontaining 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
Delete.- Parameters:
roomId- the room identifier. Can be the room name in the application or its unique global identifier (@seeIAnyRoom.getId()).folderId- the folder identifier. Can be the folder path in the room or its unique global identifier (@seeIAnyFolder.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.
-