Show TOC

DelegationLocate this document in the navigation structure

Use

Instead of implementing a method within your portal component for a specific mode, you can specify another component to be called when your component is called in a specific mode.

This delegation is specified in the component's deployment descriptor:

            <component name="mycomp">
    <component-config>
        <property name="ClassName" value="com.sap.MyComponent"></property>
        <property name="mode">
            <property name="edit">
                <property name="delegate" value="myApp.editDelegate"></property>
            </property>    
            <property name="help">
                <property name="delegate" value="myApp.helpDelegate"></property>
            </property>    
        </property>
    </component-config>
</component>
         

When delegating for XXX mode, the doXxx() method is called on the delegate component. In the above example, doEdit() is called on DelegateComponent.default .

The subsequent request events are also sent to the delegate component until the mode is set to default.

From within the delegate component, you can obtain the context of the original component, as follows:

            request.getComponentContext(NodeMode.DEFAULT_MODE);
         

Mode Delegation

You can create a component that serves as the delegate component for all components that are called in a specific mode.

To specify a delegate, add a registry entry with the name of the delegate component in a subcontext named for the mode, and place this subcontext under the /runtime/prt.modes subcontext.

The following example shows how to specify the myApp.adminDelegate component as the delegate for all components that are called in admin mode:

               <registry>
                 <entry path="/runtime/prt.modes/admin" name="myApp.adminDelegate"
                   type="component" rebind="false"/>
               </registry>