Next-generation platform

Hiding portlets

You might have a business use case where the resource permission or showPortlet attribute in the isf-persona-config.json file cannot be used to show or hide portlets in the application.

The customization framework provides the capability to determine whether to hide portlets during the application runtime. As part of the application bootstrapping, the isf.common.getHiddenPortletList mashup is called, which returns the list of portlets that must be hidden.

To implement the custom logic, in the isf-persona-config.json file configure both showPortlet and callShowPortletMashup attributes as true, and then override the isf.common.getHiddenPortletList mashup. The application-provided mashup definition uses the com.ibm.isf.home.ISFGetHiddenPortlets custom mashup class. Replace the custom Java™ class with a new class.

The following sample mashup definition shows the isf.common.getHiddenPortletList mashup after it is overridden.
<mashup
        description="Get list of portlets to be hidden"
        endpoint="EP_CONFIG" id="isf.common.getHiddenPortletList" mashuptype="XAPI"
        skipDataProvider="false" transactional="true">
        <classInformation name="com.ibm.isf.home.ISFGetListOfPortletsToHide"/>
        <API Name="Dummy">
            <Input>
                <Dummy/>
            </Input>
            <Template>
            </Template>
        </API>
        <APINamespace inputNS="isf.common.getHiddenPortletList_input"
            outputNS="isf.common.getHiddenPortletList_output" />
        <AlternateResourceIds>
            <AlternateResourceId altResourceId="ISFSYS00001"/>
        </AlternateResourceIds>
    </mashup>
Note: In the sample mashup definition, the com.ibm.isf.home.ISFGetListOfPortletsToHide class name is used.
The following sample code illustrates a custom Java class:
public class ISFGetListOfPortletsToHide implements ISCUIMashup {
@Override
public Object execute(Object input, SCUIMashupMetaData mashup, SCUIContext ctx) {
        Document doc = SCXmlUtil.createDocument("Portlets");
        Element portletsElement = doc.getDocumentElement();
        /*Custom logic to determine if portlets needs to be hidden*/
        // Element portlet = SCXmlUtil.createChild(portletsElement, "Portlet");
        // portlet.setAttribute("PortletTID", "pickOrderPortlet");
        /* output format 
        <Portlets>
        <Portlet PortletTID="pickOrderPortlet"></Portlet>
        </Portlets>
       */
        return portletsElement;   
}
}
Note: The custom mashup must return the output in the following format:
<Portlets>
        <Portlet PortletTID="pickOrderPortlet"></Portlet>
        </Portlets>