Cooperative Portlet Target Builder

 

 

In this topic ...

How do I...

Specifying Inputs

Use a Resource Bundle for a Caption Name

Use the this builder to define a Property Broker or C2A (Click to Action) event. Use the Event handler builder call to associate an action with an event. You will use this builder in target models that you wish to receive properties from source models that were created using the cooperative portlet source builder.

To enable the use of the property broker events for standard portlets use the "Portlet Wiring Tool" to setup a property broker connection between a source and target portlet. This tool is located on the "Wires" tab when in the Edit Page layout. See your WebSphere Portal 5.1 or 6 documentation for more about using this tool.

This builder will automatically generate a resource property file and create a key and value using the text entered. The property file name will be created using the model name. When the file is written it will be placed in the project's WEB-INF\classes\nls directory. The resource file is generated by an Ant task in the build_deployment script.

For example if your model was named "test/orders_target.model" a file named:

WEB-INF\classes\nls\test\orders_target.properties" will be created.

 

How do I...

Implement inter-portlet communications

Enable Click-to-Action

 

Specifying Inputs

This builder takes the inputs described in the table below. For help on inputs common to many or all builders such as those in the Properties input group, see Using the Builder Call Editor.

Input Name Description
Event Name Enter a name for this builder call. The designer tool displays this name in the Builder Call List.
Input Definition
Input Name Enter the name of the input that will be passed to the Event Handler from the C2A source (e.g., "OrderID"). This input is required.
Input Type Select the XSD simple type of the value that is being passed into the target. For JSR-168 portlets we can also select the "xsd:anyType" when you are receiving complex data, such as an XML structure. However, the portlet cannot receive objects from other portlets that are in a different WAR if the object's class file is not shared; the class file must be in a shared location. The default value is xsd:string.

Note: - If an "xsd:anyType" is specified as the "Input Type" then the generated Event Declaration will contain a parameter of type "Object" to support this. When you create your Event Handler a value of type Object will be passed to it when the event is fired.

Input Type Name Enter the XML Schema Datatype name for the input (e.g., "OrderIDType"). If not specified, an Input Type Name will be created using the value from the Input Name value plus the string "Type" (e.g., "OrderID" + "Type"). The name creation is done on an Input Name change when the Input Type Name input is blank. This input is required.
Caption Enter the caption that will be used by the wiring tool to describe the name of the input parameter. Example: Order ID
Output Definition
Output Name This input supports chained data transfer to propagate data among portlets.

Enter the name of the output that will be returned from the Event Handler to a chained C2A target (e.g., "TrackingID"). This input is not required.

Output Type This input supports chained data transfer. Select the XSD simple type of the output value. For JSR-168 portlets we can also select the "xsd:anyType" when the output is complex data, such as an XML structure. The default value is xsd:string.

Note that - If an "xsd:anyType" is specified as the "Output Type" then your event handler method action can return a Java Object type, which will be passed to any chained events.

Output Type Name This input supports chained data transfer. Enter the XML Schema Datatype name for the output (e.g.,"TrackingIDType"). If not specified, an Output Type Name will be created using the value from the Output Name value plus the string "Type" (e.g., "TrackingID" + "Type"). The name creation is done on an Output Name change when the Output Type Name input is blank.
Caption Enter the caption that will be used by the wiring tool to describe the name of the output parameter. Example: Order ID
Namespace Enter the WSDL Namespace for the input/output types. This is used to group related types in a single domain. This input is required.
Caption This input is required. Enter the caption text for the C2A menu.

The input can be the actual text to be displayed or a key name in a resource bundle. The two types of input are distinguished by using periods as a separator in the text value of a resource key (e.g., "order.id.text") and a space separator for the actual text (e.g., "Order ID").

If you specify the actual text, this builder will automatically generate a resource key and value and place it in a resource property file. The property file name will be created from the model name and placed in the WEB-INF\classes\nls directory.

Note that if you are specifying your own resource key and using a resource bundle other than the C2A default (nls.c2a.properties), supply the name of the resource file in the Resource File input.

Description Optional. Use to add a "description" attribute to the "portlet:action" element in the generate WSDL document. This is a text description of the action for informational purposes.
Resource File Enter the name of the C2A resource file, including the package name but excluding the ".properties" extension (for example, quot;com.bowstreet.c2a.Resource" refers to the file com\Bowstreet\c2a\Resource.properties).

This value is required only if you are using resource bundles for your C2A text and you are not using the default file (nls/c2a.properties)

If you are specify a resource file, make sure that it is packaged during the deployment WAR creation, and that the file will end up on the classpath (relative to the WEB-INF\classes directory).

 

Propagating Data Among Portlets

The WebSphere Cooperative Portal architecture allows you to synchronize multiple portlet views in a single request-response cycle. We can do this by using the "Output" inputs. The technique involves sending data to one portlet and in turn causing that portlet to send data to another portlet which can, in turn send data to another portlet. Think of this concept as the chaining together of portlet events.

A typical example of the usefulness of this technique provide by IBM is as follows: Transferring the order ID to an Order Details portlet also triggers the transfer of the tracking ID for the order to a tracking details portlet, which in turn triggers the transfer of the customer name associated with the order to a customer details portlet. Thus a single event in the Order Details portlet can cause all three portlets to display information pertaining to the same order.

If you have existing Models that are using the C2A menu functionality, and you want to support "wiring" open the Cooperative Portlet Source Builder call in your model, and fill in the following new inputs: Output Name, Output Type, and Caption.

Before creating a cross-page wire, the target page must have receiving actions defined as global on its portlets. This is located in the "Portlet Wiring Tool" when you press the "Manage Actions" button.

If you have existing Models that are using the C2A functionality open the Model in the Designer and perform a regen, then save the Model. The reason for this is that the caption values are now stored as external models properties, which get written out by an Ant task when the WAR is rebuilt. In the past the caption property files were written out by the Builder.

 

Use a Resource Bundle for a Caption Name

By default, the portlet caption is the same as the Cooperative Potlet Target Builder call name. However, this builder can use a resource bundle to declare the caption for the C2A menu.

If the text specified in the Input Name is not a resource key (i.e. "Order ID"), this Builder will automatically generate a resource file for the caption text. For example if you enter a caption of "Customer ID" for a model named my_Customer, a resource file named my_customer.properties will be generated in the WEB-INF\nls directory. (The file name is generated using the model name.)

A key and value (customer.id.key=Customer ID) is placed in the resource property file. The key name is generated from the text value. The generated WSDL file will use the customer.id.key in the caption attribute value (for example, <portlet:action name="CustomerInfoEvent" caption="the.customer.id.key" description="The Customer ID" />)"

Note that When creating JSR-168 portlets we cannot specify a manually created resource file. The reason for this is JSR-168 portlets share a resource file for Property Broker information (e.g. caption), as well as for Portlet information (e.g. title).