Package com.microstrategy.web.tasks
Class ImportFileTask
- java.lang.Object
-
- com.microstrategy.web.tasks.AbstractBaseTask
-
- com.microstrategy.web.tasks.ImportFileTask
-
- All Implemented Interfaces:
Task
public class ImportFileTask extends AbstractBaseTask
This Task processes the file uploaded from an HTML form and returns the content of the file to client. Client side JavaScript can not read the contents of local files for security reasons.- Since:
- MicroStrategy Web 9.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected TaskParameterMetadata
behaviorFlagsParam
protected TaskParameterMetadata
chunkSizeParam
protected TaskParameterMetadata
dataParam
protected TaskParameterMetadata
didParam
protected TaskParameterMetadata
fileSizeParam
protected TaskParameterMetadata
indexParam
protected TaskParameterMetadata
numOfChunksParam
protected TaskParameterMetadata
tableIDParam
-
Fields inherited from class com.microstrategy.web.tasks.AbstractBaseTask
compressOutput, CONTENT_TYPE_BINARY, CONTENT_TYPE_HTML, CONTENT_TYPE_JSON, CONTENT_TYPE_JSON_ALL, CONTENT_TYPE_JSON_D, CONTENT_TYPE_JSON_P, CONTENT_TYPE_XML, CONTENT_TYPE_XML_ANF, DEFAULT_MAX_WAIT, DEFAULT_POLLING_FREQ, execFlagsParam, INDEFINITE_MAX_WAIT, maxWaitParam, metadata, mPrivileges, msgIDParam, objectIDParam, OTHER_CONTENT_KEY_LAYOUTS, PARAM_NAME_EXEC_FLAGS, PARAM_NAME_MAX_WAIT, PARAM_NAME_MESSAGE_ID, PARAM_NAME_OBJECT_ID, PARAM_NAME_POLLING_FREQ, PARAM_NAME_RESULT_FLAGS, PARAM_NAME_SESSION_ID, PARAM_NAME_SESSION_STATE, PARAM_NAME_STATE_ID, pollingFreqParam, PREFERENCE_DEFAULT_MAX_WAIT_IN_TASK, resultFlagsParam, sessionIDParam, sessionStateParam, stateIDParam
-
-
Constructor Summary
Constructors Constructor Description ImportFileTask()
Creates a new ImportFileTask object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkForRequiredParameters(RequestKeys requestKeys)
Checks whether all required parameters are present or not.protected void
constructTaskOutput(TaskRequestContext context, TaskOutput markupOutput)
Construct the Task output given the upload file text.void
processRequest(TaskRequestContext context, TaskOutput markupOutput)
This method uploads the contents of a file and submits it to IServer for cube creation.protected PostedFile
retrieveUploadedFile(TaskRequestContext context, RequestKeys requestKeys)
Retrieves the uploaded file as an instance of a PostedFile.-
Methods inherited from class com.microstrategy.web.tasks.AbstractBaseTask
addExecFlagsParam, addJuilLayouts, addMaxWaitParam, addMaxWaitParam, addMessageIDParam, addObjectIDParam, addParameterMetadata, addParameterMetadata, addParameterMetadata, addPollingFrequencyParam, addPollingFrequencyParam, addResultFlagsParam, addSessionIDParam, addSessionStateParam, addStateIDParam, destroy, getCompressOutput, getID, getMetadata, getPrivileges, getSysDefaultPreferenceValue, init, newRequestContext, processRequest, retrieveUploadedFile, setCompressOutput, setDescription, setID, setMetadata, setPrivileges, validateContentType
-
-
-
-
Field Detail
-
behaviorFlagsParam
protected TaskParameterMetadata behaviorFlagsParam
-
tableIDParam
protected TaskParameterMetadata tableIDParam
-
dataParam
protected TaskParameterMetadata dataParam
-
numOfChunksParam
protected TaskParameterMetadata numOfChunksParam
-
chunkSizeParam
protected TaskParameterMetadata chunkSizeParam
-
indexParam
protected TaskParameterMetadata indexParam
-
fileSizeParam
protected TaskParameterMetadata fileSizeParam
-
didParam
protected TaskParameterMetadata didParam
-
-
Method Detail
-
processRequest
public void processRequest(TaskRequestContext context, TaskOutput markupOutput) throws TaskException
This method uploads the contents of a file and submits it to IServer for cube creation.- Check for required parameters.
- Try to retrieve the uploaded file. See
retrieveUploadedFile(TaskRequestContext, RequestKeys)
. - Generate and submit XML command
- Validate result
- Specified by:
processRequest
in interfaceTask
- Overrides:
processRequest
in classAbstractBaseTask
- Parameters:
context
- TheTaskRequestContext
that contains all information about this Task invocation.taskOutput
- TheTaskOutput
that contains our response.- Throws:
TaskException
- If anything fails along the way. See the individual methods invoked by this method.- See Also:
Task.processRequest(TaskRequestContext, TaskOutput)
-
retrieveUploadedFile
protected PostedFile retrieveUploadedFile(TaskRequestContext context, RequestKeys requestKeys) throws TaskException
Retrieves the uploaded file as an instance of a PostedFile.- Parameters:
context
- TheTaskRequestContext
that contains all information about the incoming Task request.requestKeys
- TheRequestKeys
that contains all Task parameter values.- Returns:
- A
PostedFile
that contains the contents of the uploaded file. - Throws:
TaskException
- If there is no file uploaded.
-
constructTaskOutput
protected void constructTaskOutput(TaskRequestContext context, TaskOutput markupOutput) throws TaskException
Construct the Task output given the upload file text.- Parameters:
markupOutput
- TheTaskOutput
instance to populate into.- Throws:
TaskException
- If there was any problem serializing the results to the TaskOutput.
-
checkForRequiredParameters
protected void checkForRequiredParameters(RequestKeys requestKeys) throws TaskRequestMalformedException
Description copied from class:AbstractBaseTask
Checks whether all required parameters are present or not.- Overrides:
checkForRequiredParameters
in classAbstractBaseTask
- Parameters:
requestKeys
- TheRequestKeys
object that contains all parameters.- Throws:
TaskRequestMalformedException
- If some required parameters are missing.
-
-