public class

UploadVisualizationZipTask

extends AbstractAppTask
java.lang.Object
   ↳ com.microstrategy.web.tasks.AbstractBaseTask
     ↳ com.microstrategy.web.app.tasks.AbstractAppTask
       ↳ com.microstrategy.web.app.tasks.UploadVisualizationZipTask

Class Overview

This Task processes the file uploaded from an HTML form and write into Plugins folder

Summary

[Expand]
Inherited Constants
From class com.microstrategy.web.tasks.AbstractBaseTask
[Expand]
Inherited Fields
From class com.microstrategy.web.tasks.AbstractBaseTask
Public Constructors
UploadVisualizationZipTask()
Creates a new UploadFileTask object.
Public Methods
void processRequest(TaskRequestContext context, TaskOutput taskOutput)
This method uploads the contents of a file and processes it for use in the MicroStrategy Prompts page.
Protected Methods
void renderErrorMessages(MarkupOutput mo, String message)
void renderSuccessfulMessage(MarkupOutput mo, String visName)
void renderTitle(MarkupOutput mo)
Render the response result page
PostedFile retrieveUploadedFile(TaskRequestContext context, RequestKeys requestKeys)
Retrieves the uploaded file as an instance of a PostedFile.
void validateExtension(RequestKeys requestKeys, PostedFile file)
Validates whether the extension of the file is acceptable or not.
void validateMaxSize(RequestKeys requestKeys, PostedFile file)
Validate that the maximum size of the uploaded file does not exceed the maximum specified.
void validateUploadedFile(RequestKeys requestKeys, PostedFile file)
Performs a validation of the uploaded file.
[Expand]
Inherited Methods
From class com.microstrategy.web.app.tasks.AbstractAppTask
From class com.microstrategy.web.tasks.AbstractBaseTask
From class java.lang.Object
From interface com.microstrategy.web.tasks.Task

Public Constructors

public UploadVisualizationZipTask ()

Creates a new UploadFileTask object.

Public Methods

public void processRequest (TaskRequestContext context, TaskOutput taskOutput)

This method uploads the contents of a file and processes it for use in the MicroStrategy Prompts page. It follows through these steps:

  1. Check for required parameters.
  2. Try to retrieve the uploaded file. See retrieveUploadedFile(TaskRequestContext, RequestKeys).
  3. Validate the basic characteristics of the file: max size, extension. See validateUploadedFile(RequestKeys, PostedFile).
  4. Generate a set of options that control the parsing of the uploaded file. See #generateParseOptions(RequestKeys).
  5. Parse the text of the uploaded file contents. See #parseUploadedFile(com.microstrategy.web.tasks.UploadFileTask.UploadFileParseOptions, PostedFile, StringBuffer).
  6. Generate the full Task response using the parsed uploaded file text. See #constructTaskOutput(TaskOutput, String, boolean, TaskRequestContext, com.microstrategy.web.tasks.UploadFileTask.UploadFileParseOptions).

Parameters
context The TaskRequestContext that contains all information about this Task invocation.
taskOutput The TaskOutput that contains our response.
Throws
TaskException If anything fails along the way. See the individual methods invoked by this method.

Protected Methods

protected void renderErrorMessages (MarkupOutput mo, String message)

protected void renderSuccessfulMessage (MarkupOutput mo, String visName)

protected void renderTitle (MarkupOutput mo)

Render the response result page

protected PostedFile retrieveUploadedFile (TaskRequestContext context, RequestKeys requestKeys)

Retrieves the uploaded file as an instance of a PostedFile.

Parameters
context The TaskRequestContext that contains all information about the incoming Task request.
requestKeys The RequestKeys 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.

protected void validateExtension (RequestKeys requestKeys, PostedFile file)

Validates whether the extension of the file is acceptable or not.

Parameters
requestKeys The RequestKeys instance that contains all values of Task parameters.
file The PostedFile that represents our uploaded file.
Throws
TaskException If validation fails.

protected void validateMaxSize (RequestKeys requestKeys, PostedFile file)

Validate that the maximum size of the uploaded file does not exceed the maximum specified.

Parameters
requestKeys The RequestKeys instance that contains all values of Task parameters.
file The PostedFile that represents our uploaded file.
Throws
TaskException If validation fails.

protected void validateUploadedFile (RequestKeys requestKeys, PostedFile file)

Performs a validation of the uploaded file. In this particular instance, it performs two checks:

  1. Checks the size of the uploaded file. See validateMaxSize(RequestKeys, PostedFile).
  2. Checks the extension of the uploaded file. See validateExtension(RequestKeys, PostedFile).

Parameters
requestKeys The RequestKeys instance that contains all values of Task parameters.
file The PostedFile that represents our uploaded file.
Throws
TaskException If any validation fails.