One of the most common taglib used by WebCenter Portal Framework is the Resource Action Handler Tag (<rah:resourceActionBehavior>).
This tag allows creating links and navigating to the resource-viewers / URL Rewriters of a specific resource of a WebCenter Service (configured in a service-definition.xml file available in the classpath).
One of the best sample are the links to the resources in the OOTB Search Services Results Fragment:
<af:commandLink partialSubmit="true"
styleClass="WCSearchResultsTitleLink"
immediate="true" id="ssresfcl2">
<af:outputFormatted value="#{row.title}"
shortDesc="#{row.descriptionNoFormat == '' ? row.titleNoFormat : row.descriptionNoFormat}"
id="ssresfof1"/>
<rah:resourceActionBehavior id="rah2" serviceId="#{row.tableId}"
resourceId="#{row.id}"
resourceType="#{row.type}"
resourceTitle="#{row.titleNoFormat}"
resourceScope="#{row.scopeGuid}"
useResourcePopup="#{pageFlowScope.srbb.usePopups}"/>
</af:commandLink>
Another example of using rah:resourceActionBehavior can be found in the samples of content presenter given by JDeveloper installation (articles.jsff).
<af:commandLink immediate="true" partialSubmit="true" id="cl2">
<rah:resourceActionBehavior id="rah1"
serviceId="oracle.webcenter.content.presenter"
resourceId="#{node.id}"
resourceTitle="#{node.propertyMap['RD_ARTICLE:TITLE'].asTextHtml}"
useResourcePopup="never"/>
<f:attribute name="taskFlowInstId"
value="a5fafea8-90e6-4972-997d-314401b6c98b"/>
<f:attribute name="datasourceType" value="dsTypeSingleNode"/>
<f:attribute name="datasource"
value="#{node.id.repositoryName}#dDocName:#{node.propertyMap['dDocName'].value}"/>
<f:attribute name="templateView"
value="oracle.webcenter.content.templates.sitestudio.fullarticle"/>
<f:attribute name="regionTemplate" value="#{false}"/>
<af:outputText value="#{node.propertyMap['RD_ARTICLE:IMAGE'].asTextHtml}"
escape="false" id="ot4"/>
<tr:panelHeader text="#{node.propertyMap['RD_ARTICLE:TITLE'].asTextHtml}"
id="ph1">
<af:outputText value="#{node.propertyMap['RD_ARTICLE:SUMMARY'].asTextHtml}"
escape="false" id="ot3"/>
</tr:panelHeader>
</af:commandLink>
Here is shown how rah:resourceActionBehavior is being used to link a resource of type oracle.webcenter.content.presenter.
When sending custom parameters is required (not the default resourceId, resourceType...) then the f:attribute tag has to be used to populate the custom attributes.
In the sample attached to the post a sample of a custom service using rah:resourceActionBehavior can be found.
This sample contains a WebCenter Framework Application with:
- Modified service-definition.xml file defining a service called oracle.webcenter.merchan.sample and registering a custom Task Flow as resource-viewer.
<service-definition id="oracle.webcenter.merchan.sample" version="11.1.1.0.0">
<resource-view taskFlowId="/com/merchan/sample/controller/sample-resource-viewer.xml#sample-resource-viewer"/>
<!-- <resource-bundle-class>mycompany.myproduct.myapp.mycomponent.resource.ComponentMessageBundle</resource-bundle-class> -->
<name>Sample resource</name>
<description>Sample resource for the blog</description>
<!-- <icon>/mycompany/myproduct/myapp/mycomponent/component.png</icon> -->
<!-- <search-definition xmlns="http://xmlns.oracle.com/webcenter/search" id="mycompany.myproduct.myapp.mycomponent.query" version="11.1.1.0.0">
<query-manager-class>mycompany.myproduct.myapp.mycomponent.query.MyQueryManager</query-manager-class>
</search-definition> -->
</service-definition>
- Bounded Task Flow used as Resource Viewer with some of the OOTB parameters and a custom parameter.
- home.jspx modified including a rah:resourceActionBehavior tag to link to the new service.
<!-- Sample of code about calling RAH -->
<af:commandLink immediate="true" partialSubmit="true" id="cl2">
<rah:resourceActionBehavior id="rah1"
serviceId="oracle.webcenter.merchan.sample"
resourceId="My Id"
resourceTitle="My Title"
resourceType="My Type"
resourceScope="#{serviceCtx.scope.GUID}"
useResourcePopup="never"/>
<f:attribute name="customParameter" value="My Custom Value"/>
<af:outputText value="Click to invoke the Custom RAH"
id="ot1"/>
</af:commandLink>
- Execute the sample and Click the resource link to see how the Framework works
References: