Skip to main content

server.query.utils

ServerQueryUtils : d2/sdk/utils/server.query.utils

A general utility to access/process some commonly used D2-REST resources outside of a Backbone.Model or Backbone.Collection.

Extends: Object

ServerQueryUtils.appendQueryParams(url, options) ⇒ String

Form a query appended URL from a base URL, thus facilitates to make AJAX calls.

Kind: static method of ServerQueryUtils
Returns: String - The formed URL.

ParamTypeDescription
urlstring

The base URL.

optionsObject

The options hash to control URL generation.

options.scopestring

The scope of the target D2-REST resource

options.paginateboolean

Whether to paginate the URL.

ServerQueryUtils.parseResponse(response, options) ⇒ JSON

Parses response from D2-REST resource.

Kind: static method of ServerQueryUtils
Returns: JSON - The parsed response.

ParamTypeDescription
responseJSON

Raw response from server.

optionsObject

The options hash to control parsing.

options.scopestring

The scope of the target D2-REST resource

options.paginateboolean

Whether to extract page information from the response.

ServerQueryUtils.fetchColumnPreferences(options) ⇒ jQuery.Promise

Fetch column preferences for a widget. It caches the preference data for a given widget type and name, the first time it is fetched, and returns the data from this cache next time onwards.

Kind: static method of ServerQueryUtils
Returns: jQuery.Promise - resolves & invokes ColumnPreferenceDoneCallback on success, rejects otherwise.

ParamTypeDescription
optionsObject

Request options holder.

options.connectorConnector

AJAX transport. See Connector.

options.scope*

Scope of the request, usually should point to the related data model. E.g. when calling in the context of a collection, it should be the collection itself.

options.widgetTypestring

Type of the widget config.

options.widgetNamestring

Name of the widget config.

[options.defaultType]string

Default column types.

[options.columnOptions]Object

Options for the columns data, used while converting server columns to client columns

[options.columnOptions.typeColumn]boolean

Include type column

[options.columnOptions.reservedColumn]boolean

Include object lock status column

[options.columnOptions.commentColumn]boolean

Include comments column

[options.columnOptions.favoriteColumn]boolean

Include favorite status column

ServerQueryUtils.saveColumnPreferences(options) ⇒ jQuery.Promise

Save column preferences for a widget

Kind: static method of ServerQueryUtils
Returns: jQuery.Promise - resolves and invokes ColumnPreferenceDoneCallback on success, rejects otherwise.

ParamTypeDescription
optionsObject

Request options holder.

options.widgetTypestring

Type of the widget config.

options.widgetNamestring

Name of the widget config.

[options.defaultType]string

Default column types.

options.columnPreferenceexternal:ColumnPreferenceModel

The new preference data.

options.sortOrderstring

Specify a sort order.

ServerQueryUtils.getWidgetConfig(widgetType, widgetName) ⇒ object

Get widget configuration object.

Kind: static method of ServerQueryUtils
Returns: object - The widget config
Throws:

  • Error if any of the paramters are null or undefined or empty.
ParamTypeDescription
widgetTypestring

Type of the widget config.

widgetNamestring

Name of the widget config.

ServerQueryUtils.fetchPermissions(options) ⇒ jQuery.Promise

Fetch user's permission level for the objects

Kind: static method of ServerQueryUtils
Returns: jQuery.Promise - on success it resolves and invokes callback with list of object specific responses

ParamTypeDescription
optionsObject

Request options holder.

options.idsArray.<string>

Documentum object IDs.

options.connectorConnector

AJAX transport. See Connector.

options.permissionLevelstring

Level of permission to check. Any of Documentum permission i.e 'browse', 'read', 'relate', 'version', 'write', 'delete'

ServerQueryUtils.fetchFavorites(options) ⇒ jQuery.Promise

Fetch user's favorite(substription) status of the objects

Kind: static method of ServerQueryUtils
Returns: jQuery.Promise - on success it resolves and invokes callback with list of object specific responses

ParamTypeDescription
optionsObject

Request options holder.

options.idsArray.<string>

Documentum object IDs.

options.connectorConnector

AJAX transport. See Connector.

ServerQueryUtils.fetchActions(options) ⇒ jQuery.Promise

Fetch allowed actions for the objects

Kind: static method of ServerQueryUtils
Returns: jQuery.Promise - on success it resolves and invokes callback with list of object specific responses

ParamTypeDefaultDescription
optionsObject

Request options holder.

options.idsArray.<string>

Documentum object IDs.

options.connectorConnector

AJAX transport. See Connector.

options.menuTypestring

Type of actions to be fetched. See MenuTypes from Constants.

options.widgetTypestring

Type of widget for which menu is required (e.g. DoclistWidget). See D2 from WidgetConstants.D2

options.queryActionstring

Types of actions to request. Possible values are PROMOTED, NON-PROMOTED and ALL. Default is ALL

[options.parentIds]Array.<string>

List of parent ids in case the objects are renditions. It has to have a positional correspondence with ids i.e parentIds[0] should be the parent of id[0].

[options.associateIds]Array.<string>

List of associated object ids in case the objects are relations. It has to have a positional correspondence.

[options.rulesType]string"node"

Rule collection to be used for filtering the actions. Can be one of 'user', 'node'.

ServerQueryUtils.fetchLocations(options) ⇒ jQuery.Promise

Fetch locations of the given objects

Kind: static method of ServerQueryUtils
Returns: jQuery.Promise - on success it resolves and invokes callback with list of object specific responses

ParamTypeDefaultDescription
optionsObject

Request options holder.

options.idsArray.<string>

Documentum object IDs.

options.connectorConnector

AJAX transport. See Connector.

[options.fullPath]booleanfalse

Whether to parse full path or just include the immediate parent.

ServerQueryUtils.fetchDataForObjects(options) ⇒ jQuery.Promise

A single call to fetch different aspects of the objects. It can be used to fetch permission, favorited status, actions, locations, external share staus, preview formats and relation count for multiple objects

Kind: static method of ServerQueryUtils
Returns: jQuery.Promise - on success it resolves and invokes callback with separate maps representing permissions, favorites, actions etc. depending on what was requested.

ParamTypeDefaultDescription
optionsObject

Request options holder.

options.idsArray.<string>

Documentum object IDs.

options.connectorConnector

AJAX transport. See Connector.

[options.permissions]boolean | Object

Fetch permissions.

options.permissions.permissionLevelstring

Level of permission to check. Any of Documentum permission i.e 'browse', 'read', 'relate', 'version', 'write', 'delete'

[options.favorites]boolean

Fetch favorited status.

[options.actions]ActionRequestType

Fetch actions as per specified options.

[options.locations]boolean | Object

Fetch locations.

[options.locations.fullPath]booleanfalse

Parse full path of each location.

[options.externalShare]booleanfalse

Fetch external share status.

[options.previewFormats]booleanfalse

Fetch preview formats.

[options.relationsCount]booleanfalse

Fetch relations count.

ServerQueryUtils.fetchDataAsPropertiesForObjects(options) ⇒

Works the same as fetchDataForObjects(), additionally collects related data for every objects individually into a single object hash, as per most commonly used property naming conventions for NodeModel, so that the data can be easily merged with any target NodeModel.

Kind: static method of ServerQueryUtils
Returns: jQuery.Promise

ParamDescription
options

Same as the options parameter for fetchDataForObjects().