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 buildingTaskobjects. 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 booleancompressOutputstatic java.lang.StringCONTENT_TYPE_BINARYstatic java.lang.StringCONTENT_TYPE_HTMLstatic java.lang.StringCONTENT_TYPE_JSONstatic java.lang.String[]CONTENT_TYPE_JSON_ALLstatic java.lang.StringCONTENT_TYPE_JSON_Dstatic java.lang.StringCONTENT_TYPE_JSON_Pstatic java.lang.StringCONTENT_TYPE_XMLstatic java.lang.StringCONTENT_TYPE_XML_ANFprotected static intDEFAULT_MAX_WAITThe default value to use for max wait (in ms)protected static intDEFAULT_POLLING_FREQThe default value to use for polling frequency (in ms).protected TaskParameterMetadataexecFlagsParamThe task parameter for execution flags.protected static intINDEFINITE_MAX_WAITThe value that indicates an indefinite wait.protected TaskParameterMetadatamaxWaitParamThe task parameter for maximum wait.protected TaskMetadataImplmetadataThe metadata associated with this task (and its parameters).protected WebPrivilegesExpressionmPrivilegesWe store here the task privileges.protected TaskParameterMetadatamsgIDParamThe task parameter for message ID.protected TaskParameterMetadataobjectIDParamThe task parameter for object ID.static java.lang.StringOTHER_CONTENT_KEY_LAYOUTSThe name of the other content key that refers to the JUIL JS Layouts.protected static java.lang.StringPARAM_NAME_EXEC_FLAGSThe name of the task parameter that identifies the Execution Flags to set.protected static java.lang.StringPARAM_NAME_MAX_WAITThe name of the task parameter that identifies the maximum wait for getting results (in ms).protected static java.lang.StringPARAM_NAME_MESSAGE_IDThe name of the task parameter that identifies the message IDprotected static java.lang.StringPARAM_NAME_OBJECT_IDThe name of the task parameter that identifies the object IDprotected static java.lang.StringPARAM_NAME_POLLING_FREQThe name of the task parameter that identifies the polling frequency (in ms)protected static java.lang.StringPARAM_NAME_RESULT_FLAGSThe name of the task parameter that identifies the Result Flags to set.static java.lang.StringPARAM_NAME_SESSION_IDThe name of the task parameter that identifies the IServer session ID.static java.lang.StringPARAM_NAME_SESSION_STATEThe name of the task parameter that identifies the IServer session state.protected static java.lang.StringPARAM_NAME_STATE_IDThe name of the task parameter that identifies the State ID.protected TaskParameterMetadatapollingFreqParamThe task parameter for polling frequency.protected static java.lang.StringPREFERENCE_DEFAULT_MAX_WAIT_IN_TASKPreference that defines the maximum amount of time (in milliseconds) that a task will wait for the execution results in synchronous mode.protected TaskParameterMetadataresultFlagsParamThe task parameter for result flags.protected TaskParameterMetadatasessionIDParamThe task parameter for session ID.protected TaskParameterMetadatasessionStateParamThe task parameter for session State.protected TaskParameterMetadatastateIDParamThe 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 voidaddExecFlagsParam(boolean required, java.lang.String defValue)Adds a execution flags parameter to this task's definition.protected voidaddJuilLayouts(TaskOutput taskOutput)Adds any referenced Juil layouts to the task payload.protected voidaddMaxWaitParam(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 voidaddMaxWaitParam(boolean required, int maxWait)Adds a maximum wait parameter to this task's definition.protected voidaddMessageIDParam(boolean required, java.lang.String defValue)Adds a message ID parameter to this task's definition.protected voidaddObjectIDParam(boolean required, java.lang.String defValue)Adds an object ID parameter to this task's definition.protected voidaddParameterMetadata(TaskParameterMetadataImpl paramMetadataImpl)Deprecated.protected TaskParameterMetadataaddParameterMetadata(java.lang.String name, java.lang.String desc, boolean required, java.lang.Object defValue)Adds the metadata for a parameter.protected TaskParameterMetadataaddParameterMetadata(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 voidaddPollingFrequencyParam(boolean required)Adds a polling frequency parameter to this task's definition with a default value specified byDEFAULT_POLLING_FREQ.protected voidaddPollingFrequencyParam(boolean required, int pollingFreq)Adds a polling frequency parameter to this task's definition.protected voidaddResultFlagsParam(boolean required, java.lang.String defValue)Adds a results flags parameter to this task's definition.protected voidaddSessionIDParam(boolean required, java.lang.String defValue)Adds a session ID parameter to this task's definition.protected voidaddSessionStateParam(boolean required, java.lang.String defValue)Adds a session state parameter to this task's definition.protected voidaddStateIDParam(boolean required, java.lang.String defValue)Adds a state ID parameter to this task's definition.protected voidcheckForRequiredParameters(RequestKeys requestKeys)Checks whether all required parameters are present or not.voiddestroy()Destroys the Task.booleangetCompressOutput()java.lang.StringgetID()Returns the identifier of this Task.TaskMetadatagetMetadata()Returns information about this Task.WebPrivilegesExpressiongetPrivileges()Returns a task privilegesprotected java.lang.StringgetSysDefaultPreferenceValue(java.lang.String name)Returns the value of a sys default preferencevoidinit(ContainerServices containerSvcs)Initializes the Task with the specifiedContainerServicesobject.TaskRequestContextnewRequestContext()Returns a new object to hold per-request data for this Task.voidprocessRequest(TaskRequestContext context, MarkupOutput markupOutput)The default implementation of this version of processRequest is empty.voidprocessRequest(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 PostedFileretrieveUploadedFile(TaskRequestContext context, java.lang.String fileFieldName)voidsetCompressOutput(boolean newValue)protected voidsetDescription(java.lang.String desc)Sets the description for this task.voidsetID(java.lang.String id)Sets the identifier for this Task.protected voidsetMetadata(TaskMetadataImpl metadata)Deprecated.It is prefered to useaddParameterMetadata(String, String, boolean, Object).voidsetPrivileges(WebPrivilegesExpression value)Sets the task privileges.protected voidvalidateContentType(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:TaskInitializes the Task with the specifiedContainerServicesobject.- Specified by:
initin interfaceTask- Parameters:
containerSvcs- TheContainerServicesobject.
-
destroy
public void destroy()
Description copied from interface:TaskDestroys the Task. This enables the Task to release any persistent data structures.
-
getID
public java.lang.String getID()
Description copied from interface:TaskReturns the identifier of this Task.
-
setID
public void setID(java.lang.String id)
Description copied from interface:TaskSets the identifier for this Task.
-
newRequestContext
public TaskRequestContext newRequestContext()
Description copied from interface:TaskReturns a new object to hold per-request data for this Task.- Specified by:
newRequestContextin interfaceTask- Returns:
- A new
TaskRequestContextobject for this Task.
-
getMetadata
public TaskMetadata getMetadata()
Description copied from interface:TaskReturns information about this Task. It includes the description of the Task and any parameters which it supports.- Specified by:
getMetadatain interfaceTask- Returns:
- A
TaskMetadataobject for this Task.
-
getCompressOutput
public boolean getCompressOutput()
- Specified by:
getCompressOutputin interfaceTask
-
setCompressOutput
public void setCompressOutput(boolean newValue)
- Specified by:
setCompressOutputin 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:
processRequestin interfaceTask- Parameters:
context- TheTaskRequestContextobject that maintains the state of the request.markupOutput- TheMarkupOutputthat 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:
processRequestin interfaceTask- Parameters:
context- TheTaskRequestContextobject that maintains the state of the request.taskOutput- TheTaskOutputthat 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- TheTaskParameterMetadataImplobject.
-
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- TheTaskMetadataImplobject for this task.
-
checkForRequiredParameters
protected void checkForRequiredParameters(RequestKeys requestKeys) throws TaskRequestMalformedException
Checks whether all required parameters are present or not.- Parameters:
requestKeys- TheRequestKeysobject 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:TaskSets the task privileges. The privileges will be verified when the task obtains a session- Specified by:
setPrivilegesin interfaceTask- Parameters:
value- The privilege expression
-
getPrivileges
public WebPrivilegesExpression getPrivileges()
Description copied from interface:TaskReturns a task privileges- Specified by:
getPrivilegesin 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
-
-