public class ActionUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
INVOKER_ACTIONCLASS |
static String |
INVOKER_ACTIONID |
static String |
INVOKER_ACTIONPARAMS |
static String |
INVOKER_ACTIONUSER |
static String |
INVOKER_ASYNC_EXEC |
static String |
INVOKER_DEFAULT_ASYNC_EXEC_VALUE |
static String |
INVOKER_RESTART_FLAG |
static String |
INVOKER_SESSION |
static String |
INVOKER_STREAMPROVIDER |
static String |
INVOKER_STREAMPROVIDER_INPUT_FILE |
static String |
INVOKER_STREAMPROVIDER_OUTPUT_FILE_PATTERN |
static String |
INVOKER_STREAMPROVIDER_UNIQUE_FILE_NAME |
static String |
INVOKER_SYNC_VALUE |
static String |
INVOKER_UIPASSPARAM |
static String |
QUARTZ_ACTIONCLASS |
static String |
QUARTZ_ACTIONID |
static String |
QUARTZ_ACTIONUSER |
static String |
QUARTZ_AUTO_CREATE_UNIQUE_FILENAME |
static String |
QUARTZ_LINEAGE_ID |
static String |
QUARTZ_RESTART_FLAG |
static String |
QUARTZ_STREAMPROVIDER |
static String |
QUARTZ_STREAMPROVIDER_INPUT_FILE |
static String |
QUARTZ_UIPASSPARAM |
static String |
WORK_ITEM_UID |
Constructor and Description |
---|
ActionUtil() |
Modifier and Type | Method and Description |
---|---|
static IAction |
createActionBean(String actionClassName,
String actionId)
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 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_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 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.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.params
- a Map
that may contain the ActionUtil.WORK_ITEM_UID
ActionUtil.WORK_ITEM_UID
from the Map
or a new uid, or null
in the absence of
the IWorkItemLifecycleEventPublisher
beanpublic 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 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 IAction createActionBean(String actionClassName, String actionId) throws 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 reasonActionInvocationException
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 © 2017 Hitachi Vantara. All rights reserved.