public class ActionUtil extends Object
Constructor and Description |
---|
ActionUtil() |
Modifier and Type | Method and Description |
---|---|
static org.pentaho.platform.api.action.IAction |
createActionBean(String actionClassName,
String actionId)
Returns an instance of
IAction created from the provided parameters. |
static org.pentaho.platform.api.action.IAction |
createActionBean(String actionClassName,
String actionId,
boolean retryBeanInstantiationIfFailed)
Returns an instance of
IAction created from the provided parameters. |
static String |
extractUid(Map<String,Serializable> params)
Looks up the
ActionUtil.WORK_ITEM_UID within the Map . |
static String |
generateWorkItemUid(Map<String,Serializable> params) |
static String |
generateWorkItemUid(String inputFilePath,
String userName)
Returns a unique id for a work item which includes the input file name (derived from
inputFilePath ),
user and date , in the following format: WI-%input file name%-%user%-%date%, stripping any
invalid characters. |
static String |
getInlineInputFileOnStreamProvider(Map<String,Serializable> params) |
static String |
getStreamProviderContent(Map<String,Serializable> params) |
static boolean |
isInlinePassingOfInputOnStreamProvider(Map<String,Serializable> params) |
static void |
prepareMap(Map<String,Serializable> params)
Prepares the
params Map for 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 void |
removeKeyFromMap(Map<String,?> params,
String key)
Removes the provided
key from the params Map , if it exists, as well as its
"equivalent", as defined within the KEY_MAP . |
static void |
sendEmail(Map<String,Object> actionParams,
Map<String,Serializable> params,
String filePath)
Sends an email with the file representing the provided
filePath as an attachment. |
public static final String QUARTZ_ACTIONCLASS
public static final String QUARTZ_ACTIONUSER
public static final String QUARTZ_ACTIONID
public static final String QUARTZ_STREAMPROVIDER
public static final String QUARTZ_STREAMPROVIDER_INPUT_FILE
public static final String QUARTZ_STREAMPROVIDER_INLINE_INPUT_FILE
public static final String QUARTZ_STREAMPROVIDER_INLINE_OUTPUT_FILE
public static final String QUARTZ_UIPASSPARAM
public static final String QUARTZ_LINEAGE_ID
public static final String QUARTZ_RESTART_FLAG
public static final String QUARTZ_AUTO_CREATE_UNIQUE_FILENAME
public static final String QUARTZ_APPEND_DATE_FORMAT
public static final String INVOKER_ACTIONPARAMS
public static final String INVOKER_ACTIONCLASS
public static final String INVOKER_ACTIONUSER
public static final String INVOKER_ACTIONID
public static final String INVOKER_STREAMPROVIDER
public static final String INVOKER_STREAMPROVIDER_INPUT_FILE
public static final String INVOKER_STREAMPROVIDER_OUTPUT_FILE_PATTERN
public static final String INVOKER_STREAMPROVIDER_UNIQUE_FILE_NAME
public static final String INVOKER_UIPASSPARAM
public static final String INVOKER_RESTART_FLAG
public static final String INVOKER_SESSION
public static final String INVOKER_ASYNC_EXEC
public static final String INVOKER_DEFAULT_ASYNC_EXEC_VALUE
public static final String INVOKER_SYNC_VALUE
public static final String WORK_ITEM_UID
public static void removeKeyFromMap(Map<String,?> params, String key)
key
from the params
Map
, if it exists, as well as its
"equivalent", as defined within the KEY_MAP
. If the provided key
is a key within the KEY_MAP
, its "equivalent" is the value. If the provided key
is a value within the KEY_MAP
, its
"equivalent" is the key.KEY_MAP
that looks like this:removeKeyFromMap( map, "firstName")
will attempt to remove the "firstName" and "first.name" keys
from the provided map. Likewise, a call to removeKeyFromMap( map, "last.name")
will attempt to remove the
"last.name" and "lastName" keys from the provided map.params
- the Map
from which keys are being removedkey
- the String
key being removed from the mappublic static void prepareMap(Map<String,Serializable> params)
params
Map
for 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.params
- the Map
or parameters needed to invoke the IAction
public static String extractUid(Map<String,Serializable> params)
ActionUtil.WORK_ITEM_UID
within the Map
. If available, the value is returned,
otherwise a new uid is generated and placed within the Map
. This is done ONLY if the
IWorkItemLifecycleEventPublisher
bean is defined, if the bean is not defined, null
is returned.
It is the caller's responsibility to handle this case gracefully.public static String generateWorkItemUid(Map<String,Serializable> params)
params
- a Map
containing action/work item related attributes, in particular inputFile
and
actionUser
, which are both used for the purpose of generating the uid.#generateWorkItemUid(String, String)}
public static boolean isInlinePassingOfInputOnStreamProvider(Map<String,Serializable> params)
public static String getInlineInputFileOnStreamProvider(Map<String,Serializable> params)
public static String getStreamProviderContent(Map<String,Serializable> params)
public static String generateWorkItemUid(String inputFilePath, String userName)
inputFilePath
),
user
and date
, in the following format: WI-%input file name%-%user%-%date%, stripping any
invalid characters.inputFilePath
- the path of the input file of the action being invoked - optionaluserName
- the user executing the actionpublic static org.pentaho.platform.api.action.IAction createActionBean(String actionClassName, String actionId) throws org.pentaho.platform.api.action.ActionInvocationException
IAction
created from the provided parameters.actionClassName
- the name of the class being resolvedactionId
- the is of the action which corresponds to some bean idIAction
created from the provided parameters.Exception
- when the IAction
cannot be created for some reasonorg.pentaho.platform.api.action.ActionInvocationException
public static org.pentaho.platform.api.action.IAction createActionBean(String actionClassName, String actionId, boolean retryBeanInstantiationIfFailed) throws org.pentaho.platform.api.action.ActionInvocationException
IAction
created from the provided parameters.actionClassName
- the name of the class being resolvedactionId
- the is of the action which corresponds to some bean idIAction
created from the provided parameters.Exception
- when the IAction
cannot be created for some reasonorg.pentaho.platform.api.action.ActionInvocationException
public static void sendEmail(Map<String,Object> actionParams, Map<String,Serializable> params, String filePath)
filePath
as an attachment. All information
needed to send the email (to, from, cc, bcc etc) is expected to be proviced in the actionParams
Map
.Copyright © 2018 Hitachi Vantara. All rights reserved.