java.lang.Object | ||
↳ | com.microstrategy.web.beans.GenericWebEvent | |
↳ | com.microstrategy.web.beans.GenericMultipleEvents |
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();
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
GenericMultipleEvents() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
addEvent(WebEvent event)
Adds an event to the event collection of this object.
| ||||||||||
void |
clear()
Clears the event collection held by this object.
| ||||||||||
Object |
clone()
Returns a copy of this object.
| ||||||||||
WebEvent |
get(int index)
Returns a
WebEvent object at the specified index. | ||||||||||
String |
getArgumentValue(int argumentID, int index)
Returns the current value of the argument.
| ||||||||||
Enumeration |
getArguments()
Returns an Enumeration over all the
WebEvent.Argument
in this GenericMultipleEvents . | ||||||||||
List |
getEvents()
Returns a list of
WebEvent objects encompassed in this object. | ||||||||||
WebEvent |
remove(int index)
Removes a
WebEvent object at the specified index. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Adds an event to the event collection of this object.
event | an event to add. |
---|
Clears the event collection held by this object.
Returns a copy of this object. The event collection in the cloned object is empty.
GenericMultipleEvents
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
argumentID | ID of the argument |
---|---|
index | the index into the set of argument values |
Returns an Enumeration over all the WebEvent.Argument
in this GenericMultipleEvents
. The enumeration is backed up this event.
WebEvent.Argument.