To define the dynamic context portlet groups for the Portal Application, do the following tasks:
Note:
Dynamic context portlet groups must have unique names for the Portal Application.
- Dynamic context portlet groups for the portlets of the Portal Application should be defined in the XML file which conforms to the dynamic context portlet group definition schema. The following example is of the XML instance file for the discussed example of Account List, Contract List, Order List, and Invoice List portlets:
<?xml version='1.0' encoding='UTF-8'?> <DynamicContextGroups> <DynamicContextGroup> <DynamicContextGroupName>AccountRelatedPortletGroup</DynamicContextGroupName> <DynamicContextMasterPortlet>Account List</DynamicContextMasterPortlet> <DynamicContext>accountId</DynamicContext> <DynamicContextSlavePortlet> <DynamicContextSlavePortletName>Contract List </DynamicContextSlavePortletName> <SlavePortletAction>https://hostname.domain/webapp/wcs/tools/servlet/ ContractListView?state=AllList&startindex=0&storeId=1413 </SlavePortletAction> <SlaveParamMapToContext>accountId</SlaveParamMapToContext> </DynamicContextSlavePortlet> <DynamicContextSlavePortlet> <DynamicContextSlavePortletName>Order List</DynamicContextSlavePortletName> <SlavePortletAction>https://hostname.domain/webapp/wcs/tools/servlet/ OrderListViewB2B?startindex=0&accountId=accountID&storeId=storeID </SlavePortletAction> < SlaveParamMapToContext>accountId</SlaveParamMapToContext> </DynamicContextSlavePortlet> <DynamicContextSlavePortlet> <DynamicContextSlavePortletName>Invoice List</DynamicContextSlavePortletName> <SlavePortletAction>https://hostname.domain/webapp/wcs/tools/servlet/ OrderListViewB2B?startindex=0&accountId=accountID&storeId=storeID &invoiceState=true </SlavePortletAction> <SlaveParamMapToContext>accountId</SlaveParamMapToContext> </DynamicContextSlavePortlet> </DynamicContextGroup> <DynamicContextGroup> <DynamicContextGroupName>ContractRelatedPortletGroup</DynamicContextGroupName> <DynamicContextMasterPortlet>Contract List</DynamicContextMasterPortlet> <DynamicContext>accountId</DynamicContext> <DynamicContextSlavePortlet> <DynamicContextSlavePortletName>Order List</DynamicContextSlavePortletName> <SlavePortletAction>https://hostname.domain/webapp/wcs/tools/servlet/ OrderListViewB2B?startindex=0&accountId=accountID&storeId=storeID </SlavePortletAction> < SlaveParamMapToContext>accountId</SlaveParamMapToContext> </DynamicContextSlavePortlet> <DynamicContextSlavePortlet> <DynamicContextSlavePortletName>Invoice List</DynamicContextSlavePortletName> < SlavePortletAction>https://hostname.domain/webapp/wcs/tools/servlet/ OrderListViewB2B?startindex=0&accountId=accountId&storeId=storeId &invoiceState=true </SlavePortletAction> < SlaveParamMapToContext>accountId</SlaveParamMapToContext> </DynamicContextSlavePortlet> </DynamicContextGroup>
- All the portlets that are members of the dynamic context portlet group must extend from com.ibm.commerce.portal.wpsportlets.DynamicWCSServletInvokerPortlet class.
- The Portal Application portlet.xml file must be updated to reflect the relationships between the portlets that are members of the dynamic context portlet groups. The Dynamic Context Portlet Group Assembly Tool, which is implemented as a plug-in, updates the file. To deploy the plug-in, do the following:
- Unzip the contents of the DynamicContextTooling.zip file located on the Rational Application Developer machine in temp\Portal\plugins to the following directory:
RAD_installdir\eclipse\plugins
- The contents of the ZIP file are extracted to the following directory RAD_installdir\eclipse\plugins\com.ibm.commerce.portal.tooling.dynamiccontext
- Open the plugin.properties file and add the path to the schema.xsd file for the Schema_Path. The default location for the schema.xsd file is the RAD_installdir\plugins\com.ibm.commerce.portal.tooling.dynamiccontext/ directory.
- Restart the the WebSphere Commerce development environment.
- Open Perspective > Show view > Other > Commerce Portal Tooling Views > Dynamic Context WAR file update.
- The plug-in displays. Specify the portlet.xml file name and the XML instance of the schema file in the appropriate fields.
- Click OK. The XML instance is verified against the schema and the portlet.xml file is updated.
Notes:
- If the XML instance file does not conform to the schema, an error message is displayed to the user and the file is not updated.
- The Schema.xsd file and the Dynamic.xml sample XML instance file, which defines the dynamic context portlet groups, are provided in DynamicContextTooling.zip.
- After the portlet.xml file is updated, you can use the file to construct the Portlet Application WAR file.
- Unzip the contents of the DynamicContextTooling.zip file located on the Rational Application Developer machine in temp\Portal\plugins to the following directory:
To familiarize yourself with creating a dynamic context relationship, complete the following tutorial: