Package org.pentaho.platform.util
Class ActionUtil
java.lang.Object
org.pentaho.platform.util.ActionUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.pentaho.platform.api.action.IActioncreateActionBean(String actionClassName, String actionId) Returns an instance ofIActioncreated from the provided parameters.static org.pentaho.platform.api.action.IActioncreateActionBean(String actionClassName, String actionId, boolean retryBeanInstantiationIfFailed) Returns an instance ofIActioncreated from the provided parameters.static StringextractName(Map<String, Serializable> params) Looks up the work item name within theMap.static StringgenerateWorkItemName(String inputFilePath, String userName) Returns a name for a work item which includes the input file name (derived frominputFilePath) anduserthat executed it, in the following format: %input file name%-%user%, stripping any invalid characters.static StringgenerateWorkItemName(Map<String, Serializable> params) static Stringstatic StringgetStreamProviderContent(Map<String, Serializable> params) static booleanstatic voidprepareMap(Map<String, Serializable> params) Prepares theparamsMapfor action invocation, adding appropriate keys that are not scheduler specific, so that the action invocation code can operate on these mapped non-scheduler specific keys, rather than any keys defined within the scheduler.static voidremoveKeyFromMap(Map<String, ?> params, String key) Removes the providedkeyfrom theparamsMap, if it exists, as well as its "equivalent", as defined within theKEY_MAP.static voidSends an email with the file representing the providedfilePathas an attachment.
-
Field Details
-
QUARTZ_ACTIONCLASS
- See Also:
-
QUARTZ_ACTIONUSER
- See Also:
-
QUARTZ_ACTIONID
- See Also:
-
QUARTZ_STREAMPROVIDER
- See Also:
-
QUARTZ_STREAMPROVIDER_INPUT_FILE
- See Also:
-
QUARTZ_STREAMPROVIDER_INLINE_INPUT_FILE
- See Also:
-
QUARTZ_STREAMPROVIDER_INLINE_OUTPUT_FILE
- See Also:
-
QUARTZ_UIPASSPARAM
- See Also:
-
QUARTZ_LINEAGE_ID
- See Also:
-
QUARTZ_RESTART_FLAG
- See Also:
-
QUARTZ_AUTO_CREATE_UNIQUE_FILENAME
- See Also:
-
QUARTZ_APPEND_DATE_FORMAT
- See Also:
-
INVOKER_ACTIONPARAMS
- See Also:
-
INVOKER_ACTIONCLASS
- See Also:
-
INVOKER_ACTIONUSER
- See Also:
-
INVOKER_ACTIONID
- See Also:
-
INVOKER_UUID
- See Also:
-
INVOKER_CONTENT_TYPE
- See Also:
-
INVOKER_STATUS
- See Also:
-
INVOKER_STREAMPROVIDER
- See Also:
-
INVOKER_STREAMPROVIDER_INPUT_FILE
- See Also:
-
INVOKER_STREAMPROVIDER_OUTPUT_FILE_PATTERN
- See Also:
-
INVOKER_STREAMPROVIDER_UNIQUE_FILE_NAME
- See Also:
-
INVOKER_UIPASSPARAM
- See Also:
-
INVOKER_RESTART_FLAG
- See Also:
-
INVOKER_SESSION
- See Also:
-
INVOKER_ASYNC_EXEC
- See Also:
-
INVOKER_DEFAULT_ASYNC_EXEC_VALUE
- See Also:
-
INVOKER_SYNC_VALUE
- See Also:
-
WORK_ITEM_UID
- See Also:
-
WORK_ITEM_NAME
- See Also:
-
-
Constructor Details
-
ActionUtil
public ActionUtil()
-
-
Method Details
-
removeKeyFromMap
Removes the providedkeyfrom theparamsMap, if it exists, as well as its "equivalent", as defined within theKEY_MAP. If the providedkeyis a key within theKEY_MAP, its "equivalent" is the value. If the providedkeyis a value within theKEY_MAP, its "equivalent" is the key.
Example: Given aKEY_MAPthat looks like this:
- firstName=first.name
- lastName=last.name
- addr=address
- person.age=age
removeKeyFromMap( map, "firstName")will attempt to remove the "firstName" and "first.name" keys from the provided map. Likewise, a call toremoveKeyFromMap( map, "last.name")will attempt to remove the "last.name" and "lastName" keys from the provided map.- Parameters:
params- theMapfrom which keys are being removedkey- theStringkey being removed from the map
-
prepareMap
Prepares theparamsMapfor action invocation, adding appropriate keys that are not scheduler specific, so that the action invocation code can operate on these mapped non-scheduler specific keys, rather than any keys defined within the scheduler. The corresponding entries that use the scheduler related keys are removed.- Parameters:
params- theMapor parameters needed to invoke theIAction
-
extractName
Looks up the work item name within theMap. If available, the value is returned, otherwise a new name is generated and returned. -
generateWorkItemName
- Parameters:
params- aMapcontaining action/work item related attributes, in particularinputFileandactionUser, which are both used for the purpose of generating the uid.- Returns:
- a name for the work item
-
isInlinePassingOfInputOnStreamProvider
-
getInlineInputFileOnStreamProvider
-
getStreamProviderContent
-
generateWorkItemName
Returns a name for a work item which includes the input file name (derived frominputFilePath) anduserthat executed it, in the following format: %input file name%-%user%, stripping any invalid characters. This workItemName will be used for logging only- Parameters:
inputFilePath- the path of the input file of the action being invoked - optionaluserName- the user executing the action- Returns:
- a name for the work item
-
createActionBean
public static org.pentaho.platform.api.action.IAction createActionBean(String actionClassName, String actionId) throws org.pentaho.platform.api.action.ActionInvocationException Returns an instance ofIActioncreated from the provided parameters.- Parameters:
actionClassName- the name of the class being resolvedactionId- the is of the action which corresponds to some bean id- Returns:
IActioncreated from the provided parameters.- Throws:
Exception- when theIActioncannot be created for some reasonorg.pentaho.platform.api.action.ActionInvocationException
-
createActionBean
public static org.pentaho.platform.api.action.IAction createActionBean(String actionClassName, String actionId, boolean retryBeanInstantiationIfFailed) throws org.pentaho.platform.api.action.ActionInvocationException Returns an instance ofIActioncreated from the provided parameters.- Parameters:
actionClassName- the name of the class being resolvedactionId- the is of the action which corresponds to some bean id- Returns:
IActioncreated from the provided parameters.- Throws:
Exception- when theIActioncannot be created for some reasonorg.pentaho.platform.api.action.ActionInvocationException
-
sendEmail
public static void sendEmail(Map<String, Object> actionParams, Map<String, Serializable> params, String filePath) Sends an email with the file representing the providedfilePathas an attachment. All information needed to send the email (to, from, cc, bcc etc) is expected to be proviced in theactionParamsMap.
-