Form UI template

Developer information for the Sample Spring Boot base project with OpenKM authentication and support for JSP, JSTL & REST.

To learn more about Spring Boot, please visit https://projects.spring.io/spring-boot/

There is also a very good tutorial about Spring Boot at https://spring.io/guides/gs/spring-boot/

You can download the application (code-samples.x.x.zip) from OpenKM Download center.

Packaging


If you are using Eclipse, it is mandatory that you configure Lombok (see https://projectlombok.org/setup/eclipse)

This application can be packaged as either a jar or a war. In this POM configuration, the artifact will be a WAR.

If you need to change packaging, please see this URL: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging (section 66.2)

Installation

Step 1 - Register metadata in OpenKM

  • Go to Administration > Metadata and register the metadata definition:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.10//EN"
                                 "http://www.openkm.com/dtd/property-groups-3.10.dtd">
<property-groups>
  <property-group label="Sample Template" name="okg:tpl">
    <input label="Name" name="okp:tpl.name"/>
    <input label="Birth Date" name="okp:tpl.birth_date" type="date" />
    <select label="Language" name="okp:tpl.language" type="simple">
      <option label="Java" value="java"/>
      <option label="Python" value="python"/>
      <option label="PHP" value="php" />
    </select>
  </property-group>
</property-groups>
  • Enable "Sample templates" metadata group in the profiles.

Step 2 - Upload template file

You can also download the template.html 

  •  Create a file named template.html with the following content:
<html>
  <body>
    <h1>Sample template</h1>
    <table>
      <tr>
        <td><b>Name</b></td>
        <td>${okp_tpl_name!}</td>
      </tr>
      <tr>
        <td><b>Birth Date</b></td>
        <td>${okp_tpl_birth_date?string("yyyy-MM-dd")}</td>
      </tr>
      <tr>
        <td><b>Language</b></td>
        <td>${okp_tpl_language!}</td>
      </tr>
    </table>
  </body>
</html>
  •  Upload the template.html file to "/okm:templates/template.html"
  • Assign metadata group "Sample template" to the document "/okm:templates/template.html"

Step 3 - Deploy the application 

There's a file named application.properties in the project where the OpenKM connection parameters are set.

By default, the application should be run or deployed on the OpenKM server and a user named okmAdmin with password admin should exist, as set in the properties file shown below:

# Custom properties
openkm.url=http://localhost:8080/openkm
openkm.user=okmAdmin
openkm.password=admin
openkm.template=/okm:templates/template.html 
  • Copy the forms.war into your $TOMCAT_HOME/webapps directory

Step 4 - Create a document from UI

  • Open the following URL in your browser: http://localhost:8080/forms/
  • Fill in the fields shown on the screen and click the submit button
  • Check that a document has been created in OpenKM under /okm:root with the following format: {creation_date}-template.html