Monday, June 11, 2007

Exporting content from Alfresco

The JCR defines a standard format for importing/exporting content: the system view mapping. So how can I export a particular node from alfresco as final part of a work flow?

First I need to create a simple work flow in alfresco that allows me to edit content and then mark that content for publication. In alfresco I created a space to contain draft content and a space to contain to be published content. I added a rule to the draft content space that allows the author to submit content for publication, this rule copies the selected content item to the publish space.

I added another rule, this time to the publish space, that activates the publication process. For this a custom alfresco 'action' is developed that exports the selected node to an XML stream that complies to the JCR system view.

The resulting XML stream must be converted because it contains e.g. node types that are not supported on the serving repository. So these node types must be converted into supported node types.

The conversion is implemented using the Java rules engine API (JSR-94). This API defines how rules engines can be acquired and used, it does not describe how rules are defined.

Using the Java rule engine API allows changing the rules engine without the need to change the code. For starters I chose JBossRules as rule engine.

No comments: