Class GenericMultipleEvents

  • All Implemented Interfaces:
    WebEvent, WebEvents, WebEventTags, java.lang.Cloneable

    public class GenericMultipleEvents
    extends GenericWebEvent
    implements WebEvents
    The GenericMultipleEvents class represents an event that encompasses multiple events. You can add and manage various events throught this helper class.

    Here is an example of using this GenericMultipleEvents class to create a HTML URL link to execute a report and answer its prompts with their default prompt answers in one shot.

    
                            // Suppose you have created an Intelligence Server session
                            WebIServerSession wiss = null;
    
                            // Create a report bean with the default report event handler
                            ReportBean rb = WebBeanFactory.getInstance().newReportBean();
                            rb.setSessionInfo(wiss);
    
                            // Create a multiple-events event helper and set an event source on it
                            GenericMultipleEvents gme = WebEventHandlerFactory.getInstance().newMultipleEventHelper();
                            gme.setSource(rb);
    
                            // Create an execute-report event and add it to the multiple events
                            WebEvent execReportEvent = rb.getWebEventHandler().getWebEvent(EnumReportBeanEvents.REPORT_EVENT_EXECUTE);
                            execReportEvent.setArgumentValue(EnumReportBeanEvents.REPORT_EVENT_ARGUMENT_REPORT_ID, REPORT_ID);
                            gme.addEvent(execReportEvent); // add the execute report event
    
                            // Create an answer-all-prompts event, use the default answers for all prompts
                            WebEvent answerPromptEvent = rb.getPromptsBean().getWebEvent(EnumPromptsBeanEvents.PROMPTS_EVENT_ANSWER_ALL_PROMPTS);
                            gme.addEvent(answerPromptEvent);        // add the answer prompt event
    
                            // Build an HTML URL link using the ParameterBuilder
                            ParameterBuilder builder = new DefaultURIBuilderImpl();
                            builder.addEventInfo(gme, EnumEventElement.EventElementTypicalURLLink, EnumWebPersistableState.MINIMAL_STATE_INFO);
                            System.out.println(builder.toString());  // This the URL link for the multiple-events event
     
    Since we do not have a Web application to test the above HTML URL link, let's try to mimic a Web application by creating a RequestKeys object.
    
                            // Create a RequestKeys object
                            RequestKeys keys = new GenericRequestKeys() {
                                    protected void initializeRequestKeys() {
                                    };
                            };
    
                            // Mimic the URL link to add the event information into the RequestKeys object
                            keys.add(GenericWebEvent.URL_EVENT_NAME, String.valueOf(EnumGenericEvents.GENERIC_EVENT_PROCESS_MULTIPLE_EVENTS));
                            keys.add("events", gme.getArgumentValue(EnumGenericEvents.GENERIC_EVENT_ARGUMENT_MULTIPLE_EVENTS));
    
                            // Handle the event and then collect data on the report bean
                            rb.handleRequest(keys);
                            rb.collectData();
     
    Since:
    MicroStrategy Web 8.0.0
    • Constructor Detail

      • GenericMultipleEvents

        public GenericMultipleEvents()
    • Method Detail

      • addEvent

        public void addEvent​(WebEvent event)
        Adds an event to the event collection of this object.
        Specified by:
        addEvent in interface WebEvents
        Parameters:
        event - an event to add.
      • getEvents

        public java.util.List getEvents()
        Returns a list of WebEvent objects encompassed in this object.
        Specified by:
        getEvents in interface WebEvents
        Returns:
        a list of WebEvent objects.
      • get

        public WebEvent get​(int index)
        Returns a WebEvent object at the specified index.
        Specified by:
        get in interface WebEvents
        Parameters:
        index - the position of the event to retrieve.
        Returns:
        a WebEvent object at the specified index.
      • remove

        public WebEvent remove​(int index)
        Removes a WebEvent object at the specified index.
        Specified by:
        remove in interface WebEvents
        Parameters:
        index - the position of the event to be removed.
        Returns:
        the WebEvent object to be removed.
      • clear

        public void clear()
        Clears the event collection held by this object.
        Specified by:
        clear in interface WebEvents
      • clone

        public java.lang.Object clone()
        Returns a copy of this object. The event collection in the cloned object is empty.
        Overrides:
        clone in class GenericWebEvent
        Returns:
        a cloned GenericMultipleEvents
      • getArguments

        public java.util.Enumeration getArguments()
        Returns an Enumeration over all the WebEvent.Argument in this GenericMultipleEvents. The enumeration is backed up this event.
        Specified by:
        getArguments in interface WebEvent
        Overrides:
        getArguments in class GenericWebEvent
        Returns:
        an Enumeration over all the WebEvent.Argument.
      • getArgumentValue

        public java.lang.String getArgumentValue​(int argumentID,
                                                 int index)
        Returns the current value of the argument. The default value is returned if one is specified in the definition of this event.

        If not, the value set explicitly is returned.

        If the argument is not found or no value is set, null is returned

        Specified by:
        getArgumentValue in interface WebEvent
        Overrides:
        getArgumentValue in class GenericWebEvent
        Parameters:
        argumentID - ID of the argument
        index - the index into the set of argument values
        Returns:
        the value of the argument