Class CallRecordingStorage

java.lang.Object
org.exoplatform.webconferencing.storage.CallRecordingStorage

public class CallRecordingStorage extends Object
Reads and stamps the recordings of calls in JCR.

A recording saved by this add-on carries the "exo:callRecording" mixin, which names the call it belongs to. The lookup runs a JCR-SQL query in the viewer's own session, so the repository's permissions decide which recordings come back: a viewer gets exactly the files they can open in Documents. A recording saved before the mixin existed is still found by its file name, which Jibri builds as the call id, an underscore and a timestamp, and both kinds are merged.

  • Field Details

    • EXO_CALL_RECORDING

      public static final String EXO_CALL_RECORDING
      The mixin naming the call a recording belongs to.
      See Also:
    • EXO_CALL_ID

      public static final String EXO_CALL_ID
      The id of the call.
      See Also:
    • EXO_CALL_PROVIDER

      public static final String EXO_CALL_PROVIDER
      The type of the call provider.
      See Also:
    • EXO_CALL_OWNER_TYPE

      public static final String EXO_CALL_OWNER_TYPE
      The owner type of the call: space_event, space, user or chat_room.
      See Also:
    • EXO_CALL_OWNER_ID

      public static final String EXO_CALL_OWNER_ID
      The owner id of the call.
      See Also:
    • EXO_CALL_TITLE

      public static final String EXO_CALL_TITLE
      The title of the call.
      See Also:
    • EXO_CALL_START_DATE

      public static final String EXO_CALL_START_DATE
      The scheduled start of the call, when it has one.
      See Also:
    • EXO_RECORDED_DATE

      public static final String EXO_RECORDED_DATE
      When the recording was saved.
      See Also:
    • EXO_CALL_DURATION

      public static final String EXO_CALL_DURATION
      How long the recording lasts, in seconds, when its file tells it.
      See Also:
    • RECORDINGS_FOLDER

      public static final String RECORDINGS_FOLDER
      The folder that holds the recordings of a space or of a user.
      See Also:
    • MAX_RECORDINGS

      public static final int MAX_RECORDINGS
      The most recordings one lookup returns.
      See Also:
    • TITLE_SEPARATOR

      public static final String TITLE_SEPARATOR
      The separator between the call title and the date in a recording title.
      See Also:
  • Constructor Details

    • CallRecordingStorage

      public CallRecordingStorage(org.exoplatform.services.jcr.RepositoryService repositoryService, org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeCreator, org.exoplatform.services.cms.link.LinkManager linkManager, ZoneId recorderZone)
      Builds the storage.
      Parameters:
      repositoryService - the repository service
      nodeCreator - resolves the spaces' and users' folders
      linkManager - resolves the links shared to the participants of a call
      recorderZone - the time zone the recorder writes a recording's start in, UTC when null
  • Method Details

    • findCallId

      public String findCallId(String documentId) throws javax.jcr.RepositoryException
      The call a stamped recording was made in (EXO-92126), read as the system.
      Parameters:
      documentId - the recording file's UUID
      Returns:
      the call id, or null when the file does not exist or was not stamped with a call
      Throws:
      javax.jcr.RepositoryException - when the repository fails
    • buildRecordingsQuery

      public static String buildRecordingsQuery(String callId, Date from, Date to)
      Builds the JCR-SQL statement listing the stamped recordings of a call, newest first, optionally within a range of recording dates.
      Parameters:
      callId - the call id, quoted as a string literal
      from - the earliest recording date, inclusive, or null
      to - the latest recording date, inclusive, or null
      Returns:
      the statement
    • isRecordingFileOf

      public static boolean isRecordingFileOf(String fileName, String callId)
      Tells whether a file name is the one Jibri gives a recording of a call: the call id, an underscore, a timestamp and an extension. The match is on the whole id, so a call id that prefixes another's (a space and a space whose name starts with it) does not pick the other call's recordings.
      Parameters:
      fileName - the file name
      callId - the call id
      Returns:
      true when the file is a recording of that call
    • recordingTitle

      public static String recordingTitle(String callTitle, Calendar recordedDate)
      Builds the title a recording shows in Documents: the call's title and the moment it was recorded, in the server's time zone.
      Parameters:
      callTitle - the title of the call
      recordedDate - when the recording was saved
      Returns:
      the title, or null when the call has no title
    • stamp

      public boolean stamp(javax.jcr.Node fileNode, String callId, CallInfo call, UploadFileInfo uploadInfo, Calendar recordedDate, Long durationSeconds)
      Stamps a recording's file with the call it belongs to and gives it the call's title. A failure is logged and leaves the file as it is: the recording itself must never be lost to its stamp.
      Parameters:
      fileNode - the recording's file, not saved yet
      callId - the call id the upload token carries
      call - the call, or null when it could not be read
      uploadInfo - the upload info, for the owner when the call is unknown
      recordedDate - when the recording is saved
      durationSeconds - how long the recording lasts, or null when its file does not tell it
      Returns:
      true when the file is stamped
    • findRecordings

      public List<RecordingInfo> findRecordings(org.exoplatform.services.security.Identity viewer, String callId, String spaceGroupId, Date from, Date to) throws javax.jcr.RepositoryException
      Lists the recordings of a call the viewer can open, newest first.

      The stamped recordings are read by a query in the viewer's session. The recordings saved before the stamp existed are found by listing the recordings folder the call saves into for unstamped files named after the call: the space's for a space or space-event call, the viewer's own private folder otherwise, where the other participants' recordings arrive as links.

      A JCR session logs in as the thread's current conversation state, whatever the session provider was built with: the viewer is made current for the read, the way ecms WCMCoreUtils.invokeUserSession does, and the previous state restored, so the repository applies the viewer's own rights whoever calls.

      Parameters:
      viewer - the viewer's security identity, whose session reads JCR
      callId - the call id
      spaceGroupId - the group id of the space owning the call, or null for a user or chat room call
      from - the earliest recording date, inclusive, or null
      to - the latest recording date, inclusive, or null
      Returns:
      the recordings, newest first, at most 100
      Throws:
      javax.jcr.RepositoryException - when the repository fails
    • findRecordingCall

      public RecordingCall findRecordingCall(org.exoplatform.services.security.Identity viewer, String documentId) throws javax.jcr.RepositoryException
      Reads the call a file was recorded in, when the viewer can read the file and the file is a stamped recording, in the viewer's session as findRecordings(Identity, String, String, Date, Date) reads.
      Parameters:
      viewer - the viewer's security identity, whose session reads JCR
      documentId - the identifier of the file, or of a link to it
      Returns:
      the call, or null when the file is not a stamped recording the viewer can read
      Throws:
      javax.jcr.RepositoryException - when the repository fails