Portal, Express Beta Version 6.1
Operating systems: i5/OS, Linux,Windows |
ConfigEngine.{bat | sh} enable-page-as-extension-node -DPageUniqueName=pageUniqueName [-DVirtualPortalContext=virtualPortalContext]
where pageUniqueName is the unique name of the extension node and virtualPortalContext is the context of the virtual portal that the specified page is part of. The -DVirtualPortalContext flag is needed only in the case where a virtual portal is used.
This command designates the page as an extension node. If you subsequently need to remove the extension node designation, run the command using the disable-page-as-extension-node task.<portlet-preferences> ... <preference> <name>com.ibm.portal.context.enable</name> <value>true</value> </preference> ... </portlet-preferences>
... <config-param> <param-name>com.ibm.portal.context.enable</param-name> <param-value>true</param-value> </config-param> ...
Additionally, also modify the web.xml file for IBM portlets to receive portlet properties. The servlet class entry should specify the com.ibm.wps.pb.wrapper.PortletWrapper class. SeePackaging, deploying and compiling considerations for more information and an example.
public void processAction (ActionRequest request, ActionResponse response) throws PortletException, java.io.IOException { // perform application specific action handling ... // perform page context processing String specialAction = request.getParameter("com.ibm.portal.action"); if (specialAction != null && specialAction.equals("com.ibm.portal.context.receive")) { //this indicates context was passed to the launched page java.util.Map contextMap = (java.util.Map) request.getAttribute("com.ibm.portal.context"); Object propertyValue = (Object) contextMap.get(<propertyName>); portletSession.setAttribute(<propertyName>, propertyValue); } }
IBM portlets must implement the PropertyListener interface that provides the setProperties() method, which provides the page properties as an array of PropertyValue objects.
In this sample, a loop is used to scan the array for the task properties.public void setProperties(PortletRequest request, PropertyValue contextArray[]) { Object propertyValue; for (int i = 0; i < contextArray.length; i++) { String propertyName = contextArray[i].getProperty().getName(); if(propertyName.equals(<propertyName>)) { propertyValue = (Object)contextArray[i].getValue(); } } request.getSession().setAttribute(<propertyName>, propertyValue); }
private DynamicUIManagementFactoryService dynamicUIManagerFactoryService; private RedirectURLGeneratorFactoryService redirectService; PropertyFactory propertyFactory; ... // Obtain a reference to the Dynamic UI Management Factory service PortletServiceHome dynamicUIManagerFactoryServiceHome = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.portlet.service.dynamicui.DynamicUIManagementFactoryService"); dynamicUIManagerFactoryService = (DynamicUIManagementFactoryService) dynamicUIManagerFactoryServiceHome.getPortletService(DynamicUIManagementFactoryService.class); // Obtain a reference to the property factory PortletServiceHome serviceHome = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.propertybroker.service.PropertyFactory"); propertyFactory = (PropertyFactory)serviceHome.getPortletService(com.ibm.portal.propertybroker.service.PropertyFactory.class); // If the dynamic UI should be displayed immediately upon launch, // obtain a reference to the RedirectURLGeneratorFactory service PortletServiceHome redirectServiceHome = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.portlet.service.state.RedirectURLGeneratorFactoryService"); redirectService = (RedirectURLGeneratorFactoryService) redirectServiceHome.getPortletService(RedirectURLGeneratorFactoryService.class);
Context ctx = new InitialContext(); ... Name uniqueName = new CompositeName("portal:uniquename"); uniqueName.add(yourUniqueName); ObjectID oidForName = (ObjectID) ctx.lookup(uniqueName);
Context ctx = new InitialContext(); ... Name portletName = new CompositeName("portal:config/portletdefinition"); portletName.add(appID); portletName.add(portletName); ObjectID portletDefOID = (ObjectID) ctx.lookup(portletName);
DynamicUICtrl DynamicUICtrl = dynamicUIManagerFactoryService.getDynamicUICtrl(request, response, extensionNode);
PropertyController property1 = propertyFactory.createProperty(config); property1.setName(propertyKey); property1.setClassname("java.lang.String"); property1.setDirection(Direction.OUT); PropertyValue value = propertyFactory.createPropertyValue(request, property1, propertyValue); PropertyValue[] propertyValues = new PropertyValue[1]; propertyValues[0] = value;
DynamicUICtrl.addPage(pageDefinitionID, new LocalizedImpl(title,description), propertyValues);
RedirectURLGenerator redirector = redirectService.getURLGenerator(request, response); EngineURL redirectURL = redirector.createPortletURL(launchedPortlet); response.sendRedirect(redirectURL.toString());
As an alternative, the launching portlet can close a dynamic UI using the removePage() or removePortlet() methods of the DynamicUICtrl interface, providing the object ID of the dynamic UI as input on the call. If removing a dynamic portlet, the calling portlet must be on the same page.