Managed assets are images, style sheets, AMD modules or other assets that are part of a
view. To access these assets from a coach, you might need to use a global JavaScript function to generate the URL of the asset. For example, to generate a URL for an AMD module which is contained in a zip file.
About this task
The com_ibm_bpm_coach.getManagedAssetUrl global JavaScript function composes the URL to the managed assets without checking whether the asset exists or not.
Procedure
- Use the following syntax:
- syntax
com_ibm_bpm_coach.getManagedAssetUrl = function(assetName,
assetType, projectShortName,
returnWithoutAssetName, additionalPath,
addBuildNumberParameter)
- returns
- the URL of the managed asset. If assetType is not one of the three allowed
(see the following table), the function returns null. The returned URL looks something like the
following
example:
/teamworks/webasset/<snapshot ID>/<assetType>/<assetName><additionalPath>?build=xxxx
The
snapshot ID is determined by the framework and the other parts of the URL by the parameters that you
include.
- Use the following parameters:
| Parameter |
Description |
assetName (String) |
The file name of the managed asset. Note: You can use the
'!' notation to reference a file inside an archive. For example, if you are
pointing to an image file in a .zip file, use the following format for the URL:
file.zip!path/file.extension.
|
assetType (String) |
The type of the managed asset. Must be one of the following:
- com_ibm_bpm_coach.assetType_WEB: web managed asset (css, png, ..)
- com_ibm_bpm_coach.assetType_SERVER: server managed asset (for example zip, jar)
- com_ibm_bpm_coach.assetType_DESIGN: design managed asset (xsl)
|
projectShortName (String) |
The short name of the project where the managed asset is requested. If this is
not provided, the current project is assumed. If the module is in a referenced toolkit, you must
include the PROJECT parameter to ensure that the view can use module in the
context of the process application. |
returnWithoutAssetName (Boolean) |
(Optional) Sets whether the returned URL includes the asset name. If this
parameter is not provided, the default is false, and the asset name is included in the URL
path. |
additionalPath (String) |
(Optional) If the returnWithoutAssetName parameter is set
to false, appends the provided path to the assetName in the returned URL. |
addBuildNumberParameter (Boolean) |
(Optional) Sets whether the returned URL includes the current build number as
a query parameter. The build number is unique for different versions and fix packs. If you are using
the returned URL to retrieve the asset directly, use this parameter to prevent the browser loading a
stale version from its cache. |