Class AnyRoomsManager

java.lang.Object
eu.c6.gibraltar.api.common.AbstractManager
eu.c6.gibraltar.api.managers.rooms.AnyRoomsManager

public class AnyRoomsManager extends AbstractManager
The Class AnyRoomsManager to manage rooms in Any.
  • Constructor Details

    • AnyRoomsManager

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

    • getRooms

      public List<IAnyRoom> getRooms() throws Exception
      Gets the list of accessible rooms for current user and the current application.
      Returns:
      the list of rooms
      Throws:
      Exception - the exception
    • get

      public IAnyRoom get(String roomId) throws Exception
      Gets the room object.
      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier (@see IAnyRoom.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

      public ICObject getMetadata(String roomId) throws Exception
      Gets the room metadata.
      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier (@see IAnyRoom.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

      public boolean updateMetadata(String roomId, ICObject metadata) throws Exception
      Update room metadata.
      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier IAnyRoom.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

      public boolean create(IAnyRoom room) throws Exception
      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

      public boolean update(IAnyRoom room) throws Exception
      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

      public boolean synchronize(String roomId) throws Exception
      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 (@see IAnyRoom.getId()).
      Returns:
      true, if successfully updated
      Throws:
      Exception - the exception if current user is not a room administrator
    • delete

      public boolean delete(String roomId) throws Exception
      Delete the room.
      Parameters:
      roomId - the room identifier. Can be the room name in the application or its unique global identifier (@see IAnyRoom.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. 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 or room is not found.