Package com.microstrategy.web.tasks
Class AbstractBaseTask
- java.lang.Object
-
- com.microstrategy.web.tasks.AbstractBaseTask
-
- All Implemented Interfaces:
Task
- Direct Known Subclasses:
AbstractAppTask
,AbstractArchitectTask
,AbstractDrillTask
,AbstractResultSetResultsTask
,AddProjectDBRoleTask
,AnswerPromptsTask
,BinaryXMLAPITask
,CancelSubscriptionsTask
,CheckLatencyTask
,CheckUserPrivilegesTask
,CloseSessionsTask
,CreateProjectTask
,DataWranglerServerTask
,DeleteMessageTask
,DeletePaletteTask
,DeleteProjectTask
,DIClearDiscoverCache
,DIEditEMMASourceTable
,DocumentXMLResultsTask
,EditCubeTask
,GetFlexSettingsTask
,GetGeoShapesTask
,GetMobileReportsTask
,GetMobileSubscriptionTask
,GetNamedFolderID
,GetObjectInBulkTask
,GetObjectSubscriptionsTask
,GetODBCDriversTask
,GetPageByTreeTask
,GetProjectsTask
,GetTriggersTask
,GetUserPrivilegeXmlTask
,ImportFileTask
,IphoneGraphResultsTask
,IPhoneMobileSubscribeTask
,IPhoneMobileUnsubscribeTask
,LoginFirstTask
,LoginTask
,LogoutTask
,MobileDuplicateMessageTask
,MobileExecuteReportDSTask
,MobileExecuteReportTask
,MobileExecuteRWDSTask
,MobileExecuteRWTask
,MobileGetDevicesTask
,MobileGetInboxMessageTime
,MobileGetPushRegistrationStatusTask
,MobileGraphResultsTask
,MobilePollStatusTask
,MobilePromptsXmlTask
,MobilePushRegisterTask
,MobilePushUnregisterTask
,MobileRefreshSubscriptionTask
,MobileRWPDFResultsTask
,MobileSavePropertiesTask
,MobileSaveSubscriptionTask
,MobileValidateMetricValueTask
,MojoGetDocumentManifestTask
,ObjectInfoTask
,PollStatusTask
,ReadFileContentsTask
,RecoverDataDiscoveryErrorsTask
,RetrievePreviewImageTask
,SaveAndPublishCubeTask
,SaveObjectACLTask
,SavePaletteTask
,SchemaInstanceActionTask
,SchemaManipulationTask
,ServerConnectionTask
,ServersTask
,SetCubeMappingTask
,StorePreviewImageTask
,UpdateThemeTask
,UploadFileTask
,UploadImageTask
,UserEntityInfoTask
,UserServicesTask
,WikiScrapperTask
public abstract class AbstractBaseTask extends java.lang.Object implements Task
Abstract base class for buildingTask
objects. This class provides support for managing an ID (String) along with the task metadata. It also provides support for adding "common" task parameters to your task implementation (seeaddSessionStateParam(boolean, String)
and others).- Since:
- MicroStrategy Web 8.1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
compressOutput
static java.lang.String
CONTENT_TYPE_BINARY
static java.lang.String
CONTENT_TYPE_HTML
static java.lang.String
CONTENT_TYPE_JSON
static java.lang.String[]
CONTENT_TYPE_JSON_ALL
static java.lang.String
CONTENT_TYPE_JSON_D
static java.lang.String
CONTENT_TYPE_JSON_P
static java.lang.String
CONTENT_TYPE_XML
static java.lang.String
CONTENT_TYPE_XML_ANF
protected static int
DEFAULT_MAX_WAIT
The default value to use for max wait (in ms)protected static int
DEFAULT_POLLING_FREQ
The default value to use for polling frequency (in ms).protected TaskParameterMetadata
execFlagsParam
The task parameter for execution flags.protected static int
INDEFINITE_MAX_WAIT
The value that indicates an indefinite wait.protected TaskParameterMetadata
maxWaitParam
The task parameter for maximum wait.protected TaskMetadataImpl
metadata
The metadata associated with this task (and its parameters).protected WebPrivilegesExpression
mPrivileges
We store here the task privileges.protected TaskParameterMetadata
msgIDParam
The task parameter for message ID.protected TaskParameterMetadata
objectIDParam
The task parameter for object ID.static java.lang.String
OTHER_CONTENT_KEY_LAYOUTS
The name of the other content key that refers to the JUIL JS Layouts.protected static java.lang.String
PARAM_NAME_EXEC_FLAGS
The name of the task parameter that identifies the Execution Flags to set.protected static java.lang.String
PARAM_NAME_MAX_WAIT
The name of the task parameter that identifies the maximum wait for getting results (in ms).protected static java.lang.String
PARAM_NAME_MESSAGE_ID
The name of the task parameter that identifies the message IDprotected static java.lang.String
PARAM_NAME_OBJECT_ID
The name of the task parameter that identifies the object IDprotected static java.lang.String
PARAM_NAME_POLLING_FREQ
The name of the task parameter that identifies the polling frequency (in ms)protected static java.lang.String
PARAM_NAME_RESULT_FLAGS
The name of the task parameter that identifies the Result Flags to set.static java.lang.String
PARAM_NAME_SESSION_ID
The name of the task parameter that identifies the IServer session ID.static java.lang.String
PARAM_NAME_SESSION_STATE
The name of the task parameter that identifies the IServer session state.protected static java.lang.String
PARAM_NAME_STATE_ID
The name of the task parameter that identifies the State ID.protected TaskParameterMetadata
pollingFreqParam
The task parameter for polling frequency.protected static java.lang.String
PREFERENCE_DEFAULT_MAX_WAIT_IN_TASK
Preference that defines the maximum amount of time (in milliseconds) that a task will wait for the execution results in synchronous mode.protected TaskParameterMetadata
resultFlagsParam
The task parameter for result flags.protected TaskParameterMetadata
sessionIDParam
The task parameter for session ID.protected TaskParameterMetadata
sessionStateParam
The task parameter for session State.protected TaskParameterMetadata
stateIDParam
The task parameter for state ID.
-
Constructor Summary
Constructors Constructor Description AbstractBaseTask(java.lang.String desc)
Creates a new AbstractBaseTask object.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addExecFlagsParam(boolean required, java.lang.String defValue)
Adds a execution flags parameter to this task's definition.protected void
addJuilLayouts(TaskOutput taskOutput)
Adds any referenced Juil layouts to the task payload.protected void
addMaxWaitParam(boolean required)
Adds a maximum wait parameter to this task's definition with a default value specified by sys default preferencePREFERENCE_DEFAULT_MAX_WAIT_IN_TASK
.protected void
addMaxWaitParam(boolean required, int maxWait)
Adds a maximum wait parameter to this task's definition.protected void
addMessageIDParam(boolean required, java.lang.String defValue)
Adds a message ID parameter to this task's definition.protected void
addObjectIDParam(boolean required, java.lang.String defValue)
Adds an object ID parameter to this task's definition.protected void
addParameterMetadata(TaskParameterMetadataImpl paramMetadataImpl)
Deprecated.protected TaskParameterMetadata
addParameterMetadata(java.lang.String name, java.lang.String desc, boolean required, java.lang.Object defValue)
Adds the metadata for a parameter.protected TaskParameterMetadata
addParameterMetadata(java.lang.String name, java.lang.String desc, boolean required, java.lang.Object defValue, java.lang.String type, java.lang.String validator)
Adds the metadata for a parameter.protected void
addPollingFrequencyParam(boolean required)
Adds a polling frequency parameter to this task's definition with a default value specified byDEFAULT_POLLING_FREQ
.protected void
addPollingFrequencyParam(boolean required, int pollingFreq)
Adds a polling frequency parameter to this task's definition.protected void
addResultFlagsParam(boolean required, java.lang.String defValue)
Adds a results flags parameter to this task's definition.protected void
addSessionIDParam(boolean required, java.lang.String defValue)
Adds a session ID parameter to this task's definition.protected void
addSessionStateParam(boolean required, java.lang.String defValue)
Adds a session state parameter to this task's definition.protected void
addStateIDParam(boolean required, java.lang.String defValue)
Adds a state ID parameter to this task's definition.protected void
checkForRequiredParameters(RequestKeys requestKeys)
Checks whether all required parameters are present or not.void
destroy()
Destroys the Task.boolean
getCompressOutput()
java.lang.String
getID()
Returns the identifier of this Task.TaskMetadata
getMetadata()
Returns information about this Task.WebPrivilegesExpression
getPrivileges()
Returns a task privilegesprotected java.lang.String
getSysDefaultPreferenceValue(java.lang.String name)
Returns the value of a sys default preferencevoid
init(ContainerServices containerSvcs)
Initializes the Task with the specifiedContainerServices
object.TaskRequestContext
newRequestContext()
Returns a new object to hold per-request data for this Task.void
processRequest(TaskRequestContext context, MarkupOutput markupOutput)
The default implementation of this version of processRequest is empty.void
processRequest(TaskRequestContext context, TaskOutput taskOutput)
The default implementation of this method of processRequest gets the Primary Content from the TaskOutput and invokes theprocessRequest(TaskRequestContext, MarkupOutput)
version.protected PostedFile
retrieveUploadedFile(TaskRequestContext context, java.lang.String fileFieldName)
void
setCompressOutput(boolean newValue)
protected void
setDescription(java.lang.String desc)
Sets the description for this task.void
setID(java.lang.String id)
Sets the identifier for this Task.protected void
setMetadata(TaskMetadataImpl metadata)
Deprecated.It is prefered to useaddParameterMetadata(String, String, boolean, Object)
.void
setPrivileges(WebPrivilegesExpression value)
Sets the task privileges.protected void
validateContentType(TaskRequestContext context, java.lang.String[] cTypes)
-
-
-
Field Detail
-
mPrivileges
protected WebPrivilegesExpression mPrivileges
We store here the task privileges. They will be verified when the task obtains a session
-
PARAM_NAME_SESSION_STATE
public static final java.lang.String PARAM_NAME_SESSION_STATE
The name of the task parameter that identifies the IServer session state.- See Also:
- Constant Field Values
-
PARAM_NAME_SESSION_ID
public static final java.lang.String PARAM_NAME_SESSION_ID
The name of the task parameter that identifies the IServer session ID.- See Also:
- Constant Field Values
-
PARAM_NAME_RESULT_FLAGS
protected static final java.lang.String PARAM_NAME_RESULT_FLAGS
The name of the task parameter that identifies the Result Flags to set.- See Also:
- Constant Field Values
-
PARAM_NAME_MAX_WAIT
protected static final java.lang.String PARAM_NAME_MAX_WAIT
The name of the task parameter that identifies the maximum wait for getting results (in ms).- See Also:
- Constant Field Values
-
PARAM_NAME_POLLING_FREQ
protected static final java.lang.String PARAM_NAME_POLLING_FREQ
The name of the task parameter that identifies the polling frequency (in ms)- See Also:
- Constant Field Values
-
PARAM_NAME_MESSAGE_ID
protected static final java.lang.String PARAM_NAME_MESSAGE_ID
The name of the task parameter that identifies the message ID- See Also:
- Constant Field Values
-
PARAM_NAME_OBJECT_ID
protected static final java.lang.String PARAM_NAME_OBJECT_ID
The name of the task parameter that identifies the object ID- Since:
- MicroStrategy Web 8.1.1
- See Also:
- Constant Field Values
-
PARAM_NAME_EXEC_FLAGS
protected static final java.lang.String PARAM_NAME_EXEC_FLAGS
The name of the task parameter that identifies the Execution Flags to set.- Since:
- MicroStrategy Web 8.1.1
- See Also:
- Constant Field Values
-
PARAM_NAME_STATE_ID
protected static final java.lang.String PARAM_NAME_STATE_ID
The name of the task parameter that identifies the State ID.- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
OTHER_CONTENT_KEY_LAYOUTS
public static final java.lang.String OTHER_CONTENT_KEY_LAYOUTS
The name of the other content key that refers to the JUIL JS Layouts.- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
DEFAULT_MAX_WAIT
protected static final int DEFAULT_MAX_WAIT
The default value to use for max wait (in ms)- See Also:
- Constant Field Values
-
INDEFINITE_MAX_WAIT
protected static final int INDEFINITE_MAX_WAIT
The value that indicates an indefinite wait.- See Also:
- Constant Field Values
-
DEFAULT_POLLING_FREQ
protected static final int DEFAULT_POLLING_FREQ
The default value to use for polling frequency (in ms).- See Also:
- Constant Field Values
-
PREFERENCE_DEFAULT_MAX_WAIT_IN_TASK
protected static final java.lang.String PREFERENCE_DEFAULT_MAX_WAIT_IN_TASK
Preference that defines the maximum amount of time (in milliseconds) that a task will wait for the execution results in synchronous mode.- Since:
- MicroStrategy Web 8.1.2
- See Also:
- Constant Field Values
-
compressOutput
protected boolean compressOutput
-
CONTENT_TYPE_JSON
public static final java.lang.String CONTENT_TYPE_JSON
- See Also:
- Constant Field Values
-
CONTENT_TYPE_JSON_P
public static final java.lang.String CONTENT_TYPE_JSON_P
- See Also:
- Constant Field Values
-
CONTENT_TYPE_JSON_D
public static final java.lang.String CONTENT_TYPE_JSON_D
- See Also:
- Constant Field Values
-
CONTENT_TYPE_JSON_ALL
public static final java.lang.String[] CONTENT_TYPE_JSON_ALL
-
CONTENT_TYPE_XML
public static final java.lang.String CONTENT_TYPE_XML
- See Also:
- Constant Field Values
-
CONTENT_TYPE_XML_ANF
public static final java.lang.String CONTENT_TYPE_XML_ANF
- See Also:
- Constant Field Values
-
CONTENT_TYPE_HTML
public static final java.lang.String CONTENT_TYPE_HTML
- See Also:
- Constant Field Values
-
CONTENT_TYPE_BINARY
public static final java.lang.String CONTENT_TYPE_BINARY
- See Also:
- Constant Field Values
-
metadata
protected TaskMetadataImpl metadata
The metadata associated with this task (and its parameters).
-
pollingFreqParam
protected TaskParameterMetadata pollingFreqParam
The task parameter for polling frequency.
-
maxWaitParam
protected TaskParameterMetadata maxWaitParam
The task parameter for maximum wait.
-
resultFlagsParam
protected TaskParameterMetadata resultFlagsParam
The task parameter for result flags.
-
sessionIDParam
protected TaskParameterMetadata sessionIDParam
The task parameter for session ID.
-
sessionStateParam
protected TaskParameterMetadata sessionStateParam
The task parameter for session State.
-
msgIDParam
protected TaskParameterMetadata msgIDParam
The task parameter for message ID.
-
objectIDParam
protected TaskParameterMetadata objectIDParam
The task parameter for object ID.- Since:
- MicroStrategy Web 8.1.1
-
execFlagsParam
protected TaskParameterMetadata execFlagsParam
The task parameter for execution flags.- Since:
- MicroStrategy Web 8.1.1
-
stateIDParam
protected TaskParameterMetadata stateIDParam
The task parameter for state ID.- Since:
- MicroStrategy Web 9.0.0
-
-
Method Detail
-
init
public void init(ContainerServices containerSvcs)
Description copied from interface:Task
Initializes the Task with the specifiedContainerServices
object.- Specified by:
init
in interfaceTask
- Parameters:
containerSvcs
- TheContainerServices
object.
-
destroy
public void destroy()
Description copied from interface:Task
Destroys the Task. This enables the Task to release any persistent data structures.
-
getID
public java.lang.String getID()
Description copied from interface:Task
Returns the identifier of this Task.
-
setID
public void setID(java.lang.String id)
Description copied from interface:Task
Sets the identifier for this Task.
-
newRequestContext
public TaskRequestContext newRequestContext()
Description copied from interface:Task
Returns a new object to hold per-request data for this Task.- Specified by:
newRequestContext
in interfaceTask
- Returns:
- A new
TaskRequestContext
object for this Task.
-
getMetadata
public TaskMetadata getMetadata()
Description copied from interface:Task
Returns information about this Task. It includes the description of the Task and any parameters which it supports.- Specified by:
getMetadata
in interfaceTask
- Returns:
- A
TaskMetadata
object for this Task.
-
getCompressOutput
public boolean getCompressOutput()
- Specified by:
getCompressOutput
in interfaceTask
-
setCompressOutput
public void setCompressOutput(boolean newValue)
- Specified by:
setCompressOutput
in interfaceTask
-
processRequest
public void processRequest(TaskRequestContext context, MarkupOutput markupOutput) throws TaskException
The default implementation of this version of processRequest is empty. Task implementators may override either version of processRequest.- Specified by:
processRequest
in interfaceTask
- Parameters:
context
- TheTaskRequestContext
object that maintains the state of the request.markupOutput
- TheMarkupOutput
that records the contents of the Task response.- Throws:
TaskException
- If the Task was unable to satisfy the request.- Since:
- MicroStrategy Web 9.0.0
- See Also:
Task.processRequest(TaskRequestContext, MarkupOutput)
-
processRequest
public void processRequest(TaskRequestContext context, TaskOutput taskOutput) throws TaskException
The default implementation of this method of processRequest gets the Primary Content from the TaskOutput and invokes theprocessRequest(TaskRequestContext, MarkupOutput)
version.- Specified by:
processRequest
in interfaceTask
- Parameters:
context
- TheTaskRequestContext
object that maintains the state of the request.taskOutput
- TheTaskOutput
that contains the output generated by the Task.- Throws:
TaskException
- If the Task was unable to satisfy the request.- Since:
- MicroStrategy Web 9.0.0
- See Also:
Task.processRequest(TaskRequestContext, TaskOutput)
-
addParameterMetadata
protected TaskParameterMetadata addParameterMetadata(java.lang.String name, java.lang.String desc, boolean required, java.lang.Object defValue)
Adds the metadata for a parameter.- Parameters:
name
- The name of the parameter.desc
- The description of the parameter.required
- Whether the parameter is required or not.defValue
- The default value associated with the parameter, if none is supplied when the task invoked.- Since:
- MicroStrategy Web 9.0.0
-
addParameterMetadata
protected TaskParameterMetadata addParameterMetadata(java.lang.String name, java.lang.String desc, boolean required, java.lang.Object defValue, java.lang.String type, java.lang.String validator)
Adds the metadata for a parameter.- Parameters:
name
- The name of the parameter.desc
- The description of the parameter.required
- Whether the parameter is required or not.defValue
- The default value associated with the parameter, if none is supplied when the task invoked.type
- The data type of the parameter.validator
- The validator to check whether the value for the parameter is valid.
-
addParameterMetadata
@Deprecated protected void addParameterMetadata(TaskParameterMetadataImpl paramMetadataImpl)
Deprecated.Adds a task parameter metadata object (to fully describe the parameter).- Parameters:
paramMetadataImpl
- TheTaskParameterMetadataImpl
object.
-
setDescription
protected void setDescription(java.lang.String desc)
Sets the description for this task.- Parameters:
desc
- The description of the task.
-
setMetadata
@Deprecated protected void setMetadata(TaskMetadataImpl metadata)
Deprecated.It is prefered to useaddParameterMetadata(String, String, boolean, Object)
.Sets the metadata for this task.- Parameters:
metadata
- TheTaskMetadataImpl
object for this task.
-
checkForRequiredParameters
protected void checkForRequiredParameters(RequestKeys requestKeys) throws TaskRequestMalformedException
Checks whether all required parameters are present or not.- Parameters:
requestKeys
- TheRequestKeys
object that contains all parameters.- Throws:
TaskRequestMalformedException
- If some required parameters are missing.
-
addPollingFrequencyParam
protected void addPollingFrequencyParam(boolean required, int pollingFreq)
Adds a polling frequency parameter to this task's definition.- Parameters:
required
- Indicates whether this parameter is required or not.pollingFreq
- Identifies the default value to use.
-
addPollingFrequencyParam
protected void addPollingFrequencyParam(boolean required)
Adds a polling frequency parameter to this task's definition with a default value specified byDEFAULT_POLLING_FREQ
.- Parameters:
required
- Indicates whether this parameter is required or not.
-
addMaxWaitParam
protected void addMaxWaitParam(boolean required, int maxWait)
Adds a maximum wait parameter to this task's definition.- Parameters:
required
- Indicates whether this parameter is required or not.maxWait
- Identifies the default value to use.
-
addMaxWaitParam
protected void addMaxWaitParam(boolean required)
Adds a maximum wait parameter to this task's definition with a default value specified by sys default preferencePREFERENCE_DEFAULT_MAX_WAIT_IN_TASK
.- Parameters:
required
- Indicates whether this parameter is required or not.
-
getSysDefaultPreferenceValue
protected java.lang.String getSysDefaultPreferenceValue(java.lang.String name)
Returns the value of a sys default preference- Parameters:
name
- the preference's name- Returns:
- the value of a sys default preference
- Since:
- MicroStrategy Web 8.1.2
-
addResultFlagsParam
protected void addResultFlagsParam(boolean required, java.lang.String defValue)
Adds a results flags parameter to this task's definition.- Parameters:
required
- Indicates whether this parameter is required or not.defValue
- Identifies the default value to use.
-
addSessionIDParam
protected void addSessionIDParam(boolean required, java.lang.String defValue)
Adds a session ID parameter to this task's definition.- Parameters:
required
- Indicates whether this parameter is required or not.defValue
- Identifies the default value to use.
-
addSessionStateParam
protected void addSessionStateParam(boolean required, java.lang.String defValue)
Adds a session state parameter to this task's definition.- Parameters:
required
- Indicates whether this parameter is required or not.defValue
- Identifies the default value to use.
-
addMessageIDParam
protected void addMessageIDParam(boolean required, java.lang.String defValue)
Adds a message ID parameter to this task's definition.- Parameters:
required
- Indicates whether this parameter is required or not.defValue
- Identifies the default value to use.
-
addObjectIDParam
protected void addObjectIDParam(boolean required, java.lang.String defValue)
Adds an object ID parameter to this task's definition.- Parameters:
required
- Indicates whether this parameter is required or not.defValue
- Identifies the default value to use.- Since:
- MicroStrategy Web 8.1.1
-
addExecFlagsParam
protected void addExecFlagsParam(boolean required, java.lang.String defValue)
Adds a execution flags parameter to this task's definition.- Parameters:
required
- Indicates whether this parameter is required or not.defValue
- Identifies the default value to use.- Since:
- MicroStrategy Web 8.1.1
-
addStateIDParam
protected void addStateIDParam(boolean required, java.lang.String defValue)
Adds a state ID parameter to this task's definition.- Parameters:
required
- Indicates whether this parameter is required or not.defValue
- Identifies the default value to use.- Since:
- MicroStrategy Web 9.0.0
-
addJuilLayouts
protected void addJuilLayouts(TaskOutput taskOutput)
Adds any referenced Juil layouts to the task payload.- Parameters:
taskOutput
- The TaskOutput to add the Juil layouts to.- Since:
- MicroStrategy Web 9.0.0
-
setPrivileges
public void setPrivileges(WebPrivilegesExpression value)
Description copied from interface:Task
Sets the task privileges. The privileges will be verified when the task obtains a session- Specified by:
setPrivileges
in interfaceTask
- Parameters:
value
- The privilege expression
-
getPrivileges
public WebPrivilegesExpression getPrivileges()
Description copied from interface:Task
Returns a task privileges- Specified by:
getPrivileges
in interfaceTask
- Returns:
- a task privileges
-
retrieveUploadedFile
protected PostedFile retrieveUploadedFile(TaskRequestContext context, java.lang.String fileFieldName) throws TaskRequestMalformedException
- Throws:
TaskRequestMalformedException
-
validateContentType
protected void validateContentType(TaskRequestContext context, java.lang.String[] cTypes) throws TaskRequestMalformedException
- Throws:
TaskRequestMalformedException
-
-