Class CallRecordingStorage
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringHow long the recording lasts, in seconds, when its file tells it.static final StringThe id of the call.static final StringThe owner id of the call.static final StringThe owner type of the call: space_event, space, user or chat_room.static final StringThe type of the call provider.static final StringThe mixin naming the call a recording belongs to.static final StringThe scheduled start of the call, when it has one.static final StringThe title of the call.static final StringWhen the recording was saved.static final intThe most recordings one lookup returns.static final StringThe folder that holds the recordings of a space or of a user.static final StringThe separator between the call title and the date in a recording title. -
Constructor Summary
ConstructorsConstructorDescriptionCallRecordingStorage(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. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildRecordingsQuery(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.findCallId(String documentId) The call a stamped recording was made in (EXO-92126), read as the system.findRecordingCall(org.exoplatform.services.security.Identity viewer, String documentId) 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 asfindRecordings(Identity, String, String, Date, Date)reads.findRecordings(org.exoplatform.services.security.Identity viewer, String callId, String spaceGroupId, Date from, Date to) Lists the recordings of a call the viewer can open, newest first.static booleanisRecordingFileOf(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.static StringrecordingTitle(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.booleanstamp(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.
-
Field Details
-
EXO_CALL_RECORDING
The mixin naming the call a recording belongs to.- See Also:
-
EXO_CALL_ID
-
EXO_CALL_PROVIDER
-
EXO_CALL_OWNER_TYPE
The owner type of the call: space_event, space, user or chat_room.- See Also:
-
EXO_CALL_OWNER_ID
-
EXO_CALL_TITLE
-
EXO_CALL_START_DATE
The scheduled start of the call, when it has one.- See Also:
-
EXO_RECORDED_DATE
-
EXO_CALL_DURATION
How long the recording lasts, in seconds, when its file tells it.- See Also:
-
RECORDINGS_FOLDER
The folder that holds the recordings of a space or of a user.- See Also:
-
MAX_RECORDINGS
public static final int MAX_RECORDINGSThe most recordings one lookup returns.- See Also:
-
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 servicenodeCreator- resolves the spaces' and users' folderslinkManager- resolves the links shared to the participants of a callrecorderZone- the time zone the recorder writes a recording's start in, UTC when null
-
-
Method Details
-
findCallId
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
nullwhen the file does not exist or was not stamped with a call - Throws:
javax.jcr.RepositoryException- when the repository fails
-
buildRecordingsQuery
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 literalfrom- the earliest recording date, inclusive, ornullto- the latest recording date, inclusive, ornull- Returns:
- the statement
-
isRecordingFileOf
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 namecallId- the call id- Returns:
- true when the file is a recording of that call
-
recordingTitle
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 callrecordedDate- when the recording was saved- Returns:
- the title, or
nullwhen 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 yetcallId- the call id the upload token carriescall- the call, ornullwhen it could not be readuploadInfo- the upload info, for the owner when the call is unknownrecordedDate- when the recording is saveddurationSeconds- how long the recording lasts, ornullwhen 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.invokeUserSessiondoes, 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 JCRcallId- the call idspaceGroupId- the group id of the space owning the call, ornullfor a user or chat room callfrom- the earliest recording date, inclusive, ornullto- the latest recording date, inclusive, ornull- 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 asfindRecordings(Identity, String, String, Date, Date)reads.- Parameters:
viewer- the viewer's security identity, whose session reads JCRdocumentId- the identifier of the file, or of a link to it- Returns:
- the call, or
nullwhen the file is not a stamped recording the viewer can read - Throws:
javax.jcr.RepositoryException- when the repository fails
-