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 :
d2/sdk/utils/server.query.utils
- .appendQueryParams(url, options) ⇒
String
- .parseResponse(response, options) ⇒
JSON
- .fetchColumnPreferences(options) ⇒
jQuery.Promise
- .saveColumnPreferences(options) ⇒
jQuery.Promise
- .getWidgetConfig(widgetType, widgetName) ⇒
object
- .fetchPermissions(options) ⇒
jQuery.Promise
- .fetchFavorites(options) ⇒
jQuery.Promise
- .fetchActions(options) ⇒
jQuery.Promise
- .fetchLocations(options) ⇒
jQuery.Promise
- .fetchDataForObjects(options) ⇒
jQuery.Promise
- .fetchDataAsPropertiesForObjects(options) ⇒
- .appendQueryParams(url, options) ⇒
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.
Param | Type | Description |
---|---|---|
url | string | The base URL. |
options | Object | The options hash to control URL generation. |
options.scope | string | The scope of the target D2-REST resource |
options.paginate | boolean | 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.
Param | Type | Description |
---|---|---|
response | JSON | Raw response from server. |
options | Object | The options hash to control parsing. |
options.scope | string | The scope of the target D2-REST resource |
options.paginate | boolean | 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.
Param | Type | Description |
---|---|---|
options | Object | Request options holder. |
options.connector | Connector | 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.widgetType | string | Type of the widget config. |
options.widgetName | string | 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.
Param | Type | Description |
---|---|---|
options | Object | Request options holder. |
options.widgetType | string | Type of the widget config. |
options.widgetName | string | Name of the widget config. |
[options.defaultType] | string | Default column types. |
options.columnPreference | external:ColumnPreferenceModel | The new preference data. |
options.sortOrder | string | 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 arenull
orundefined
or empty.
Param | Type | Description |
---|---|---|
widgetType | string | Type of the widget config. |
widgetName | string | 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
Param | Type | Description |
---|---|---|
options | Object | Request options holder. |
options.ids | Array.<string> | Documentum object IDs. |
options.connector | Connector | AJAX transport. See Connector. |
options.permissionLevel | string | 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
Param | Type | Description |
---|---|---|
options | Object | Request options holder. |
options.ids | Array.<string> | Documentum object IDs. |
options.connector | Connector | 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
Param | Type | Default | Description |
---|---|---|---|
options | Object | Request options holder. | |
options.ids | Array.<string> | Documentum object IDs. | |
options.connector | Connector | AJAX transport. See Connector. | |
options.menuType | string | Type of actions to be fetched. See | |
options.widgetType | string | Type of widget for which menu is required (e.g. DoclistWidget). See | |
options.queryAction | string | 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 | |
[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
Param | Type | Default | Description |
---|---|---|---|
options | Object | Request options holder. | |
options.ids | Array.<string> | Documentum object IDs. | |
options.connector | Connector | AJAX transport. See Connector. | |
[options.fullPath] | boolean | false | 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.
Param | Type | Default | Description |
---|---|---|---|
options | Object | Request options holder. | |
options.ids | Array.<string> | Documentum object IDs. | |
options.connector | Connector | AJAX transport. See Connector. | |
[options.permissions] | boolean | Object | Fetch permissions. | |
options.permissions.permissionLevel | string | 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] | boolean | false | Parse full path of each location. |
[options.externalShare] | boolean | false | Fetch external share status. |
[options.previewFormats] | boolean | false | Fetch preview formats. |
[options.relationsCount] | boolean | false | 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
Param | Description |
---|---|
options | Same as the options parameter for fetchDataForObjects(). |