Package com.ibm.portal.state

This package defines state representation of portal resources.

See:
          Description

Interface Summary
Constants Interface that is the base class for constants and serves as a tagging interface for these constants.
Constants.Clone Base interface to flag a constant that relates to state-cloning
Constants.Merge Base interface to flag a constant that relates to state-merging
DisposableURL Representation of a URL object that should be disposed when no longer in use.
EngineURL The EngineURL is a URL that may contain navigational state of the portal engine and all portlets on the page.
PortletPreProcessor A PortletPreProcessor can be used to validate the state holder on a LayoutControl basis.
PortletStateManager This interface provides access to the state manager for portlets.
PortletStateManagerController This interface provides access to the StateManager for portlets.
PreProcessor Performs validation on the state holder.
ProcessingPhase Tagging interface to recognize interfaces that belong to the different processing stages of state processing.
RedirectURLGenerator The Redirect URL Generator provides methods to create URLs pointing to pages or portlets.
StateHolder Read-only interface to state.
StateHolderController Allows access to the state holder that potentially results in a modification of the underlying data.
URLFactory Factory that provides methods to obtain engine URLs as well as resource URLs.
 

Class Summary
Constants.DeepCopyConstant Implementation of the constant DEEP_COPY
Constants.EmptyCopyConstant Implementation of the constant EMPTY_COPY
Constants.OverwriteConstant Implementation of the constant OVERWRITE.
Constants.SmartCopyConstant Implementation of the constant SMART_COPY
 

Package com.ibm.portal.state Description

This package defines state representation of portal resources.

Package Specification

Some resources of the portal hold state information. The elements of this package allow the description of this information in a general manner. Basically, state can be any kind of Object. States can be categorized into different kinds with the StateType enumeration. The StateModel defines state for resources that are organized as trees.

The NavigationModel is a state model. Its nodes carry state information like expansion, for example.

Example

The following example could be some code in a theme that creates a link to put a portlet into SOLO mode and triggers an action with parameter myparamter on this portlet.

            // ---- the following code only needs to be run once per thread
            
                final Context ctx = new InitialContext();
                final StateManagerHome home = (StateManagerHome) ctx.lookup("portalservice/" + StateManager.class.getName());
                final StateManager stateManager = home.getStateManager();
                
                // store all factories locally
                urlFct = (URLAccessorFactory) stateManager.getAccessorFactory(URLAccessorFactory.class);
                portletFct = (PortletAccessorFactory) stateManager.getAccessorFactory(PortletAccessorFactory.class);
                soloFct = (SoloAccessorFactory) stateManager.getAccessorFactory(SoloAccessorFactory.class);
                targetFct = (PortletTargetAccessorFactory) stateManager.getAccessorFactory(PortletTargetAccessorFactory.class);
        
                // ----- the following code needs to run per request

                final EngineURL url = urlFct.newURL(request, null);
                
                final StateHolderController state = url.getState();
                
                // identify the portlet
                final PortletAccessorController portletAcc = portletFct.getPortletController(
                        portletName,state
                );
                // add parameters for the portlet
                final Map params = portletAcc.getParameters();
                params.put("strutsAction", "something");
                portletAcc.dispose();
                
                // set portlet in SOLO state
                final SoloAccessorController soloCtrl = soloFct.getSoloController(state);
                soloCtrl.setSoloPortlet(portletName);
                soloCtrl.dispose();
                
                // set the portlet as target of this URL in order to trigger processAction
                final PortletTargetAccessorController targetCtrl = targetFct.getPortletTargetController(state);
                targetCtrl.setTarget(portletName, true);
                targetCtrl.dispose();
                
                // write URL to the output stream
                url.writeDispose(outputWriter);

Note: The state handling APIs are not intended as a replacement for the URL generation of action and render links that are present in the Portlet API. Portlets should use these APIs only for use cases that are not addressed by the Portlet API, like generating links to other portlets.