Ephesoft CMIS Export plugin using Alfresco’s Aspects

Ephesoft is a great tool to process scanned pages, construct documents again (no separator pages anymore), gather metadata, and read barcodes and line items. Next to that it is build on a wide diversity of open standards. CMIS is one of them, and it is a perfect standard to use to get the document and metadata as a whole to a content management system of choice (as I described before). The major document management solutions implemented this open industry standard in their latest releases. The ‘biggest’ downside is the CMIS standard is bound to Document Types being transfered. Alfresco is focused on the concept of an Aspect, a bundle of metadata and behavior that one could assign to any object. Alfresco has created an CMIS extension that supports these Aspects. This blog post describes how to use this extension to allow Ephesoft to export Alfresco Aspects using CMIS.

The concept is too easy; in your Java code, configure the extended factory as provided in Alfresco’s CMIS extension package. This factory knows about Aspects. Recompile your code, insert the Alfresco CMIS extension jar (from this zipfile) into Ephesoft/Application/WEB-INF/lib, restart Ephesoft, configure your CMIS attribute mapping to include any aspect-based property, and you’re off. And you remain fully backwards compatible!

The requirement is that OpenCMIS 0.2 or above are used. Alfresco does, and Ephesoft 2.0 and above do too (they are at 2.2 Community and Enterprise right now!). I got the Ephesoft source code of the file CMISExporter.java (you can request this at tech support as an Enterprise customer, the Community version will be released shortly).

Just after the if statement in line 366 (given the version 2.0 code)

 if (null != repositoryID && !repositoryID.isEmpty()) {
    sessionParameters.put(SessionParameter.REPOSITORY_ID, repositoryID);
}

Insert the line that configures the new Factory

sessionParameters.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

Recompile, put Alfresco’s CMIS extension (I use ‘alfresco-opencmis-extension-110208.jar’) into the Application/WEB-INF/lib as defined before, and let the show begin.

[I ran into some version-issues. I also had to change 7 entries of ‘CMIS_EXPORT_PLUGIN ‘ (starting line 175) into ‘DCMAPlugin.CMIS_EXPORT’ (and import ‘com.ephesoft.dcma.core.common.DCMAPlugin;’), because  the type of method-parameters has changed.]

In Ephesoft navigate to your Batch Class definition and edit the file containing the attribute mapping (for me: C:\Ephesoft\SharedFolders\BC5\cmis-plugin-mapping\DLF-Attribute-mapping.properties). I assume that you already defined some mapping to an existing type in Alfresco. Otherwise see my earlier post. Now, you have to make 2 modifications.

  1. Map one of your existing Ephesoft fields to cm:title (which is a mandatory aspect on a cm:content (=Document) object).
  2. Extend your document type with the aspect you want to assign property values to. I map against a custom document type D:ephesoft:factuurtype. I modified it into ‘D:ephesoft:factuurtype,P:cm:titled’. Remind, you add a ‘D:’ vor Document, and a ‘P:’ for asPect!

Trigger a new Batch of this class, and -voila-!

 

I do have some challenges; Ephesoft complains there is an error, and Alfresco receives the document, and creates an error (as if it received the document twice (?)). Can be because I have some logic set-up against the Ephesoft landing space in Alfresco. Or the config of the mapping.properties is not fine-tuned enough. (trial and error…) To be continued. but not this week!

Advertisements