Package org.pentaho.platform.util
Class ActionUtil
- java.lang.Object
-
- org.pentaho.platform.util.ActionUtil
-
public class ActionUtil extends Object
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ActionUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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
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 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
sendEmail(Map<String,Object> actionParams, Map<String,Serializable> params, String filePath)
Sends an email with the file representing the providedfilePath
as an attachment.
-
-
-
Field Detail
-
QUARTZ_ACTIONCLASS
public static final String QUARTZ_ACTIONCLASS
- See Also:
- Constant Field Values
-
QUARTZ_ACTIONUSER
public static final String QUARTZ_ACTIONUSER
- See Also:
- Constant Field Values
-
QUARTZ_ACTIONID
public static final String QUARTZ_ACTIONID
- See Also:
- Constant Field Values
-
QUARTZ_STREAMPROVIDER
public static final String QUARTZ_STREAMPROVIDER
- See Also:
- Constant Field Values
-
QUARTZ_STREAMPROVIDER_INPUT_FILE
public static final String QUARTZ_STREAMPROVIDER_INPUT_FILE
- See Also:
- Constant Field Values
-
QUARTZ_STREAMPROVIDER_INLINE_INPUT_FILE
public static final String QUARTZ_STREAMPROVIDER_INLINE_INPUT_FILE
- See Also:
- Constant Field Values
-
QUARTZ_STREAMPROVIDER_INLINE_OUTPUT_FILE
public static final String QUARTZ_STREAMPROVIDER_INLINE_OUTPUT_FILE
- See Also:
- Constant Field Values
-
QUARTZ_UIPASSPARAM
public static final String QUARTZ_UIPASSPARAM
- See Also:
- Constant Field Values
-
QUARTZ_LINEAGE_ID
public static final String QUARTZ_LINEAGE_ID
- See Also:
- Constant Field Values
-
QUARTZ_RESTART_FLAG
public static final String QUARTZ_RESTART_FLAG
- See Also:
- Constant Field Values
-
QUARTZ_AUTO_CREATE_UNIQUE_FILENAME
public static final String QUARTZ_AUTO_CREATE_UNIQUE_FILENAME
- See Also:
- Constant Field Values
-
QUARTZ_APPEND_DATE_FORMAT
public static final String QUARTZ_APPEND_DATE_FORMAT
- See Also:
- Constant Field Values
-
INVOKER_ACTIONPARAMS
public static final String INVOKER_ACTIONPARAMS
- See Also:
- Constant Field Values
-
INVOKER_ACTIONCLASS
public static final String INVOKER_ACTIONCLASS
- See Also:
- Constant Field Values
-
INVOKER_ACTIONUSER
public static final String INVOKER_ACTIONUSER
- See Also:
- Constant Field Values
-
INVOKER_ACTIONID
public static final String INVOKER_ACTIONID
- See Also:
- Constant Field Values
-
INVOKER_UUID
public static final String INVOKER_UUID
- See Also:
- Constant Field Values
-
INVOKER_CONTENT_TYPE
public static final String INVOKER_CONTENT_TYPE
- See Also:
- Constant Field Values
-
INVOKER_STATUS
public static final String INVOKER_STATUS
- See Also:
- Constant Field Values
-
INVOKER_STREAMPROVIDER
public static final String INVOKER_STREAMPROVIDER
- See Also:
- Constant Field Values
-
INVOKER_STREAMPROVIDER_INPUT_FILE
public static final String INVOKER_STREAMPROVIDER_INPUT_FILE
- See Also:
- Constant Field Values
-
INVOKER_STREAMPROVIDER_OUTPUT_FILE_PATTERN
public static final String INVOKER_STREAMPROVIDER_OUTPUT_FILE_PATTERN
- See Also:
- Constant Field Values
-
INVOKER_STREAMPROVIDER_UNIQUE_FILE_NAME
public static final String INVOKER_STREAMPROVIDER_UNIQUE_FILE_NAME
- See Also:
- Constant Field Values
-
INVOKER_UIPASSPARAM
public static final String INVOKER_UIPASSPARAM
- See Also:
- Constant Field Values
-
INVOKER_RESTART_FLAG
public static final String INVOKER_RESTART_FLAG
- See Also:
- Constant Field Values
-
INVOKER_SESSION
public static final String INVOKER_SESSION
- See Also:
- Constant Field Values
-
INVOKER_ASYNC_EXEC
public static final String INVOKER_ASYNC_EXEC
- See Also:
- Constant Field Values
-
INVOKER_DEFAULT_ASYNC_EXEC_VALUE
public static final String INVOKER_DEFAULT_ASYNC_EXEC_VALUE
- See Also:
- Constant Field Values
-
INVOKER_SYNC_VALUE
public static final String INVOKER_SYNC_VALUE
- See Also:
- Constant Field Values
-
WORK_ITEM_UID
public static final String WORK_ITEM_UID
- See Also:
- Constant Field Values
-
WORK_ITEM_NAME
public static final String WORK_ITEM_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
removeKeyFromMap
public 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
. 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
public 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. The corresponding entries that use the scheduler related keys are removed.- Parameters:
params
- theMap
or parameters needed to invoke theIAction
-
extractName
public static String extractName(Map<String,Serializable> params)
Looks up the work item name within theMap
. If available, the value is returned, otherwise a new name is generated and returned.
-
generateWorkItemName
public static String generateWorkItemName(Map<String,Serializable> params)
- 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
public static boolean isInlinePassingOfInputOnStreamProvider(Map<String,Serializable> params)
-
getInlineInputFileOnStreamProvider
public static String getInlineInputFileOnStreamProvider(Map<String,Serializable> params)
-
getStreamProviderContent
public static String getStreamProviderContent(Map<String,Serializable> params)
-
generateWorkItemName
public 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. 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
.
-
-