Class AnyRoomsManager
-
Field Summary
Fields inherited from class eu.c6.gibraltar.api.common.AbstractManager
APPLICATION_XLS, APPLICATION_XLS_TYPE, APPLICATION_XLSX, APPLICATION_XLSX_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionAnyRoomsManager(AnySession anySession) Instantiates a new Any rooms manager from user session. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCreates the room in the application with the specified name, titles, descriptions and other room settings.booleanDelete the room.Gets the room object.getContents(String roomId, int fromIndex, List<String> printedFields) Gets the room contents.getMetadata(String roomId) Gets the room metadata.getRooms()Gets the list of accessible rooms for current user and the current application.booleansynchronize(String roomId) Call a synchronization request for the room.booleanUpdates the room identified by its name or global identifier in the application with the specified titles, descriptions and other room settings.booleanupdateMetadata(String roomId, ICObject metadata) Update room metadata.
-
Constructor Details
-
AnyRoomsManager
Instantiates a new Any rooms manager from user session.- Parameters:
anySession- the Any session
-
-
Method Details
-
getRooms
Gets the list of accessible rooms for current user and the current application.- Returns:
- the list of rooms
- Throws:
Exception- the exception
-
get
Gets the room object.- Parameters:
roomId- the room identifier. Can be the room name in the application or its unique global identifier (@seeIAnyRoom.getId()).- Returns:
- the Any room
- Throws:
Exception- the exception if current user does not have the permission to access to the room or room is not found.
-
getMetadata
Gets the room metadata.- Parameters:
roomId- the room identifier. Can be the room name in the application or its unique global identifier (@seeIAnyRoom.getId()).- Returns:
- the metadata object
- Throws:
Exception- the exception if current user does not have the permission to access to the room or room is not found.
-
updateMetadata
Update room metadata.- Parameters:
roomId- the room identifier. Can be the room name in the application or its unique global identifierIAnyRoom.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 or room is not found.
-
create
Creates the room in the application with the specified name, titles, descriptions and other room settings.Example :
IAnyRoom newRoom = new AnyRoom(); newRoom.setName("room01"); Map<Locale,String>titles = new HashMap<>(); titles.put(Locale.FR, "My room 01 French"); titles.put(Locale.EN, "My room 01 English"); newRoom.setTitles(titles); boolean created = userSession.getRoomsManager().create(newRoom);- Parameters:
room- the room you want to create.Identifier of the new room will be computed automatically. Room name is required and must be unique in the list of rooms in the application. When you set the collection list, the room synchronization request is automatically done after creation to link contents in the room.
Settings managed by the room creation (refer to corresponding function in
IAnyRoom) :- Room name
- Room localized titles and descriptions
- List of viewers, readers, contributors and administrators
- Readers additional permissions
- Controlled export/print/view for PDF and DOCX
- Image of the room
- Colorization
- Collections
- Static link forbidden
- Only verified contents
- Mass update list
- Browsing mode
- Views
- Enable RSS feed
- Columns settings
- Returns:
- true, if successfully created
- Throws:
Exception- the exception if :- Current user does not have permission to create room
- Room with same name already exists.
- Cannot create the room.
-
update
Updates the room identified by its name or global identifier in the application with the specified titles, descriptions and other room settings.Only sets the room settings you want to update. You must specify at least the room identifier or room name.
Example :
IAnyRoom newRoom = new AnyRoom(); newRoom.setName("room01"); Map<Locale,String>titles = new HashMap<>(); titles.put(Locale.FR, "My Updated room 01 French"); titles.put(Locale.EN, "My Updated room 01 English"); newRoom.setTitles(titles); boolean updated = userSession.getRoomsManager().update(newRoom);- Parameters:
room- the room you want to create.When you update, the room name ad identifier are read only, you cannot update them. When you change the collection list, the room synchronization request is automatically done after creation to link contents in the room.
Settings managed by the room update (refer to corresponding function in
IAnyRoom) :- Room localized titles and descriptions
- List of viewers, readers, contributors and administrators
- Readers additional permissions
- Controlled export/print/view for PDF and DOCX
- Image of the room
- Colorization
- Collections
- Static link forbidden
- Only verified contents
- Mass update list
- Browsing mode
- Views
- Enable RSS feed
- Columns settings
- Returns:
- true, if successfully updated
- Throws:
Exception- the exception if :- Current user is not a room administrator
- Cannot update the room.
-
synchronize
Call a synchronization request for the room. Synchronization- Parameters:
roomId- the room identifier. Can be the room name in the application or its unique global identifier (@seeIAnyRoom.getId()).- Returns:
- true, if successfully updated
- Throws:
Exception- the exception if current user is not a room administrator
-
delete
Delete the room.- Parameters:
roomId- the room identifier. Can be the room name in the application or its unique global identifier (@seeIAnyRoom.getId()).- Returns:
- true, if successful
- Throws:
Exception- the exception if current user is not a room administrator
-
getContents
public ScrollResult getContents(String roomId, int fromIndex, List<String> printedFields) throws Exception Gets the room contents.Returned contents is limited to 25 each call. *
Example :
IAnySession anySession = AnySession.getInstance("http://localhost:8080/any", "user01", "password01"); anySession.setApplication("demo"); ScrollResult result = anySession.getRoomsManager().getContents("demo_room__room0001", 0, Arrays.asList("core.name")); List<ICObject> allResults = new ArrayList<>(result.getResults()); while (!result.isEmpty()) { result = anySession.getRoomsManager().getContents("demo_room__room0001", result.getNextIndex(), Arrays.asList("core.name")); allResults.addAll(result.getResults()); } allResults.forEach(r -> System.out.println(r.getString("core.name"))); System.out.println("Total found : " + allResults.size());*- Parameters:
roomId- the room identifier. Can be the room name in the application or its unique global identifier (IAnyRoom.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 or room is not found.
-