[JSDoc] Add annotations
Bulk-add JSDoc annotations, WTD-1482.
This commit is contained in:
@@ -31,6 +31,7 @@ define(
|
||||
* that have been loaded, and keeps them in sync after writes. This allows
|
||||
* retrievals to occur more quickly after the first load.
|
||||
*
|
||||
* @memberof platform/persistence/cache
|
||||
* @constructor
|
||||
* @param {string[]} CACHE_SPACES persistence space names which
|
||||
* should be cached
|
||||
@@ -113,6 +114,7 @@ define(
|
||||
* decorated service.
|
||||
* @memberof CachingPersistenceDecorator#
|
||||
* @returns {Promise.<string[]>} spaces supported
|
||||
* @memberof platform/persistence/cache.CachingPersistenceDecorator#
|
||||
*/
|
||||
listSpaces: function () {
|
||||
return persistenceService.listSpaces();
|
||||
@@ -122,6 +124,7 @@ define(
|
||||
* @memberof CachingPersistenceDecorator#
|
||||
* @param {string} space the space in which to list objects
|
||||
* @returns {Promise.<string[]>} keys for objects in this space
|
||||
* @memberof platform/persistence/cache.CachingPersistenceDecorator#
|
||||
*/
|
||||
listObjects: function (space) {
|
||||
return persistenceService.listObjects(space);
|
||||
@@ -136,6 +139,7 @@ define(
|
||||
* @param {object} value a JSONifiable object to store
|
||||
* @returns {Promise.<boolean>} an indicator of the success or
|
||||
* failure of this request
|
||||
* @memberof platform/persistence/cache.CachingPersistenceDecorator#
|
||||
*/
|
||||
createObject: function (space, key, value) {
|
||||
addToCache(space, key, value);
|
||||
@@ -150,6 +154,7 @@ define(
|
||||
* @returns {Promise.<object>} a promise for the object; may
|
||||
* resolve to undefined (if the object does not exist
|
||||
* in this space)
|
||||
* @memberof platform/persistence/cache.CachingPersistenceDecorator#
|
||||
*/
|
||||
readObject: function (space, key) {
|
||||
return (cache[space] && cache[space][key]) ?
|
||||
@@ -167,6 +172,7 @@ define(
|
||||
* @param {object} value a JSONifiable object to store
|
||||
* @returns {Promise.<boolean>} an indicator of the success or
|
||||
* failure of this request
|
||||
* @memberof platform/persistence/cache.CachingPersistenceDecorator#
|
||||
*/
|
||||
updateObject: function (space, key, value) {
|
||||
return persistenceService.updateObject(space, key, value)
|
||||
@@ -185,6 +191,7 @@ define(
|
||||
* @param {object} value a JSONifiable object to delete
|
||||
* @returns {Promise.<boolean>} an indicator of the success or
|
||||
* failure of this request
|
||||
* @memberof platform/persistence/cache.CachingPersistenceDecorator#
|
||||
*/
|
||||
deleteObject: function (space, key, value) {
|
||||
if (cache[space]) {
|
||||
@@ -198,4 +205,4 @@ define(
|
||||
|
||||
return CachingPersistenceDecorator;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -33,6 +33,7 @@ define(
|
||||
* metadata field which contains a subset of information found
|
||||
* in the model itself (to support search optimization with
|
||||
* CouchDB views.)
|
||||
* @memberof platform/persistence/couch
|
||||
* @constructor
|
||||
* @param {string} id the id under which to store this mode
|
||||
* @param {object} model the model to store
|
||||
@@ -59,4 +60,4 @@ define(
|
||||
|
||||
return CouchDocument;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -55,6 +55,8 @@ define(
|
||||
* Indicator for the current CouchDB connection. Polls CouchDB
|
||||
* at a regular interval (defined by bundle constants) to ensure
|
||||
* that the database is available.
|
||||
* @constructor
|
||||
* @memberof platform/persistence/couch
|
||||
*/
|
||||
function CouchIndicator($http, $interval, PATH, INTERVAL) {
|
||||
// Track the current connection state
|
||||
@@ -87,6 +89,7 @@ define(
|
||||
* to display in this indicator. This will return "D",
|
||||
* which should appear as a database icon.
|
||||
* @returns {string} the character of the database icon
|
||||
* @memberof platform/persistence/couch.CouchIndicator#
|
||||
*/
|
||||
getGlyph: function () {
|
||||
return "D";
|
||||
@@ -96,6 +99,7 @@ define(
|
||||
* This is used to color the glyph to match its
|
||||
* state (one of ok, caution or err)
|
||||
* @returns {string} the CSS class to apply to this glyph
|
||||
* @memberof platform/persistence/couch.CouchIndicator#
|
||||
*/
|
||||
getGlyphClass: function () {
|
||||
return state.glyphClass;
|
||||
@@ -103,6 +107,7 @@ define(
|
||||
/**
|
||||
* Get the text that should appear in the indicator.
|
||||
* @returns {string} brief summary of connection status
|
||||
* @memberof platform/persistence/couch.CouchIndicator#
|
||||
*/
|
||||
getText: function () {
|
||||
return state.text;
|
||||
@@ -111,6 +116,7 @@ define(
|
||||
* Get a longer-form description of the current connection
|
||||
* space, suitable for display in a tooltip
|
||||
* @returns {string} longer summary of connection status
|
||||
* @memberof platform/persistence/couch.CouchIndicator#
|
||||
*/
|
||||
getDescription: function () {
|
||||
return state.description;
|
||||
@@ -121,4 +127,4 @@ define(
|
||||
|
||||
return CouchIndicator;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -35,6 +35,7 @@ define(
|
||||
* The CouchPersistenceProvider reads and writes JSON documents
|
||||
* (more specifically, domain object models) to/from a CouchDB
|
||||
* instance.
|
||||
* @memberof platform/persistence/couch
|
||||
* @constructor
|
||||
*/
|
||||
function CouchPersistenceProvider($http, $q, SPACE, PATH) {
|
||||
@@ -104,6 +105,7 @@ define(
|
||||
*
|
||||
* @returns {Promise.<string[]>} a promise for a list of
|
||||
* spaces supported by this provider
|
||||
* @memberof platform/persistence/couch.CouchPersistenceProvider#
|
||||
*/
|
||||
listSpaces: function () {
|
||||
return $q.when(spaces);
|
||||
@@ -114,6 +116,7 @@ define(
|
||||
* @param {string} space the space to check
|
||||
* @returns {Promise.<string[]>} a promise for the list of
|
||||
* identifiers
|
||||
* @memberof platform/persistence/couch.CouchPersistenceProvider#
|
||||
*/
|
||||
listObjects: function (space) {
|
||||
return get("_all_docs").then(getIdsFromAllDocs);
|
||||
@@ -127,6 +130,7 @@ define(
|
||||
* @returns {Promise.<boolean>} a promise for an indication
|
||||
* of the success (true) or failure (false) of this
|
||||
* operation
|
||||
* @memberof platform/persistence/couch.CouchPersistenceProvider#
|
||||
*/
|
||||
createObject: function (space, key, value) {
|
||||
return put(key, new CouchDocument(key, value))
|
||||
@@ -141,6 +145,7 @@ define(
|
||||
* @returns {Promise.<object>} a promise for the stored
|
||||
* object; this will resolve to undefined if no such
|
||||
* object is found.
|
||||
* @memberof platform/persistence/couch.CouchPersistenceProvider#
|
||||
*/
|
||||
readObject: function (space, key) {
|
||||
return get(key).then(getModel);
|
||||
@@ -154,6 +159,7 @@ define(
|
||||
* @returns {Promise.<boolean>} a promise for an indication
|
||||
* of the success (true) or failure (false) of this
|
||||
* operation
|
||||
* @memberof platform/persistence/couch.CouchPersistenceProvider#
|
||||
*/
|
||||
updateObject: function (space, key, value) {
|
||||
return put(key, new CouchDocument(key, value, revs[key]))
|
||||
@@ -169,6 +175,7 @@ define(
|
||||
* @returns {Promise.<boolean>} a promise for an indication
|
||||
* of the success (true) or failure (false) of this
|
||||
* operation
|
||||
* @memberof platform/persistence/couch.CouchPersistenceProvider#
|
||||
*/
|
||||
deleteObject: function (space, key, value) {
|
||||
return put(key, new CouchDocument(key, value, revs[key], true))
|
||||
@@ -180,4 +187,4 @@ define(
|
||||
|
||||
return CouchPersistenceProvider;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -49,6 +49,8 @@ define(
|
||||
* Indicator for the current CouchDB connection. Polls CouchDB
|
||||
* at a regular interval (defined by bundle constants) to ensure
|
||||
* that the database is available.
|
||||
* @constructor
|
||||
* @memberof platform/persistence/elastic
|
||||
*/
|
||||
function ElasticIndicator($http, $interval, PATH, INTERVAL) {
|
||||
// Track the current connection state
|
||||
@@ -79,6 +81,7 @@ define(
|
||||
* to display in this indicator. This will return "D",
|
||||
* which should appear as a database icon.
|
||||
* @returns {string} the character of the database icon
|
||||
* @memberof platform/persistence/elastic.ElasticIndicator#
|
||||
*/
|
||||
getGlyph: function () {
|
||||
return "D";
|
||||
@@ -88,6 +91,7 @@ define(
|
||||
* This is used to color the glyph to match its
|
||||
* state (one of ok, caution or err)
|
||||
* @returns {string} the CSS class to apply to this glyph
|
||||
* @memberof platform/persistence/elastic.ElasticIndicator#
|
||||
*/
|
||||
getGlyphClass: function () {
|
||||
return state.glyphClass;
|
||||
@@ -95,6 +99,7 @@ define(
|
||||
/**
|
||||
* Get the text that should appear in the indicator.
|
||||
* @returns {string} brief summary of connection status
|
||||
* @memberof platform/persistence/elastic.ElasticIndicator#
|
||||
*/
|
||||
getText: function () {
|
||||
return state.text;
|
||||
@@ -103,6 +108,7 @@ define(
|
||||
* Get a longer-form description of the current connection
|
||||
* space, suitable for display in a tooltip
|
||||
* @returns {string} longer summary of connection status
|
||||
* @memberof platform/persistence/elastic.ElasticIndicator#
|
||||
*/
|
||||
getDescription: function () {
|
||||
return state.description;
|
||||
@@ -113,4 +119,4 @@ define(
|
||||
|
||||
return ElasticIndicator;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -37,6 +37,7 @@ define(
|
||||
* The ElasticPersistenceProvider reads and writes JSON documents
|
||||
* (more specifically, domain object models) to/from an ElasticSearch
|
||||
* instance.
|
||||
* @memberof platform/persistence/elastic
|
||||
* @constructor
|
||||
*/
|
||||
function ElasticPersistenceProvider($http, $q, SPACE, ROOT, PATH) {
|
||||
@@ -120,6 +121,7 @@ define(
|
||||
*
|
||||
* @returns {Promise.<string[]>} a promise for a list of
|
||||
* spaces supported by this provider
|
||||
* @memberof platform/persistence/elastic.ElasticPersistenceProvider#
|
||||
*/
|
||||
listSpaces: function () {
|
||||
return $q.when(spaces);
|
||||
@@ -130,6 +132,7 @@ define(
|
||||
* @param {string} space the space to check
|
||||
* @returns {Promise.<string[]>} a promise for the list of
|
||||
* identifiers
|
||||
* @memberof platform/persistence/elastic.ElasticPersistenceProvider#
|
||||
*/
|
||||
listObjects: function (space) {
|
||||
return $q.when([]);
|
||||
@@ -143,6 +146,7 @@ define(
|
||||
* @returns {Promise.<boolean>} a promise for an indication
|
||||
* of the success (true) or failure (false) of this
|
||||
* operation
|
||||
* @memberof platform/persistence/elastic.ElasticPersistenceProvider#
|
||||
*/
|
||||
createObject: function (space, key, value) {
|
||||
return put(key, value).then(checkResponse);
|
||||
@@ -156,6 +160,7 @@ define(
|
||||
* @returns {Promise.<object>} a promise for the stored
|
||||
* object; this will resolve to undefined if no such
|
||||
* object is found.
|
||||
* @memberof platform/persistence/elastic.ElasticPersistenceProvider#
|
||||
*/
|
||||
readObject: function (space, key) {
|
||||
return get(key).then(getModel);
|
||||
@@ -169,6 +174,7 @@ define(
|
||||
* @returns {Promise.<boolean>} a promise for an indication
|
||||
* of the success (true) or failure (false) of this
|
||||
* operation
|
||||
* @memberof platform/persistence/elastic.ElasticPersistenceProvider#
|
||||
*/
|
||||
updateObject: function (space, key, value) {
|
||||
function checkUpdate(response) {
|
||||
@@ -187,6 +193,7 @@ define(
|
||||
* @returns {Promise.<boolean>} a promise for an indication
|
||||
* of the success (true) or failure (false) of this
|
||||
* operation
|
||||
* @memberof platform/persistence/elastic.ElasticPersistenceProvider#
|
||||
*/
|
||||
deleteObject: function (space, key, value) {
|
||||
return del(key).then(checkResponse);
|
||||
@@ -197,4 +204,4 @@ define(
|
||||
|
||||
return ElasticPersistenceProvider;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -26,4 +26,4 @@ define({
|
||||
OVERWRITE_KEY: "overwrite",
|
||||
TIMESTAMP_FORMAT: "YYYY-MM-DD HH:mm:ss\\Z",
|
||||
UNKNOWN_USER: "unknown user"
|
||||
});
|
||||
});
|
||||
|
||||
@@ -29,11 +29,14 @@ define(
|
||||
/**
|
||||
* Controller to support the template to be shown in the
|
||||
* dialog shown for persistence failures.
|
||||
* @constructor
|
||||
* @memberof platform/persistence/queue
|
||||
*/
|
||||
function PersistenceFailureController() {
|
||||
return {
|
||||
/**
|
||||
* Format a timestamp for display in the dialog.
|
||||
* @memberof platform/persistence/queue.PersistenceFailureController#
|
||||
*/
|
||||
formatTimestamp: function (timestamp) {
|
||||
return moment.utc(timestamp)
|
||||
@@ -41,6 +44,7 @@ define(
|
||||
},
|
||||
/**
|
||||
* Format a user name for display in the dialog.
|
||||
* @memberof platform/persistence/queue.PersistenceFailureController#
|
||||
*/
|
||||
formatUsername: function (username) {
|
||||
return username || Constants.UNKNOWN_USER;
|
||||
@@ -50,4 +54,4 @@ define(
|
||||
|
||||
return PersistenceFailureController;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -41,6 +41,8 @@ define(
|
||||
/**
|
||||
* Populates a `dialogModel` to pass to `dialogService.getUserChoise`
|
||||
* in order to choose between Overwrite and Cancel.
|
||||
* @constructor
|
||||
* @memberof platform/persistence/queue
|
||||
*/
|
||||
function PersistenceFailureDialog(failures) {
|
||||
var revisionErrors = [],
|
||||
@@ -72,4 +74,4 @@ define(
|
||||
|
||||
return PersistenceFailureDialog;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -121,6 +121,8 @@ define(
|
||||
* to overwrite/cancel as appropriate.
|
||||
* @param {Array} failures persistence failures, as prepared
|
||||
* by PersistenceQueueHandler
|
||||
* @constructor
|
||||
* @memberof platform/persistence/queue
|
||||
*/
|
||||
handle: handleFailures
|
||||
};
|
||||
@@ -128,4 +130,4 @@ define(
|
||||
|
||||
return PersistenceFailureHandler;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -50,6 +50,8 @@ define(
|
||||
* persistence when the queue is flushed
|
||||
* @param {number} [DELAY] optional; delay in milliseconds between
|
||||
* attempts to flush the queue
|
||||
* @constructor
|
||||
* @memberof platform/persistence/queue
|
||||
*/
|
||||
function PersistenceQueue(
|
||||
$q,
|
||||
@@ -74,4 +76,4 @@ define(
|
||||
|
||||
return PersistenceQueue;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -34,6 +34,8 @@ define(
|
||||
* @param $q Angular's $q, for promises
|
||||
* @param {PersistenceFailureHandler} handler to invoke in the event
|
||||
* that a persistence attempt fails.
|
||||
* @constructor
|
||||
* @memberof platform/persistence/queue
|
||||
*/
|
||||
function PersistenceQueueHandler($q, failureHandler) {
|
||||
|
||||
@@ -98,6 +100,7 @@ define(
|
||||
* associated domain objects, in id->object pairs.
|
||||
* @param {PersistenceQueue} queue the persistence queue,
|
||||
* to requeue as necessary
|
||||
* @memberof platform/persistence/queue.PersistenceQueueHandler#
|
||||
*/
|
||||
persist: function (persistences, domainObjects, queue) {
|
||||
var ids = Object.keys(persistences);
|
||||
@@ -108,4 +111,4 @@ define(
|
||||
|
||||
return PersistenceQueueHandler;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -41,6 +41,8 @@ define(
|
||||
* persistence when the queue is flushed
|
||||
* @param {number} [DELAY] optional; delay in milliseconds between
|
||||
* attempts to flush the queue
|
||||
* @constructor
|
||||
* @memberof platform/persistence/queue
|
||||
*/
|
||||
function PersistenceQueueImpl($q, $timeout, handler, DELAY) {
|
||||
var self,
|
||||
@@ -118,6 +120,7 @@ define(
|
||||
* @param {DomainObject} domainObject the domain object
|
||||
* @param {PersistenceCapability} persistence the object's
|
||||
* undecorated persistence capability
|
||||
* @memberof platform/persistence/queue.PersistenceQueueImpl#
|
||||
*/
|
||||
put: function (domainObject, persistence) {
|
||||
var id = domainObject.getId();
|
||||
@@ -132,4 +135,4 @@ define(
|
||||
|
||||
return PersistenceQueueImpl;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -34,6 +34,8 @@ define(
|
||||
* capability
|
||||
* @param {DomainObject} domainObject the domain object which exposes
|
||||
* the capability
|
||||
* @constructor
|
||||
* @memberof platform/persistence/queue
|
||||
*/
|
||||
function QueuingPersistenceCapability(queue, persistence, domainObject) {
|
||||
var queuingPersistence = Object.create(persistence);
|
||||
@@ -48,4 +50,4 @@ define(
|
||||
|
||||
return QueuingPersistenceCapability;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -35,6 +35,7 @@ define(
|
||||
* will be handled in batches (allowing failure notification to
|
||||
* also be presented in batches.)
|
||||
*
|
||||
* @memberof platform/persistence/queue
|
||||
* @constructor
|
||||
*/
|
||||
function QueuingPersistenceCapabilityDecorator(
|
||||
@@ -87,6 +88,7 @@ define(
|
||||
* @returns {Object.<string,function|Capability>} all
|
||||
* capabilities known to be valid for this model, as
|
||||
* key-value pairs
|
||||
* @memberof platform/persistence/queue.QueuingPersistenceCapabilityDecorator#
|
||||
*/
|
||||
getCapabilities: getCapabilities
|
||||
};
|
||||
@@ -94,4 +96,4 @@ define(
|
||||
|
||||
return QueuingPersistenceCapabilityDecorator;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user