Interface WebPrompts


  • public interface WebPrompts
    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 encode) method provide the persistence, while loading functionality is porovide by the WebResultSetInstance.getPrompts(String xml) 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.

    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void answerFromLink​(java.lang.String linkXml)  
      void answerFromLink​(java.lang.String linkXml, java.lang.String srcAnswers)  
      void answerPrompts()
      Submits prompt answers to the I-Server.
      void answerPrompts​(int execFlags)  
      java.util.Enumeration elements()
      Returns an Enumeration of prompts in the collection.
      WebPrompt findPromptByPIN​(int pin)
      Finds a prompt by its PIN.
      WebPrompt get​(int index)
      Returns a prompt by its index in the collection.
      WebPrompt get​(java.lang.String key)
      Returns the WebPrompt mapped by the key in the current collection.
      java.lang.String getAnswerXML()
      Returns the XML string representing answers of all prompts in the collection that have an answer.
      java.lang.String getAnswerXML​(boolean encode)
      Returns the XML string representing answers of all prompts in the collection that have an answer.
      java.lang.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.
      WebPrompt getById​(java.lang.String id)
      Finds prompt based on its DSS ID
      java.lang.String getShortAnswerXML()
      Returns the XML string representing answers of all prompts in the collection that have an answer.
      java.lang.String getShortAnswerXML​(boolean encode)
      Returns the XML string representing answers of all prompts in the collection that have an answer.
      java.lang.String getShortXML()  
      java.lang.String getXML()
      Returns the XML string representing this prompt collection.
      java.lang.String getXML​(boolean encode)
      Returns the XML string representing this prompt collection.
      boolean isEmpty()
      Returns true if there is no prompts in the collection, false otherwise.
      void loadAnswers​(java.lang.String messageID)  
      void populate​(java.lang.String xml)  
      void populateAnswers​(java.lang.String answerXML)
      Populate prompt answers from the XML.
      void populateFromReport​(java.lang.String xml)  
      void setCanceled()
      Sets the Canceled attribute for all prompts in the collection.
      void setClosed​(boolean closed)
      Sets closed flag for all prompts in the collection.
      int size()
      Returns the number of prompts in the collection
      void validate()
      Validates each prompt in this prompt collection.
    • Method Detail

      • get

        WebPrompt get​(int index)
               throws java.lang.IndexOutOfBoundsException
        Returns a prompt by its index in the collection.
        Parameters:
        index - - the prompt index in the collection
        Returns:
        the prompt object
        Throws:
        java.lang.IndexOutOfBoundsException - it the index is < 0 or >=size().
      • size

        int size()
        Returns the number of prompts in the collection
        Returns:
        the number of prompts in the collection
      • isEmpty

        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.
      • elements

        java.util.Enumeration elements()
        Returns an Enumeration of prompts in the collection.
        Returns:
        an Enumeration of prompts in the collection.
      • findPromptByPIN

        WebPrompt findPromptByPIN​(int pin)
        Finds a prompt by its PIN.
        Returns:
        a Prompt object or null if the Prompt with specified PIN not found.
      • validate

        void validate()
               throws WebObjectsException
        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:
        WebAPIHelperException - Thrown if an error occurs in the validation process.
        WebObjectsException
      • getAnswerXML

        java.lang.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
      • getAnswerXML

        java.lang.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
      • getShortAnswerXML

        java.lang.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
      • getShortAnswerXML

        java.lang.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
      • populateAnswers

        void populateAnswers​(java.lang.String answerXML)
                      throws WebObjectsException
        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
      • getXML

        java.lang.String getXML()
        Returns the XML string representing this prompt collection. This string can be persisted and used later to rebuild answer object (WebResultSetInstance.getPrompts(String)).
        Returns:
        the prompts XML string
      • getXML

        java.lang.String getXML​(boolean encode)
        Returns the XML string representing this prompt collection. This string can be persisted and used later to rebuild answer object (WebResultSetInstance.getPrompts(String)).
        Parameters:
        encode - if true, then the returned string will have all special characters HTML-encoded.
        Returns:
        the prompts XML string
      • setCanceled

        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.
      • setClosed

        void setClosed​(boolean closed)
        Sets closed flag for all prompts in the collection.
        Parameters:
        closed - value to set.
      • answerPrompts

        void answerPrompts()
                    throws WebObjectsException
        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.
      • get

        WebPrompt get​(java.lang.String key)
               throws java.lang.IllegalArgumentException
        Returns the WebPrompt mapped by the key in the current collection.
        Parameters:
        key - the key uniquely identifying a WebPrompt
        Returns:
        the WebPrompt object.
        Throws:
        java.lang.IllegalArgumentException - thrown if there is no such a WebPrompt mapped by the key.
        Since:
        MicroStrategy Web 8.0.1
      • getAnswerXML

        java.lang.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.
        Since:
        MicroStrategy Web 8.0.2
      • getById

        WebPrompt getById​(java.lang.String id)
        Finds prompt based on its DSS ID
        Parameters:
        id - prompt DSS ID
        Returns:
        prompt object
        Since:
        MicroStrategy Web 8.1.2
      • getShortXML

        java.lang.String getShortXML()