Module: alfresco/services/actions/ManageAspectsService

alfresco/services/actions/ManageAspectsService

This service handles requests to manage the aspects on particular node. The aspects that are available to be added (and optionally those that can be added and removed) are expected to be provided as configuration attributes when instantiating this service.
Author:
  • Dave Draper
License:
Source:

Members

addableAspects :array

This is the array of available aspects can be added to a node. If this is not provided then it is assumed that all the aspected configured in the availableAspects array can be added to a node.
Type:
  • array
Default Value:
  • null
Source:

availableAspects :array

This is the array of available aspects that are available.
Type:
  • array
Default Value:
  • null
Source:

i18nRequirements :object[]

An array of the i18n files to use with this widget.
Type:
  • object[]
Default Value:
  • [{i18nFile: "./i18n/ManageAspectsService.properties"}]
Source:

itemKey :string

The key of each aspect that is used as the unique identifier of that aspect.
Type:
  • string
Default Value:
  • "id"
Source:

removableAspects :array

This is the array of available aspects can be removed from a node. If this is not provided then it is assumed that all the aspected configured in the availableAspects array can be removed from a node.
Type:
  • array
Default Value:
  • null
Source:

widgetsForAvailableItemsView :object

This is the model to use for rendering the items that are available for selection.
Type:
  • object
Source:

widgetsForPickedItemsView :object

This is the model to use for rendering the items that have been picked.
Type:
  • object
Source:

Methods

constructor(args)

Extends the inherited constructor to set up the configured aspects.
Parameters:
Name Type Description
args object[]
Source:

onManageAspects(item)

Handles requests to manage aspects by making a request to get the currently applied aspects for the requested Node. This is always performed to ensure that the data is not stale.
Parameters:
Name Type Description
item object The item to perform the action on
Source:

registerSubscriptions()

Sets up the service using the configuration provided. This will check to see what aspects are available, addable and removable. If no addble or removable aspects are explicitly configured then it is assumed that all available aspects are both addable and removable. Only aspects that are configured as being available will be displayed in the manage aspects picker, only aspects that are addable can be added in the manage aspects picker and only aspects that are removable can be removed in the manage aspects picker.
Since:
  • 1.0.32
Source:

<inner> findAdded(originallySelected, added, aspect)

This function generates the data to be posted when updating the applied aspects. The Alfresco Repository API expects an "added" array to be provided in the POST body so this function will construct that array from the data provided by the form submissions.
Parameters:
Name Type Description
originallySelected array The originally selected aspects when the dialog was opened.
added array The array of added aspects to populate
aspect object The current for consideration of adding to the "added" array
Source:

<inner> findRemoved(originallySelected, removed, aspect)

This function generates the data to be posted when updating the applied aspects. The Alfresco Repository API expects a "removed" array to be provided in the POST body so this function will construct that array from the data provided by the form submissions.
Parameters:
Name Type Description
originallySelected array The originally selected aspects when the dialog was opened.
removed array The array of removed aspects to populate
aspect object The current for consideration of adding to the "removed" array
Source:

<inner> onActionManageAspectsConfirmation(payload)

This function should be called when a user confirms the changes that they have made to aspects for a particular item (e.g. document or folder).
Parameters:
Name Type Description
payload object The payload containing the updated aspects.
Source:

<inner> onAspectsFailure(response, originalRequestConfig)

Handles failed requests to retrieve the currently applied aspects for a given node.
Parameters:
Name Type Description
response object The response object from the XHR request
originalRequestConfig object The object passed when making the original XHR request
Source:

<inner> onAspectsSuccess(response, originalRequestConfig)

Handles successful requests to retrieve the currently applied aspects for a given node.
Parameters:
Name Type Description
response object The response object from the XHR request
originalRequestConfig object The object passed when making the original XHR request
Source:

<inner> onUpdateFailure(response, originalRequestConfig)

Handles failed requests to update aspects on a node.
Parameters:
Name Type Description
response object The response object from the XHR request
originalRequestConfig object The object passed when making the original XHR request
Source:

<inner> onUpdateSuccess(response, originalRequestConfig)

Handles successful requests update aspects on a node.
Parameters:
Name Type Description
response object The response object from the XHR request
originalRequestConfig object The object passed when making the original XHR request
Source:

<inner> processAspect(The, The)

Inspects the supplied aspect data and adds it into the aspects array if it is an object or constructs an object for it if it is a string.
Parameters:
Name Type Description
The array array of aspects to add the current aspect data into
The object | string current aspect data
Source:

<inner> processAspectLabel(aspect) → {string}

Attempts to convert an aspect into user friendly label. This assumes that aspects are mapped to as follows, if the aspect is "cm:complianceable" then the NLS key is expected to be: "aspect.cm_complianceable"
Parameters:
Name Type Description
aspect string The aspect to get a user friendly label for
Source:
Returns:
A user friendly label for the aspect (or the original aspect if one can't be found)
Type
string

<inner> showAspectsDialog(item, currentAspects)

Displays a dialog containing a SimplePicker control that allows the user to select which aspects they wish to have applie to the current item.
Parameters:
Name Type Description
item object The item to modify the applied aspects of.
currentAspects array The array of aspects that are currently applied to the item.
Source: