Module: alfresco/services/actions/ChangeTypeService

alfresco/services/actions/ChangeTypeService

This service handles requests to change the type of a particular node. The types that are available are expected to be provided as a configuration attribute when instantiating this service. When used on Alfresco Share the types can be found in the XML configuration files.
Since:
  • 1.0.58
Author:
  • Dave Draper
License:
Source:

Example

This is an example configuration:

{
  name: "alfresco/services/actions/ChangeTypeService",
  config: {
    types: [
      {
        name: "cm:folder"
      },
      {
        name: "cm:content",
        label: "Content",
        subTypes: [
          {
            name: "cm:sub-content",
            label: "Sub-Content",
              subTypes: [
                {
                  name: "cm:super-sub-content"
                }
              ]
           }
        ]
      }
    ]
  }
}

Members

i18nRequirements :object[]

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

types :array

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

Methods

addSubTypes(applicableTypes, type, types)

Called from updateApplicableTypes to add all applicable sub-types of the current node type.
Parameters:
Name Type Description
applicableTypes object[] An array to be populates with type options.
type string The type of the node to be updated
types object[] An array of types to process.
Source:

onChangeTypeRequest(item)

Handles requests to change the type of a node. This will perform an XHR request if necessary to load the full metadata for the node to be upated in order to retrieve its current type.
Parameters:
Name Type Description
item object The item to perform the action on
Source:
Fires:
  • module:alfresco/core/topics#event:GET_DOCUMENT

onNodeDataFailure()

Handles requests to retrieve the full metadata for a Node.
Source:

onNodeDataSuccess()

Handles requests to retrieve the full metadata for a Node.
Source:

onTypeSelection(The)

This function is called when a new type is selected for the node and it makes an XHR request to the Alfresco Repository to attempt to perform the requested change.
Parameters:
Name Type Description
The object payload for generated when selecting a new type.
Source:

onUpdateFailure(response, originalRequestConfig)

Handles failed requests to change a node type.
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:
Fires:

onUpdateSuccess(response, originalRequestConfig)

Handles successful requests to change a node type.
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:
Fires:

registerSubscriptions()

Registers change type subscriptions.
Source:
Listens to Events:

showTypeSelectionDialog(item)

Shows the type selection dialog. The available types for selection are generated by calling updateApplicableTypes with the type of the current node and the configured types.
Parameters:
Name Type Description
item object The node to change the type of
Source:
Fires:
  • module:alfresco/core/topics#event:CREATE_FORM_DIALOG

updateApplicableTypes(applicableTypes, type, types)

Updates the supplied array with applicable sub-types for the supplied type.
Parameters:
Name Type Description
applicableTypes object[] An array to be populates with type options.
type string The type of the node to be updated
types object[] An array of types to process.
Source: