public abstract class

AbstractBaseTask

extends Object
implements Task
java.lang.Object
   ↳ com.microstrategy.web.tasks.AbstractBaseTask
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Abstract base class for building Task 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 (see addSessionStateParam(boolean, String) and others).

Summary

Constants
int DEFAULT_MAX_WAIT The default value to use for max wait (in ms)
int DEFAULT_POLLING_FREQ The default value to use for polling frequency (in ms).
int INDEFINITE_MAX_WAIT The value that indicates an indefinite wait.
String OTHER_CONTENT_KEY_LAYOUTS The name of the other content key that refers to the JUIL JS Layouts.
String PARAM_NAME_EXEC_FLAGS The name of the task parameter that identifies the Execution Flags to set.
String PARAM_NAME_MAX_WAIT The name of the task parameter that identifies the maximum wait for getting results (in ms).
String PARAM_NAME_MESSAGE_ID The name of the task parameter that identifies the message ID
String PARAM_NAME_OBJECT_ID The name of the task parameter that identifies the object ID
String PARAM_NAME_POLLING_FREQ The name of the task parameter that identifies the polling frequency (in ms)
String PARAM_NAME_RESULT_FLAGS The name of the task parameter that identifies the Result Flags to set.
String PARAM_NAME_SESSION_ID The name of the task parameter that identifies the IServer session ID.
String PARAM_NAME_SESSION_STATE The name of the task parameter that identifies the IServer session state.
String PARAM_NAME_STATE_ID The name of the task parameter that identifies the State ID.
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.
Fields
protected boolean compressOutput
protected TaskParameterMetadata execFlagsParam The task parameter for execution flags.
protected WebPrivilegesExpression mPrivileges We store here the task privileges.
protected TaskParameterMetadata maxWaitParam The task parameter for maximum wait.
protected TaskMetadataImpl metadata The metadata associated with this task (and its parameters).
protected TaskParameterMetadata msgIDParam The task parameter for message ID.
protected TaskParameterMetadata objectIDParam The task parameter for object ID.
protected TaskParameterMetadata pollingFreqParam The task parameter for polling frequency.
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.
Public Constructors
AbstractBaseTask(String desc)
Creates a new AbstractBaseTask object.
Public Methods
void destroy()
Destroys the Task.
boolean getCompressOutput()
String getID()
Returns the identifier of this Task.
TaskMetadata getMetadata()
Returns information about this Task.
WebPrivilegesExpression getPrivileges()
Returns a task privileges
void init(ContainerServices containerSvcs)
Initializes the Task with the specified ContainerServices 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 the processRequest(TaskRequestContext, MarkupOutput) version.
void setCompressOutput(boolean newValue)
void setID(String id)
Sets the identifier for this Task.
void setPrivileges(WebPrivilegesExpression value)
Sets the task privileges.
Protected Methods
void addExecFlagsParam(boolean required, String defValue)
Adds a execution flags parameter to this task's definition.
void addJuilLayouts(TaskOutput taskOutput)
Adds any referenced Juil layouts to the task payload.
void addMaxWaitParam(boolean required, int maxWait)
Adds a maximum wait parameter to this task's definition.
void addMaxWaitParam(boolean required)
Adds a maximum wait parameter to this task's definition with a default value specified by sys default preference PREFERENCE_DEFAULT_MAX_WAIT_IN_TASK.
void addMessageIDParam(boolean required, String defValue)
Adds a message ID parameter to this task's definition.
void addObjectIDParam(boolean required, String defValue)
Adds an object ID parameter to this task's definition.
void addParameterMetadata(TaskParameterMetadataImpl paramMetadataImpl)
This method is deprecated. Use addParameterMetadata(String, String, boolean, Object) instead.
TaskParameterMetadata addParameterMetadata(String name, String desc, boolean required, Object defValue, String type, String validator)
Adds the metadata for a parameter.
TaskParameterMetadata addParameterMetadata(String name, String desc, boolean required, Object defValue)
Adds the metadata for a parameter.
void addPollingFrequencyParam(boolean required, int pollingFreq)
Adds a polling frequency parameter to this task's definition.
void addPollingFrequencyParam(boolean required)
Adds a polling frequency parameter to this task's definition with a default value specified by DEFAULT_POLLING_FREQ.
void addResultFlagsParam(boolean required, String defValue)
Adds a results flags parameter to this task's definition.
void addSessionIDParam(boolean required, String defValue)
Adds a session ID parameter to this task's definition.
void addSessionStateParam(boolean required, String defValue)
Adds a session state parameter to this task's definition.
void addStateIDParam(boolean required, String defValue)
Adds a state ID parameter to this task's definition.
void checkForRequiredParameters(RequestKeys requestKeys)
Checks whether all required parameters are present or not.
String getSysDefaultPreferenceValue(String name)
Returns the value of a sys default preference
PostedFile retrieveUploadedFile(TaskRequestContext context, String fileFieldName)
void setDescription(String desc)
Sets the description for this task.
void setMetadata(TaskMetadataImpl metadata)
This method is deprecated. It is prefered to use addParameterMetadata(String, String, boolean, Object).
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.microstrategy.web.tasks.Task

Constants

protected static final int DEFAULT_MAX_WAIT

The default value to use for max wait (in ms)

Constant Value: 10000 (0x00002710)

protected static final int DEFAULT_POLLING_FREQ

The default value to use for polling frequency (in ms).

Constant Value: 50 (0x00000032)

protected static final int INDEFINITE_MAX_WAIT

The value that indicates an indefinite wait.

Constant Value: -1 (0xffffffff)

public static final String OTHER_CONTENT_KEY_LAYOUTS

The name of the other content key that refers to the JUIL JS Layouts.

Constant Value: "layouts"

protected static final String PARAM_NAME_EXEC_FLAGS

The name of the task parameter that identifies the Execution Flags to set.

Constant Value: "execFlags"

protected static final String PARAM_NAME_MAX_WAIT

The name of the task parameter that identifies the maximum wait for getting results (in ms).

Constant Value: "maxWait"

protected static final String PARAM_NAME_MESSAGE_ID

The name of the task parameter that identifies the message ID

Constant Value: "msgID"

protected static final String PARAM_NAME_OBJECT_ID

The name of the task parameter that identifies the object ID

Constant Value: "objectID"

protected static final String PARAM_NAME_POLLING_FREQ

The name of the task parameter that identifies the polling frequency (in ms)

Constant Value: "pollingFrequency"

protected static final String PARAM_NAME_RESULT_FLAGS

The name of the task parameter that identifies the Result Flags to set.

Constant Value: "resultFlags"

public static final String PARAM_NAME_SESSION_ID

The name of the task parameter that identifies the IServer session ID.

Constant Value: "sessionID"

public static final String PARAM_NAME_SESSION_STATE

The name of the task parameter that identifies the IServer session state.

Constant Value: "sessionState"

protected static final String PARAM_NAME_STATE_ID

The name of the task parameter that identifies the State ID.

Constant Value: "stateID"

protected static final 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.

Constant Value: "defaultMaxWaitInTask"

Fields

protected boolean compressOutput

protected TaskParameterMetadata execFlagsParam

The task parameter for execution flags.

protected WebPrivilegesExpression mPrivileges

We store here the task privileges. They will be verified when the task obtains a session

protected TaskParameterMetadata maxWaitParam

The task parameter for maximum wait.

protected TaskMetadataImpl metadata

The metadata associated with this task (and its parameters).

protected TaskParameterMetadata msgIDParam

The task parameter for message ID.

protected TaskParameterMetadata objectIDParam

The task parameter for object ID.

protected TaskParameterMetadata pollingFreqParam

The task parameter for polling frequency.

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.

Public Constructors

public AbstractBaseTask (String desc)

Creates a new AbstractBaseTask object.

Parameters
desc The (textual) description of this task.

Public Methods

public void destroy ()

Destroys the Task. This enables the Task to release any persistent data structures.

public boolean getCompressOutput ()

public String getID ()

Returns the identifier of this Task.

Returns
  • The identifier of this Task.

public TaskMetadata getMetadata ()

Returns information about this Task. It includes the description of the Task and any parameters which it supports.

Returns

public WebPrivilegesExpression getPrivileges ()

Returns a task privileges

Returns
  • a task privileges

public void init (ContainerServices containerSvcs)

Initializes the Task with the specified ContainerServices object.

Parameters
containerSvcs The ContainerServices object.

public TaskRequestContext newRequestContext ()

Returns a new object to hold per-request data for this Task.

Returns

public void processRequest (TaskRequestContext context, MarkupOutput markupOutput)

The default implementation of this version of processRequest is empty. Task implementators may override either version of processRequest.

Parameters
context The TaskRequestContext object that maintains the state of the request.
markupOutput The MarkupOutput that records the contents of the Task response.
Throws
TaskException

public void processRequest (TaskRequestContext context, TaskOutput taskOutput)

The default implementation of this method of processRequest gets the Primary Content from the TaskOutput and invokes the processRequest(TaskRequestContext, MarkupOutput) version.

Parameters
context The TaskRequestContext object that maintains the state of the request.
taskOutput The TaskOutput that contains the output generated by the Task.
Throws
TaskException

public void setCompressOutput (boolean newValue)

public void setID (String id)

Sets the identifier for this Task.

Parameters
id The ID to use for this Task.

public void setPrivileges (WebPrivilegesExpression value)

Sets the task privileges. The privileges will be verified when the task obtains a session

Parameters
value The privilege expression

Protected Methods

protected void addExecFlagsParam (boolean required, 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.

protected void addJuilLayouts (TaskOutput taskOutput)

Adds any referenced Juil layouts to the task payload.

Parameters
taskOutput The TaskOutput to add the Juil layouts to.

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.

protected void addMaxWaitParam (boolean required)

Adds a maximum wait parameter to this task's definition with a default value specified by sys default preference PREFERENCE_DEFAULT_MAX_WAIT_IN_TASK.

Parameters
required Indicates whether this parameter is required or not.

protected void addMessageIDParam (boolean required, 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.

protected void addObjectIDParam (boolean required, 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.

protected void addParameterMetadata (TaskParameterMetadataImpl paramMetadataImpl)

This method is deprecated.
Use addParameterMetadata(String, String, boolean, Object) instead.

Adds a task parameter metadata object (to fully describe the parameter).

Parameters
paramMetadataImpl The TaskParameterMetadataImpl object.

protected TaskParameterMetadata addParameterMetadata (String name, String desc, boolean required, Object defValue, String type, 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.

protected TaskParameterMetadata addParameterMetadata (String name, String desc, boolean required, 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.

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.

protected void addPollingFrequencyParam (boolean required)

Adds a polling frequency parameter to this task's definition with a default value specified by DEFAULT_POLLING_FREQ.

Parameters
required Indicates whether this parameter is required or not.

protected void addResultFlagsParam (boolean required, 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.

protected void addSessionIDParam (boolean required, 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.

protected void addSessionStateParam (boolean required, 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.

protected void addStateIDParam (boolean required, 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.

protected void checkForRequiredParameters (RequestKeys requestKeys)

Checks whether all required parameters are present or not.

Parameters
requestKeys The RequestKeys object that contains all parameters.
Throws
TaskRequestMalformedException If some required parameters are missing.

protected String getSysDefaultPreferenceValue (String name)

Returns the value of a sys default preference

Parameters
name the preference's name
Returns
  • the value of a sys default preference

protected PostedFile retrieveUploadedFile (TaskRequestContext context, String fileFieldName)

protected void setDescription (String desc)

Sets the description for this task.

Parameters
desc The description of the task.

protected void setMetadata (TaskMetadataImpl metadata)

This method is deprecated.
It is prefered to use addParameterMetadata(String, String, boolean, Object).

Sets the metadata for this task.

Parameters
metadata The TaskMetadataImpl object for this task.