Package org.pentaho.platform.util
Class ActionUtil
java.lang.Object
org.pentaho.platform.util.ActionUtil
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.pentaho.platform.api.action.IAction
createActionBean
(String actionClassName, String actionId) Returns an instance ofIAction
created from the provided parameters.static org.pentaho.platform.api.action.IAction
createActionBean
(String actionClassName, String actionId, boolean retryBeanInstantiationIfFailed) Returns an instance ofIAction
created from the provided parameters.static String
extractName
(Map<String, Serializable> params) Looks up the work item name within theMap
.static String
generateWorkItemName
(String inputFilePath, String userName) Returns a name for a work item which includes the input file name (derived frominputFilePath
) anduser
that executed it, in the following format: %input file name%-%user%, stripping any invalid characters.static String
generateWorkItemName
(Map<String, Serializable> params) static String
static String
getStreamProviderContent
(Map<String, Serializable> params) static boolean
static void
prepareMap
(Map<String, Serializable> params) Prepares theparams
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 providedkey
from theparams
Map
, if it exists, as well as its "equivalent", as defined within theKEY_MAP
.static void
Sends an email with the file representing the providedfilePath
as 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 providedkey
from theparams
Map
, if it exists, as well as its "equivalent", as defined within theKEY_MAP
. If the providedkey
is a key within theKEY_MAP
, its "equivalent" is the value. If the providedkey
is a value within theKEY_MAP
, its "equivalent" is the key.
Example: Given aKEY_MAP
that 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
- theMap
from which keys are being removedkey
- theString
key being removed from the map
-
prepareMap
Prepares theparams
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.- Parameters:
params
- theMap
or 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
- aMap
containing action/work item related attributes, in particularinputFile
andactionUser
, 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
) anduser
that 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 ofIAction
created 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:
IAction
created from the provided parameters.- Throws:
Exception
- when theIAction
cannot 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 ofIAction
created 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:
IAction
created from the provided parameters.- Throws:
Exception
- when theIAction
cannot 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 providedfilePath
as an attachment. All information needed to send the email (to, from, cc, bcc etc) is expected to be proviced in theactionParams
Map
.
-