Module: alfresco/core/ObjectProcessingMixin

alfresco/core/ObjectProcessingMixin

This mixin module is primarily provided for allowing publication payloads to be processed using a set of utility functions. It was written to be used by the _PublishPayloadMixin but can be mixed into any module that needs to take advantage of the object processing capabilities that it provides.
Author:
  • Dave Draper
License:
Source:

Methods

applyFunction(obj, key, func)

Apply the supplied function to the value of the supplied key in the supplied object
Parameters:
Name Type Description
obj object The object to get the value from
key string The key of the object to use
func function | string A function or function name (within "this" scope) to apply to values
Source:

convertNodeRefToUrl(nodeRef)

This utility function will convert any NodeRef token into a URL friendly version (e.g. the "://" will be converted to "/")
Parameters:
Name Type Description
nodeRef string The value to process
Source:
Returns:
The processed value

processCurrentItemTokens(valueToProcess) → {*}

Wrapper for processTokens, searching within currentItem
Parameters:
Name Type Description
valueToProcess string The value to process.
Source:
Returns:
The processed value
Type
*

processCurrentMetadataTokens(valueToProcess) → {*}

Wrapper for processTokens, searching within currentMetadata
Parameters:
Name Type Description
valueToProcess string The value to process.
Since:
  • 1.0.43
Source:
Returns:
The processed value
Type
*

processHashTokens(valueToProcess) → {*}

Wrapper for processTokens, searching within the currently set hash values
Parameters:
Name Type Description
valueToProcess string The value to process.
Since:
  • 1.0.68
Source:
Returns:
The processed value
Type
*

processInstanceTokens(valueToProcess) → {*}

Wrapper for processTokens, searching within this
Parameters:
Name Type Description
valueToProcess string The value to process.
Source:
Returns:
The processed value
Type
*

processMessageTokens(valueToProcess) → {*}

This utility function will resolve any token against configured i18n properties
Parameters:
Name Type Description
valueToProcess string The value to process.
Since:
  • 1.0.68
Source:
Returns:
The processed value
Type
*

replaceColons(v) → {string}

This utility function will replaced all colons in a string with underscores. This has been provided for assisting with processing qnames into values that can be included in a URL.
Parameters:
Name Type Description
v string The value to process.
Source:
Returns:
The processed value.
Type
string

setCurrentItem(v)

This utility function will convert the value "___AlfCurrentItem" into the actual currentItem object. It will return the supplied value if it is anything else.
Parameters:
Name Type Description
v string The value to process.
Source:
Returns:
The processed value

<inner> processObject(functions, obj, ancestors) → {object}

This utility function can be used to work through the supplied object and process string values with all the supplied functions.
Parameters:
Name Type Argument Default Description
functions Array.<function()> | Array.<string> An array of functions or function names (within "this" scope) to apply to values
obj object The object to process
ancestors object[] <optional>
[] An ancestors stack, used to check for recursion
Source:
Returns:
The processed object
Type
object

<inner> processTokens(value, object) → {*}

This utility function will perform token substitution on the supplied string value using the values from the calling object. If the token cannot be found in the calling object then it will be left as is (including the curly braces).
Parameters:
Name Type Description
value String the token to replace
object Object the object containing the token
Source:
Returns:
Type
*

<inner> safeReplace(sourceObject, tokenIncudingBraces, tokenWithoutBraces) → {string}

This replace function updates the default Dojo replace function to only replace tokens if the token is a key in the supplied object.
Parameters:
Name Type Description
sourceObject object The object to retrieve values from.
tokenIncudingBraces string The token including braces (e.g. "{token}")
tokenWithoutBraces string The token without braces (e.g. "token")
Source:
Returns:
The replacement value
Type
string