store/EntryStore

Methods

addAsyncListener(listener)

Description:
  • Provides a listener that will be called for every asynchronous call being made. The handler is invoked with the promise from the asynchronous call and a callType parameter indicating which asynchronous call that has been made.

    The callType parameter can take the following values:

    • getEntry - an entry is retrieved (EntryStore.getEntry)
    • createEntry - an entry is created (EntryStore.createEntry)
    • createGroupAndContext - a group and context pair is created (EntryStore.createGroupAndContext)
    • loadViaProxy - data is requested via repository proxy (EntryStore.loadViaProxy)
    • commitMetadata - changes to metadata is pushed (Entry.commitMetadata)
    • commitCachedExternalMetadata - changes to cached external metadata is pushed (Entry.commitCachedExternalMetadata)
    • getResource - the entry's resource has been requested (Entry.getResource)
    • getLinkedEntry - a linked entry is requested (Entry.getLinkedEntry)
    • delEntry - an entry is deleted (Entry.del)
    • refresh - an entry is refreshed (Entry.refresh)
    • setContextName - the name of a context is changed (Context.setName)
    • getUserInfo - the user information is requested (auth.getUserInfo)
    • getUserEntry - the user entry is requested (auth.getUserEntry)
    • login - logging in (auth.login)
    • logout - logging out (auth.logout)
    • commitEntryInfo - pushing changes in entry information (EntryInfo.commit)
    • getFile - the contents of a file resource is requested (File.get*)
    • putFile - the contents of a file is pushed (File.put*)
    • commitGraph - a graph resource is pushed (Graph.commit)
    • commitString - a string resource is pushed (String.commit)
    • setGroupName - a new name of a group is pushed (Group.setName)
    • setUserName - a new name of a user is pushed (User.setName)
    • setUserDisabled - a new disabled state of a user is pushed (User.setDisabled)
    • setUserLanguage - a new preferred language of the user is pushed (User.setLanguage)
    • setUserPassword - a new password for the user is pushed (User.setPassword)
    • setUserHomeContext - a new home context for the user is pushed (User.setHomeContext)
    • setUserCustomProperties - new custom properties for the user (User.setCustomProperties)
    • loadListEntries - members of a list are requested (List.getEntries)
    • setList - the list members are changed via a list
    • addToList - See List.addEntry
    • removeFromList - See List.removeEntry .removeEntry)
    • search - a search is being performed (SearchList.getEntries)
    • execute - a pipeline is executed (Pipeline.execute)
Source:
Parameters:
Name Type Description
listener Promise.<string>

auth(credentials)

Description:
  • Authenticate using credentials containing a user, a password and an optional maxAge given in seconds.

Source:
Deprecated:
  • use corresponding method on auth object instead.
Parameters:
Name Type Description
credentials Object

as a parameter object

(async) createEntry(prototypeEntry) → {Promise}

Description:
  • Creates a new entry according to information in the provided PrototypeEntry. The information specifies the type of entry, which context it should reside in, initial metadata etc. This method is seldom called explicitly, instead it is called indirectly via the PrototypeEntry#commit method. E.g.:

    context.newEntry().commit().then(function(newlyCreatedEntry) {...}
    
Source:
See:
  • PrototypeEntry#commit
  • EntryStore#newContext
  • EntryStore#newUser
  • EntryStore#newGroup
  • Context#newEntry
  • Context#newLink
  • Context#newLinkRef
  • Context#newRef
  • Context#newList
  • Context#newGraph
  • Context#newString
Parameters:
Name Type Description
prototypeEntry PrototypeEntry

information about the entry to create.

Returns:
Type
Promise

(async) createGroupAndContext(name) → {Promise.<Entry>}

Source:
Parameters:
Name Type Description
name
Returns:
Type
Promise.<Entry>

createSearchList()

Source:
Deprecated:
  • use #newSolrQuery instead.

getAuth() → {Auth}

Source:
Returns:

where functionality related to authorization are located, including a listener infrastructure.

Type
Auth

getBaseURI() → {String}

Description:
  • The base URI of the EntryStore repository we have connected to.

Source:
Returns:
Type
String

getCache() → {Cache}

Description:
  • The cache where all entries are cached after loading.

Source:
Returns:
Type
Cache

getCachedContextsIdx() → {Object}

Source:
Returns:
Type
Object

getContext(contextEntryURI) → {Context}

Description:
  • Retrieves a Context instance via its entry's URI.

Source:
See:
  • getContextById
Parameters:
Name Type Description
contextEntryURI String

URI to the context's entry, e.g. base/_contexts/entry/1.

Returns:
Type
Context

getContextById(contextId) → {Context}

Description:
  • Retrieves a Context instance via its id. Note that this method returns directly without checking with the EntryStore repository that the context exists. Hence successive operations via this context instance may fail if the context does not exist in the EntryStore repository.

    Note that in EntryStore everything is connected to entries. Hence a context is nothing else than a special kind of resource maintained by an entry. This entry provides metadata about the context as well as the default ownership and access control that applies to all entries inside of this context.

    To get a hold of the contexts own entry use the Resource#getEntry method on the context (inherited from the generic Resource class.

    Advanced: Entrys corresponding to contexts are stored in the special _contexts context which, since it is a context, contains its own entry.

Source:
Parameters:
Name Type Description
contextId string

identifier for the context (not necessarily the same as the alias/name for the context)

Returns:
Type
Context

getContextId(uri) → {string}

Description:
  • The context id of this entry, resource or metadata uri.

Source:
Parameters:
Name Type Description
uri string
Returns:
Type
string

getContextList() → {List}

Description:
  • Retrieves a paginated list of all contexts in the EntryStore repository.

Source:
Returns:
  • the list contains entries which have contexts as resources.
Type
List

getEntry(entryURI, optionalLoadParams) → {Promise.<Entry>|Entry|undefined}

Description:
  • Fetches an entry given an entryURI. If the entry is already loaded and available in the cache it will be returned directly, otherwise it will be loaded from the repository. If the entry is already loaded but marked as in need of a refresh it will be refreshed first.

    The optional load parameters are provided in a single parameter object with six possible attributes. Below we outline these attributes, the first two (forceLoad and direct) applies to all kind of entries while the following three (limit, offset and sort) only applies if the entry is a list:

    forceLoad - ignores if the entry is already in cache and fetches from the repository loadResource - makes sure that entry.getResource(true) will not return null (does not work in combination with direct). direct - returns the entry from the cache directly rather than returning a promise, if the entry is not in the cache an undefined value will be returned. limit - only a limited number of children are loaded, -1 means no limit, 0, undefined or if the attribute is not provided means that the default limit of 20 is used. offset - only children from offest and forward is returned, must be positive. sort - information on how to sort the children: * if sort is not provided at all or an empty object is provided the members of the list will not be sorted, instead the list's natural order will be used * if sort is given as null the defaults will be used ({sortBy: "title", prio: "List"}). * if sort is given as a non emtpy object the following attributes are considered: ** sortBy - the attribute instructs which metadata field to sort the children by, i.e., title, created, modified, or size. ** lang - if sort is title and the title is provided in several languages a prioritized language can be given. ** prio - allows specific graphtypes to be prioritized (e.g. show up in the top of the list). ** descending - if true the children are shown in descending order.

    Note - in the case where the entry is a list it is possible to change the limit, offset and sort later by calling the corresponding methods on the List resource, e.g. List#setSort. However, setting the values already in this method call has as a consequence that one less request to the repository is made as you will get members (in the right amount and order) in the same request as you get metadata and other information.

    A request of a list entry can look like:

    var euri = entrystore.getEntryURI("1", "1");
    entrystore.getEntry(euri, {
         forceLoad: true,
         limit: 10,
         offset: 20,
         sort: {
            sortBy: "modified",
            prio: types.GT_LIST
         }
     });
    

    The optional params here says that we force a load from the repository, that we want the results to be paginated with a limit of 10 entries per page and that we want page 3. We also indicate that we want the list to be sorted by latest modification date and that if there are member entries that are lists they should be sorted to the top.

Source:
See:
  • getEntryURI for help to construct entry URIs.
  • Context#getEntryById for loading entries relative to a context.
Parameters:
Name Type Description
entryURI string

the entryURI for the entry to retrieve.

optionalLoadParams Object

parameters for how to load an entry.

Returns:
  • by default a promise is returned, if the direct parameter is specified the entry is returned directly or undefined if the entry is not in cache.
Type
Promise.<Entry> | Entry | undefined

getEntryId(uri) → {string}

Description:
  • The entry id of this entry, resource or metadata uri.

Source:
Parameters:
Name Type Description
uri string
Returns:
Type
string

getEntryURI(contextId, entryId) → {String}

Description:
  • Constructs an entry URI from the id for the context and the specific entry.

Source:
Parameters:
Name Type Description
contextId string

an identifier for the context the entry belongs to

entryId string

an identifier for the entry

Returns:
  • an entry URI
Type
String

getEntryURIFromURI(uri) → {String}

Description:
  • Constructs an entry URI from a normal repository URI, e.g. any URI from which is possible to deduce a contextId and an entryId. Equivalent to calling: es.getEntryURI(es.getContextId(uri), es.getEntryId(uri))

Source:
Parameters:
Name Type Description
uri string

a URI for the entry, can be a entryURI (obviously), resourceURI (if local), metadataURI, or relationsURI.

Returns:
  • an entry URI
Type
String

getListEntries(entryURI, sort, limit, page) → {Promise.<Array.<Entry>>}

Description:
  • Retrieves entries from a list. One way to see it is that this is a convenience method that retrieves a list entry, its member entries and returns those in an array.

Source:
Parameters:
Name Type Description
entryURI string

URI of the list entry to load entries from.

sort Object

same sort object as provided in the optionalLoadParams to {@see EntryStore#getEntry getEntry} method.

limit Object

same limit as provided in the optionalLoadParams to {@see EntryStore#getEntry getEntry} method.

page integer

unless limit is set to -1 (no pagination) we need to specify which page to load, first page is 0.

Returns:

upon success the promise returns an array of entries.

Type
Promise.<Array.<Entry>>

getMetadataURI(contextId, entryId) → {String}

Description:
  • Constructs an metadata URI from the id for the context and the specific entry.

Source:
Parameters:
Name Type Description
contextId string

an identifier for the context the entry belongs to

entryId string

an identifier for the entry

Returns:
  • an entry URI
Type
String

getPrincipalList() → {List}

Description:
  • Retrieves a paginated list of all users and groups in the EntryStore repository

Source:
To Do:
  • May include folders and other entries as well...
Returns:

the list contains entries that have principals as resources.

Type
List

getREST() → {Rest}

Description:
  • The loading mechanism are performed via REST calls, this REST module can be used for doing manual lookups outside of the scope of this API.

Source:
Returns:
Type
Rest

getRequestCachePrevention() → {boolean}

Description:
  • Weather the cache of requests made to EntryStore instances are circumvented by appending a random parameter.

Source:
Returns:
Type
boolean

getResourceURI(contextId, entryId) → {String}

Description:
  • Constructs an entry resource URI (local URI, not a link obviously) from the id for the context and the specific entry.

Source:
Parameters:
Name Type Description
contextId string

an identifier for the context the resource belongs to

entryId string

an identifier for the entry the resource belongs to

Returns:

a resource URI

Type
String

getStatus() → {Promise}

Description:
  • To get status resource

Source:
Returns:
Type
Promise

getUserEntry() → {Promise.<Entry>}

Source:
Deprecated:
  • use corresponding method on auth object instead.
Returns:

on success the entry for the currently signed in user is provided.

Type
Promise.<Entry>

getUserInfo() → {Promise.<EntryInfo>}

Description:
  • Yields information about who currently is authenticated against the EntryStore repository.

Source:
Deprecated:
  • use corresponding method on auth object instead.
See:
  • auth
  • logout
Returns:
  • upon success an object containing attributes "user" being the username, "id" of the user entry, and "homecontext" being the entry-id of the home context is provided.
Type
Promise.<EntryInfo>

handleAsync(promise, context) → {Promise}

Source:
Parameters:
Name Type Description
promise Promise
context string
Returns:
Type
Promise

loadViaProxy(uri, formatHint) → {Promise}

Description:
  • Loads data via the EntryStore repository's own proxy.

Source:
Parameters:
Name Type Description
uri string

indicates the resource to load.

formatHint string

indicates that you want data back in the format specified (e.g. by specifiying a suitable accept header).

Returns:
Type
Promise

logout() → {Promise}

Description:
  • Logout the currently authorized user.

Source:
Deprecated:
  • use corresponding method on auth object instead.
Returns:
Type
Promise

moveEntry(entry, fromList, toList) → {Promise}

Description:
  • Move an entry from one list to another.

Source:
Parameters:
Name Type Description
entry Entry

entry to move

fromList Entry

source list where the entry is currently residing.

toList Entry

destination list where the entry is supposed to end up.

Returns:
Type
Promise

newContext(contextNameopt, idopt) → {PrototypeEntry}

Description:
  • Provides a PrototypeEntry for creating a new context.

Source:
Parameters:
Name Type Attributes Description
contextName string <optional>

optional name for the context, can be changed later, must be unique in the _principals context

id string <optional>

optional requested identifier (entryId) for the context, cannot be changed later, must be unique in the _principals context

Returns:
Type
PrototypeEntry

newGroup(groupNameopt, idopt) → {PrototypeEntry}

Source:
Parameters:
Name Type Attributes Description
groupName string <optional>

optional name for the group, can be changed later, must be unique in the _principals context

id string <optional>

optional requested identifier (entryId) for the group, cannot be changed later, must be unique in the _principals context

Returns:
Type
PrototypeEntry

newSolrQuery() → {SolrQuery}

Description:
  • Performing searches against an EntryStore repository is achieved by creating a SearchList which is similar to a regular List. From this list it is possible to get paginated results in form of matching entries. For example:

    var personType = "http://xmlns.com/foaf/0.1/Person";
    var searchList = entrystore.newSolrQuery().rdfType(personType).list();
    searchList.setLimit(20).getEntries().then(function(results) {...});
    
Source:
Returns:
Type
SolrQuery

newUser(usernameopt, passwordopt, homeContextopt, idopt) → {PrototypeEntry}

Description:
  • Provides a PrototypeEntry for creating a new user.

Source:
Parameters:
Name Type Attributes Description
username string <optional>

the name the user will use to authenticate himself

password string <optional>

the password the user will use to authenticate himself

homeContext string <optional>

a specific context the user will consider his own home

id string <optional>

requested identifier for the user

Returns:
Type
PrototypeEntry

removeAsyncListener(listener)

Description:
  • Removes a previously added listener for asynchronous calls.

Source:
Parameters:
Name Type Description
listener string

setRequestCachePrevention(prevent)

Description:
  • Requests to EntryStore instances may be cached to increase performance, by setting the requestCachePrevention to true that cache is circumvented by appending unique parameters to the URI. By default the requestCachePrevention is disabled.

Source:
Parameters:
Name Type Description
prevent boolean

pass true to enable the prevention.

(static) info()

Description:
  • Provides information about version of EntryStore repository, the javascript API, status of services etc.

Source:
To Do:
  • Needs support from EntryStore REST API
  • Document promise