29 Adding Custom ADF Tabs to Self Service

This chapter describes the functionality that allows adding ADF page fragments to the Oracle Identity Manager Self Service.

To enable complex customizations in the Self Service, you can add additional top-level tabs to the right of the Tasks, Requests, and My Profile sections of the Self Service. To do so:

  1. Create new .jsff fragment(s) for UI customization.

    ADF provides the declarativeComponent tag to embed a separate file in a .jspx file. This technique is used to embed custom page fragments in Self.jspx. The custom file(s) must reside in iam-consoles-faces.war under the /web/pageFragments/ directory. For example, /web/pageFragments/custom/Custom.jsff.

    The following is a simple starter example with a page header:

    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:f="http://java.sun.com/jsf/core">
      <jsp:directive.page contentType="text/html;charset=utf-8"/>
      <af:componentDef>
        <af:panelStretchLayout id="psl1a" topHeight="auto" startWidth="0px"
                               endWidth="0px" bottomHeight="0px">
          <f:facet name="bottom"/>
          <f:facet name="start"/>
          <f:facet name="end"/>
          <f:facet name="top">
            <af:panelHeader id="ph1a" size="-1" text="">
              <f:facet name="context">
               <af:outputText value="Customize Fragment" id="ot2a" inlineStyle="font-size:15px"/>
              </f:facet>
              <f:facet name="menuBar"/>
              <f:facet name="toolbar"/>
              <f:facet name="legend">
               <af:separator id="s2a"/>
              </f:facet>
              <f:facet name="info"/>
            </af:panelHeader>
          </f:facet>
        </af:panelStretchLayout>
      </af:componentDef>
    </jsp:root>
    
  2. Create managed bean(s) for UI customizations, compile bean in separate .jar file, and add it to iam-consoles-faces.war.

    Note:

    A typical JavaServer Faces application includes one or more managed or backing beans, which are JavaBeans components associated with UI components used in a page. A backing bean defines the UI component properties, each of which is bound to either a component's value or a component instance. A backing bean can also define methods that perform functions associated with a component, including validation, event handling, and navigation processing.

    To provide custom business logic, a new managed bean must be created for each custom page. The new managed beans must be compiled into a new .jar file that you can add to iam-consoles-faces.war

  3. Add customization page(s) to faces-config-self.xml.

    Define the custom pages, as shown:

    <managed-bean>
         <managed-bean-name>customPage</managed-bean-name>
         <managed-bean-class>
         oracle.iam.consoles.faces.backing.Self$OperationAction
         </managed-bean-class>
         <managed-bean-scope>application</managed-bean-scope>
         <managed-property>
             <property-name>id</property-name>
             <property-class>java.lang.String</property-class>
             <value>customization_page</value>
         </managed-property>
         <managed-property>
             <property-name>pageUrl</property-name>
             <property-class>java.lang.String</property-class>
             <value>../pageFragments/custom/Custom.jsff</value>
         </managed-property>
    </managed-bean>
    

    Add the custom pages to the primaryOperationsMap, as shown:

    <managed-bean>
            <managed-bean-name>primaryOperationsMap</managed-bean-name>
            <managed-bean-class>java.util.LinkedHashMap</managed-bean-class>
            <managed-bean-scope>application</managed-bean-scope>
            <map-entries>
                <key-class>java.lang.String</key-class>
    <value-class>oracle.iam.consoles.faces.backing.Self$OperationAction</value-class>
                <map-entry>
                    <key>#{myTaskPrimaryOperation.entityTypeId}</key>
                    <value>#{myTaskPrimaryOperation}</value>
                </map-entry>
                <map-entry>
                    <key>#{myRequestPrimaryOperation.entityTypeId}</key>
                    <value>#{myRequestPrimaryOperation}</value>
                </map-entry>
                <map-entry>
                    <key>#{myProfilePrimaryOperation.entityTypeId}</key>
                    <value>#{myProfilePrimaryOperation}</value>
                </map-entry>
                <!-- New custom fragments -->
                <map-entry>
                    <key>#{customPage.id}</key>
                    <value>#{customPage}</value>
                </map-entry>
            </map-entries>
    </managed-bean>
    
  4. Add new managed bean(s) to faces-config-self.xml.

    The new managed bean class must be configured in the oim.ear/iam-consoles-faces.war/WEB-INF/faces-config-self.xml file, as shown:

    <managed-bean>
            <managed-bean-name>customBean</managed-bean-name>
    <managed-bean-class>oracle.iam.consoles.faces.custom.CustomBean</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    
  5. Add custom properties for tab names to Self.properties, as shown:

    Note:

    The first part of the resource name must match the managed-bean id parameter in step 3.

    customization_page.text=Custom
    customization_page.shortDesc=Custom Description