In the latest two years here at TAI Solutions I was involved in many mentoring and training activities to take care of Alfresco Process Services projects and sometimes also on behalf of Alfresco Software itself. Finally I decided to create an Alfresco Process Services SDK to facilitate developers on creating extensions.
The most important tool for any developer working on these modern platforms is the Software Development Kit (SDK) that allow to easily build new functionalities and extensions. Another key point of having an SDK is that your code can be compliant with the vendor software lifecycle for building, compiling, packaging, testing and deploying your own solution built on top of the platform.
Considering the current lack of an official Alfresco SDK for APS then I decided to invest some time to create an initial and very generic Maven module for this purpose. In my previous post I shared my involvement as an Alfresco Certified Instructor at the last Alfresco DevCon in Edinburgh and I took advantage of the opportunity to create this module for all the attendees.
Unfortunately the Activiti documentation is not enough for building extensions on APS because Alfresco introduced new functionalities and services on top of Activiti adding new concepts such as Tenant, Application and Permissions. This means that if you try to use some of the Activiti examples on any APS instance you could have issues because some services and methods will return exceptions or null values.
A typical example is related to the use of the IdentityService that in any Activiti instance works as expected but in APS you have to consider these new services: UserService and GroupService. If you try to use the IdentityService, you will see only null values returned from Activiti without any effect at the storage level.
If you look at the APS sample projects published by Alfresco in the official documentation or in the Alfresco Wiki, you see that these artifacts don’t give you a complete way to build, package and test your extensions, you can only compile the specific sample for creating the JAR.
If you try to use another service or a different component, Maven can’t compile the new class because the rest of the Maven dependencies of APS are not included in the Java classpath. This is not enough for a production-ready project because you don’t have a complete lifecycle for managing your own extensions and you can’t guarantee that what you have implemented can be defined as compliant with the vendor, in this case we are talking about Alfresco.
How it was built
The APS SDK maven module was built following the source code of Alfresco Process Services and trying to isolate in a unique Maven POM the entire lifecycle for the platform but focusing only on building extensions.
At the moment this first version of APS SDK module includes the following functionalities.
Source packaging structure is based on the same APS project classpath, so if you know a little bit the source code of APS, you should feel at home :)
/src/main/resources/activiti: APS configuration files
/src/main/resources/app: APS Applications extracted
/src/test/java: unit and integration tests
In order to run the entire lifecycle, you only need to execute the following Maven command:
mvn clean install
This command will run the embedded container using a local content storage inside the project (FS + H2) and it will also run unit and integration tests. At the end it will create the deployment packages and it will also install the final artifact in the Maven repo.
You will find a generic sample implementation of a 4-eyes principle workflow with the following components:
BPMN 2.0 process definition
Below some features included in this first version:
Runs the embedded container + H2 DB
Runs unit and integration tests
Packages both App ZIP and JAR with customization
All the APS Java Services supported (UserService, GroupService, TenantService and so on...)
No parent pom
Standard JAR packaging and layout
It works seamlessly with any Maven-compliant IDE
Apache Maven 3.x (where x should be the latest version)
A valid APS license installed in the local system running Maven
Access to the Enterprise Maven Repo: an active account to have access to the Enterprise artifacts with the related source code. If you are an Alfresco Partner or an Alfresco Customer, you can raise a ticket in the Alfresco Support Portal asking for your own account credentials
Feel free to contact me for further information or if you want to contribute on Alfresco Process Services SDK.
I hope that this module can help any Alfresco expert to create new great BPM projects on top of the Alfresco Digital Business Platform