Flow Development

Flow File Location

Administrative flows are implemented using Spring WebFlow 2. The implementatation pattern is to have a folder for each flow under /uPortal/uportal-war/src/main/webapp/WEB-INF/flows/. Each folder contains the flow definition XML, JSPs and messages files for the flow. The default uPortal configuration will load all flows following this pattern automatically. Messages files do need to be registered under the messageSource bean in /uPortal/uportal-impl/src/main/resources/properties/contexts/mvcContext.xml.

Portlet Definition

A Portlet provides the view into a specified flow. Portlet application context XML files reside in the /uPortal/uportal-impl/src/main/resources/properties/contexts/portlet/ folder. Most portlet application context configurations will only contain a FlowHandler and handler mapping with all other beans being defined in the uPortal application context as many parts of the framework may need access to them.

Example portlet application context configuration, specifying attribute-swapper as the name of the flow to use when in the VIEW PortletMode.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
           
    <bean class="org.springframework.webflow.mvc.portlet.FlowHandlerAdapter">
        <property name="flowExecutor" ref="flowExecutor"/>
    </bean>

    <bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
        <property name="portletModeMap">
            <map>
                <entry key="view">
                    <bean class="org.jasig.portal.portlets.flow.ParamaterizableFlowHandler">
                        <property name="flowId" value="attribute-swapper" />
                    </bean>
                </entry>
            </map>
        </property>
    </bean>
</beans>

Each portlet application context XML file is loaded individually by specifying it via the contextConfigLocation when defining the <portlet> in the uPortal portlet.xml at /uPortal/uportal-war/src/main/webapp/WEB-INF/portlet.xml

Example portlet configuration from portlet.xml:

<portlet>
    <portlet-name>IdentitySwapperPortlet</portlet-name>
    <display-name xml:lang="en">Identity Swapper Portlet</display-name>
    <portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
    <init-param>
        <name>contextConfigLocation</name>
        <value>classpath:/properties/contexts/portlet/identitySwapperContext.xml</value>
    </init-param>
    <expiration-cache>0</expiration-cache>
    <supports>
        <mime-type>text/html</mime-type>
        <portlet-mode>VIEW</portlet-mode>
    </supports>
    <supported-locale>en</supported-locale>
    <portlet-info>
        <title>Identity Swapper Portlet</title>
    </portlet-info>
</portlet>