Portlet Factory, Version 6.1.2


 

Cooperative Portlet Source builder

With the Cooperative Portlet Source and the Cooperative Portlet Target builders, you create portlets that can interact with each other to share information. One or more target portlets on a portal page can automatically react to changes from a source portlet when the source portlet triggers an event. The following are the high-level steps required to implement these types of Portlets:

  1. Create a target model using the Cooperative Portlet Target builder, which will receive the event from the source. Add an Event Handler builder to this model to process the event.

  2. Create a source model using the Cooperative Portlet Source builder, which will trigger an event that is to be received by the target portlet.

  3. Deploy or redeploy the project and add the source and target portlet to a portal.

  4. Place the portlets on a portal page, and use the Portlet Wiring tool to connect the source portlet to the target.

 

Key inputs

In most common applications of this builder use these inputs to create portlets that can communicate with one another: See the builder input help for a complete description.

  • Name - Enter a name for this builder call.

  • Type - Select the Cooperative Portlet type. Typically Property Broker Link or Property Broker Action.

  • Output Definitions

    • Name - Enter the name of the output that will be passed to the target. For example, OrderID. This input is required. For JSR-286 portlets this must match the Input Name specified in the target builder.

    • Output Type Name - Enter the XML Schema Datatype name for the output. This must match the Input Type Name specified in the target builder. This is not used for JSR-286 portlets. Example: OrderIDType

    • Value - Enter the value to be passed as an input to the target event.

 

Key objects this builder creates

When used to create portlets that can communicate with one another, the key objects this builder creates are:

  • This builder creates a method named pbAction_<builder name> that is used to initiate the event. A Property Broker Link type will automatically call this, but manually invoke this if you are creating you own UI using the Property Broker Action type

 

Samples

A complete sample shows you how to use IBM® WebSphere Portlet Factory to implement inter-portlet communication including Property Broker, Click-to-Action, Portlet Factory events, and shared variables.

http://www.lotus.com/ldd/pfwiki.nsf/dx/ibm-using-inter-portlet-communication

 

More about this builder

When portlets communicate with each other, an action or event that occurs in a source portlet can result in messages being sent to other portlets. These messages might update data or cause other display changes.

One or more cooperative portlets on a portal page can automatically react to changes from a source portlet triggered by an action or event in the source portlet. Portlets that are targets of the event can react so that users are not required to make repetitive changes or actions in other portlets on the page.

Cooperation between source and target portlets is facilitated by a IBM WebSphere Portal runtime entity called the Property Broker. Portlets on a page can cooperate in this way even if they were developed without the expectation of cooperation.

This Builder supports three kinds of inter-portlet communication formats:

JSR-286 Events

The Cooperative Portlet Source and Cooperative Portlet Target builders support the event functionality which is part of the JSR 286 standard. Event declarations are added to the JSR 286 deployment descriptor (portlet.xml), as opposed to the WSDL files used by the JSR-168 Property Broker events. The event declarations are added automatically through the use of the Cooperative Portlet Builders, and the Factory deployment war creation process. The Cooperative Portlet Source builder describes the events that the portlet publishes, and the Cooperative Portlet Target Builder describes the events that the portlet can process. Event names are made up of the output/input "Name" and "Namespac" which makes them uniquely identifiable. The "Name" and "Namespace" form the event'sQName. Events can pass a single object, which must have a valid JAXB binding, or be in the list of Java standard classes of the JAXB 2.0 specification. To send an event from a source portlet to the target the event QName and data type must match. The "Output Type Name" and "Input Type Name" builder inputs are not used for JSR-286 events and are ignored. Event declaration can optionally specify a list of Aliases to provide alternate QNames that are used when matching events against each other. This is useful when communicating between JSR 168 cooperative portlets and JSR 286 event portlets. See the JSR-286 specification for complete details on these events.

Standard (JSR 168) implementations

For use in portlets built in accordance with the JSR 168 Portlet API

Click-to-Acton (C2A) implementations

For use in legacy portlets built in accordance with the deprecated IBM portlet API

Note: Click-to-Action is a legacy WebSphere Portal feature that provides automatic frontend integration of portlets. Using C2A, users can transfer data from one portlet to another, and have the target portlet react to the data, thus causing information on the page to be refreshed. In the C2A mode, this builder places the <C2A:encodeProperty> or <C2A:encodeProperties> tag on a model page. These tags are used to build a menu that can fire a C2A event to a target portlet on the same page that matches the specified type.

Parent topic: Builder help


Library | Support |