One of the comments I had on my last blog post point out that one of the main problems with using Aikau is that it doesn’t support the XML-based Forms Runtime that Share uses to render forms using the old YUI2 controls.
I decided to take a look into this issue and see what could be done about it. The major issue with the existing implementation is that it the REST APIs return HTML fragments containing references to the YUI2 controls - it’s just not possible to extract the pure data from the API as it is not.
Fortunately one of the many great things about the WebScripts implementation is their ability to be extended and have multiple output formats defined for them. This meant that I was able to extend the FormUIGet Java controller for the WebScript to generate a pure JSON output for the forms data and then define a new WebScript descriptor to access that data.
Because the Forms Runtime only applies to Share and not to to standalone clients, it was necessary to package the Java class and Spring bean configuration into a separate JAR file. This means that to leverage this new capability of Aikau you now need to include an additional dependency in your AMP files (or simply download the JAR from our Maven repository and copy it into the “share/WEB-INF/lib” folder as I do in my demo video).
Now that we can access the forms runtime data we need to be able to convert the form definition into an Aikau forms model. This is capability is provided by the “alfresco/services/FormsRuntimeService” module. At the moment this module is not fully complete - but I wanted to get something working out to the Community as soon as possible in order to get feedback and hopefully some collaborative development.
At the moment only a couple of YUI2 controls are mapped to Aikau controls, but both edit and view modes are supported and the ability to configure in custom mappings is something that will be added in later. Constraints are also only partially handled, but the remaining constraints will be added soon.
The main objective for this first release was to get something out to the Community that demonstrated the end-to-end capability. A test page has been bundled with the Aikau that you can try out. Everything has been done to support multiple versions of both the Aikau and Forms-Runtime-Support JARs.