Nuxeo / WebRatio Integration


Wed 29 May 2013 By bjalon

We've been working on a project using WebRatio to build a Web application that is integrated with the Nuxeo Platform to store documents. We wanted to share some insights gained from this project.

WebRatio Integration Overview


WebRatio is a Web application builder based on Eclipse. In this tool, you can define:


  • Entities: Objects managed by the application

  • Views

  • Units: Links between Views with input, output and logic - a controller.


We decided to create a special Nuxeo unit linked directly to some operations or automation chains.

Here is the final application structure:

0

You can see that each box with a blue title defines a View, and boxes with a red title define a Unit.

We started to use a unit to execute Groovy scripts:

2

And finally, we created a special Nuxeo Unit that embeds the automation chain request:

1

And coupling management between the View and the Nuxeo Unit:

9
All works fine. As you can see, we start first with simple connection.

Security: Portal SSO Activation


We chose to use Portal SSO, plugin that enables a shared key between Nuxeo and WebRatio.

We added the following contribution to enable the Portal SSO login module in Nuxeo for an Automation REST request:


<component name=”ro.forwardsoftware.authentication.service.contribution”>

<require>org.nuxeo.ecm.platform.ui.web.auth.defaultConfig</require>
<require>org.nuxeo.ecm.automation.server.auth.config</require>

<extension
target=”org.nuxeo.ecm.platform.ui.web.auth.service.PluggableAuthenticationService”
point=”authenticators”>
<authenticationPlugin name=”PORTAL_AUTH”>
<loginModulePlugin>Trusting_LM</loginModulePlugin>
<parameters>
<parameter name=”secret”>${nuxeo.shared.key}</parameter>
<parameter name=”maxAge”>60</parameter>
</parameters>
</authenticationPlugin>
</extension>

<!– Include Portal Auth into authentication chain –>
<extension point=”specificChains” target=”org.nuxeo.ecm.platform.ui.web.auth.service.PluggableAuthenticationService”>

<specificAuthenticationChain name=”Automation”>
<urlPatterns>
<url>(.)/automation.</url>
</urlPatterns>

<replacementChain>
<plugin>AUTOMATION_BASIC_AUTH</plugin>
<plugin>PORTAL_AUTH</plugin>
<plugin>ANONYMOUS_AUTH</plugin>
</replacementChain>
</specificAuthenticationChain>

</extension>

</component>


This component is enabled by a template (deployed with the Marketplace package) in our case.

But you can just:


  • replace the "${nuxeo.shared.key}" by your own shared key

  • and put this XML in a named file portal-sso-config.xml into $NUXEO_HOME/nxserver/config/ folder.


The WebRatio client just executes this to request Nuxeo:


HttpAutomationClient client = new HttpAutomationClient("http://server.name.fr/nuxeo/site/automation");

// if Portal SSO call
client.setRequestInterceptor(new PortalSSOAuthInterceptor(sharedKey, username));
Session session = client.getSession();
// if standard call
// Session session = client.getSession("user", "password");

Target Protype


The goal of the prototype was to manage cases.
There are two kinds of documents:

  • A Case that stores some metadata and is linked to several Case Documents,
  • A Case Document that stores a file and some metadata and is attached to a Case

The customer chose to store Cases in the WebRatio database and Case Documents in Nuxeo. They chose this because they are planning to create a workflow through WebRatio. So they wanted to have entities defined in WebRatio for that.

Prototype


Here is the view to create a new Case Document (stored in Nuxeo):

3

The Case Document is stored in Nuxeo with the Blob file and attached to the Case Object stored in the WebRatio database.

Here is the Case view that expose each Case stored in WebRatio:

4

And the detailed Case, that exposes each Case Document attached (without the version label, for those that understand this joke):

5

And finally, the detailed Case Document:

6

We've added some actions below: lock, unlock, and edit. We've also implemented a search view.

We asked the WebRatio architect about implementing persistence of WebRatio entities with Nuxeo, and this is totally possible as WebRatio manages XSD definitions and entity persistence is pluggable. So we could have used the CMIS integration while we wait for the CRUD REST/SOAP automation planned for Nuxeo 5.7.1 (around the end of June) to implement this.

Finally, this integration project took a grand total of 5 days, with Nuxeo training included. It was a really productive week.


Category: Product & Development
Tagged: Insight, Nuxeo Integration