Show:

I am the Database. I store all data coming from the server. The data model objects (like HypervideoModel) get their data from me. When they are done with manipulating the data, I can store the data back to the server.

Note: All data objects inside me must be passed by reference, so that data can be manipulated in place, and insertions and deletions should alter immediatly the database. In this way, data is kept consistent across the app (see Annotation/FrameTrail.newObject:method).

Methods

getIdOfHypervideo

(
  • data
)

I search the hypervideo database for a given data object and return its id.

Parameters:

Returns:

String or null

getIdOfResource

(
  • resourceData
)

I search the resource database for a given data object and return its id.

Parameters:

Returns:

String or null

loadAnnotationData

(
  • success
  • fail
)
private

I load the annotation data (../_data/projects/ RouteNavigation/projectID /hypervideos/ RouteNavigation/hypervideoID /hypervideo.json) from the server and save the data in my attribute Database/annotations, and the respective annotationfileIDs in my attribute Database/annotationfileIDs,

I call my success or fail callback respectively.

Parameters:

loadData

(
  • success
  • fail
)

I initialise the load process of the database

First I look for the RouteNavigation/projectID and RouteNavigation/hypervideoID.

Then I call the nested load functions to fetch all data from the server. I call my success or fail callback respectively.

Parameters:

loadHypervideoData

(
  • success
  • fail
)
private

I load the hypervideo index data (../_data/projects/ RouteNavigation/projectID /hypervideos/_index.json) from the server and save the data in my attribute Database/hypervideos. I call my success or fail callback respectively.

Parameters:

loadLinksData

(
  • success
  • fail
)
private

I load the video link data (../_data/projects/ RouteNavigation/projectID /hypervideos/ RouteNavigation/hypervideoID /hypervideo.json) from the server and save the data in my attribute Database/links. I call my success or fail callback respectively.

Parameters:

loadOverlayData

(
  • success
  • fail
)
private

I load the overlay data (../_data/projects/ RouteNavigation/projectID /hypervideos/ RouteNavigation/hypervideoID /hypervideo.json) from the server and save the data in my attribute Database/overlays. I call my success or fail callback respectively.

Parameters:

loadProjectData

(
  • success
  • fail
)
private

I load the project index data (../_data/projects/_index.json) from the server and save the data for my projectID (from RouteNavigation/projectID) in my attribute Database/project. I call my success or fail callback respectively.

Parameters:

loadResourceData

(
  • success
  • fail
)

I load the resource index data (../_data/projects/ RouteNavigation/projectID /resources/_index.json) from the server and save the data in my attribute Database/resources. I call my success or fail callback respectively.

Parameters:

loadSequenceData

(
  • success
  • fail
)
private

I load the hypervideo sequence data (../_data/projects/ RouteNavigation/projectID /hypervideos/ RouteNavigation/hypervideoID /hypervideo.json) from the server and save the data in my attribute Database/hypervideos. I call my success or fail callback respectively.

Parameters:

loadSubtitleData

(
  • success
  • fail
)
private

I load the subtitles data (../_data/projects/ RouteNavigation/projectID /hypervideos/ RouteNavigation/hypervideoID /subtitles/...) from the server and save the data in my attribute Database/subtitles:attribute

I call my success or fail callback respectively.

Parameters:

loadUserData

(
  • success
  • fail
)

I load the user.json of the current project from the server and save the data in my attribute Database/users. I call my success or fail callback respectively.

Parameters:

saveAnnotations

(
  • callback
)

I save the annotation data back to the server.

I choose by myself the appropriate server method ($_POST["action"]: "save" or "saveAs") wether the user's annotation file does already exist, or has to be created.

My success callback gets one argument, which is either

{ success: true }

or

{ failed: 'annotations', error: ... }

Parameters:

saveOverlays

(
  • callback
)

I save the overlay data back to the server.

My success callback gets one argument, which is either

{ success: true }

or

{ failed: 'overlays', error: ... }

Parameters:

updateHypervideoData

(
  • success
  • fail
)

I update the hypervideo data inside the database

Parameters:

Attributes

annotationfileIDs

I store the file IDs of the user's annotation sets.

The server manages file names automatically without influence of the client. That is why the client has to remeber the file ID of the several sets of annotations, which belong to a single user.

{
  "userID": "fileID"
}

annotations

I store the annotation data (from all json files from the server's ../_data/projects//hypervideos//annotationfiles/).

I am a map of keys (userIDs) to an array of all annotations from that user.

{
    "userID": [ annotationData, annotationData, ... ]
}

annotations

I store the subtitle data (from all .vtt files from the server's ../_data/projects//hypervideos//subtitles/).

hypervideo

I store the hypervideo index data for the current hypervideo

hypervideos

I store the hypervideo index data (from the server's ../_data/projects//hypervideos/_index.json)

overlays

I store the overlays data (from the server's ../_data/projects//hypervideos//overlays.json)

project

I store the project index data (from the server's ../_data/projects/_index.json)

resources

I store the resource index data (from the server's ../_data/projects//resources/_index.json)

sequence

I store the hypervideo sequence data (from the server's ../_data/projects//hypervideos//hypervideo.json)

subtitlesLangMapping

I store a map of subtitle language codes and labels.

users

I store the user data (from the projects user.json). The keys are the userIDs, and the values are maps of the user's attributes.