public interface

WebPrompts

com.microstrategy.web.objects.WebPrompts

Class Overview

This interface represents a read-only collection of WebPrompt objects associated with a report. Other than providing access to individual prompt objects, this interface is mainly used when you want to operate on the collection instead of individual prompt objects.

The WebPrompts interface exposes methods to persist the prompt objects via XML definitions. The getXML() and getXML(boolean) method provide the persistence, while loading functionality is porovide by the getPrompts(String) method of the WebReportInstance interface.

The WebPrompts interface also introduces the notion of the Answer XML. The Answer XML is that component of the prompt definition that represents the current answer as specified by the user. By providing a persistence mechanism for the answer component it allows the user to minimize the amount of data they need to persist the prompt objects. The WebPrompts interface also introduces methods to support a special answer format used in the Aurora/Hydra.

The DisplayXML property aggregates the Display XML for all prompts in the collection.

Summary

Public Methods
abstract void answerFromLink(String linkXml, String srcAnswers)
abstract void answerFromLink(String linkXml)
abstract void answerPrompts(int execFlags)
abstract void answerPrompts()
Submits prompt answers to the I-Server.
abstract Enumeration elements()
Returns an Enumeration of prompts in the collection.
abstract WebPrompt findPromptByPIN(int pin)
Finds a prompt by its PIN.
abstract WebPrompt get(int index)
Returns a prompt by its index in the collection.
abstract WebPrompt get(String key)
Returns the WebPrompt mapped by the key in the current collection.
abstract String getAnswerXML(boolean encode)
Returns the XML string representing answers of all prompts in the collection that have an answer.
abstract String getAnswerXML()
Returns the XML string representing answers of all prompts in the collection that have an answer.
abstract String getAnswerXML(boolean shortFormat, boolean encode, boolean includeClosed)
Returns an XML string representing the answers of all prompts in the collection that have an answer.
abstract WebPrompt getById(String id)
Finds prompt based on its DSS ID
abstract String getShortAnswerXML()
Returns the XML string representing answers of all prompts in the collection that have an answer.
abstract String getShortAnswerXML(boolean encode)
Returns the XML string representing answers of all prompts in the collection that have an answer.
abstract String getShortXML()
abstract String getXML(boolean encode)
Returns the XML string representing this prompt collection.
abstract String getXML()
Returns the XML string representing this prompt collection.
abstract boolean isEmpty()
Returns true if there is no prompts in the collection, false otherwise.
abstract void loadAnswers(String messageID)
abstract void populate(String xml)
abstract void populateAnswers(String answerXML)
Populate prompt answers from the XML.
abstract void populateFromReport(String xml)
abstract void setCanceled()
Sets the Canceled attribute for all prompts in the collection.
abstract void setClosed(boolean closed)
Sets closed flag for all prompts in the collection.
abstract int size()
Returns the number of prompts in the collection
abstract void validate()
Validates each prompt in this prompt collection.

Public Methods

public abstract void answerFromLink (String linkXml, String srcAnswers)

public abstract void answerFromLink (String linkXml)

public abstract void answerPrompts (int execFlags)

public abstract void answerPrompts ()

Submits prompt answers to the I-Server. The method loops through all prompts in the collection, and submits answers for all prompts that have it.

Throws
WebObjectsException if there were some problems submitting answers to the I-Server.

public abstract Enumeration elements ()

Returns an Enumeration of prompts in the collection.

Returns
  • an Enumeration of prompts in the collection.

public abstract WebPrompt findPromptByPIN (int pin)

Finds a prompt by its PIN.

Returns
  • a Prompt object or null if the Prompt with specified PIN not found.

public abstract WebPrompt get (int index)

Returns a prompt by its index in the collection.

Parameters
index - the prompt index in the collection
Returns
  • the prompt object
Throws
IndexOutOfBoundsException it the index is < 0 or >=size().

public abstract WebPrompt get (String key)

Returns the WebPrompt mapped by the key in the current collection.

Parameters
key the key uniquely identifying a WebPrompt
Returns
  • the WebPrompt object.
Throws
IllegalArgumentException thrown if there is no such a WebPrompt mapped by the key.

public abstract String getAnswerXML (boolean encode)

Returns the XML string representing answers of all prompts in the collection that have an answer. This string can be persisted and used later to populate prompts returned by I-Server with current answers.

Parameters
encode if true, then the returned string will have all special characters HTML-encoded.
Returns
  • the answer XML string

public abstract String getAnswerXML ()

Returns the XML string representing answers of all prompts in the collection that have an answer. This string can be persisted and used later to populate prompts returned by I-Server with current answers.

Returns
  • the answer XML string

public abstract String getAnswerXML (boolean shortFormat, boolean encode, boolean includeClosed)

Returns an XML string representing the answers of all prompts in the collection that have an answer. This string can be persisted and used later to populate prompts returned by I-Server with current answers.

Parameters
shortFormat if true, the returned XML is formated for use by Narrowcast Server
encode if true, the returned XML will have all the special characters HTML-encoded.
includeClosed if true, thr returned XML also contains the answer XML for all the closed prompts.
Returns
  • an XML string representing the prompt answers.

public abstract WebPrompt getById (String id)

Finds prompt based on its DSS ID

Parameters
id prompt DSS ID
Returns
  • prompt object

public abstract String getShortAnswerXML ()

Returns the XML string representing answers of all prompts in the collection that have an answer. The XML is formatted for use in Nerrowcast server. This string can be persisted and used later to populate prompts returned by I-Server with current answers.

Returns
  • the answer XML string

public abstract String getShortAnswerXML (boolean encode)

Returns the XML string representing answers of all prompts in the collection that have an answer. The XNL is formatted for use in Nerrowcast server. This string can be persisted and used later to populate prompts returned by I-Server with current answers.

Parameters
encode if true, then the returned string will have all special characters HTML-encoded.
Returns
  • the answer XML string

public abstract String getShortXML ()

public abstract String getXML (boolean encode)

Returns the XML string representing this prompt collection. This string can be persisted and used later to rebuild answer object (getPrompts(String)).

Parameters
encode if true, then the returned string will have all special characters HTML-encoded.
Returns
  • the prompts XML string

public abstract String getXML ()

Returns the XML string representing this prompt collection. This string can be persisted and used later to rebuild answer object (getPrompts(String)).

Returns
  • the prompts XML string

public abstract boolean isEmpty ()

Returns true if there is no prompts in the collection, false otherwise.

Returns
  • true if there is no prompts in the collection, false otherwise.

public abstract void loadAnswers (String messageID)

public abstract void populate (String xml)

public abstract void populateAnswers (String answerXML)

Populate prompt answers from the XML. Usually the XML will be a string obtained from the previous call to the getAnswer method and persisted between web pages. It is also possible to build the answer XML independently.

Parameters
answerXML the string containing answer XML
Throws
WebObjectsException if errors are detected in XML format or data

public abstract void populateFromReport (String xml)

public abstract void setCanceled ()

Sets the Canceled attribute for all prompts in the collection. If it set to true then next call to answerPrompts() will result in canceling all prompts.

public abstract void setClosed (boolean closed)

Sets closed flag for all prompts in the collection.

Parameters
closed value to set.

public abstract int size ()

Returns the number of prompts in the collection

Returns
  • the number of prompts in the collection

public abstract void validate ()

Validates each prompt in this prompt collection. This method steps through each prompt and calls the WebPrompt.validate() method. This method validates that the answers are consistent with the restrictions which that prompt definition impose.

Throws
Thrown if an error occurs in the validation process.
WebObjectsException