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.
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>com.ibm.isf.home.ISFGetListOfPortletsToHide class name is used.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;
}
}<Portlets>
<Portlet PortletTID="pickOrderPortlet"></Portlet>
</Portlets>