Sdk30.PolymerClient

How to write an openCRX Polymer client

This guide explains how to write a Polymer client accessing openCRX using the RESTful API.

Prepare

This guide assumes that

Overview

MyContact is a sample Polymer app that accesses openCRX using the standard RESTful API. The app is located in the folder sample/src/war/opencrx-sample-store.war/ and consists of the following files:

  • index.html: Main page of the MyContact app
  • elements/mycontact-toolbar.html: Component for the app toolbar
  • elements/mycontact-contact-list.html: Component which allows to display a list of contacts retrieved from the API. The component extends the generic component mycontact-object-list.html.
  • elements/mycontact-object-list.html: Component which allows to display a list of objects retrieved from the API. The component shows how to implement infinite, incremental scrolling using the position and size parameters of the query API.
  • elements/mycontact-detail.html: Component which shows the detail information of a contact including some main attributes and address information. The component demonstrates how to use retrieve, display and update objects.

The implementation using the RESTful API is straight-forward. Use the Swagger UI to explore the API. See RESTful API for more information.

Build

Build the MyContact app as follows:

cd ./opencrx3-custom/sample/src/war/opencrx-sample-mycontact.war
bower update
cd ../../..
ant assemble

This generates the opencrx-sample-mycontact.war in the directory ../jre-1.7/sample/deployment-unit/.

Run

Next deploy opencrx-sample-mycontact.war. Copy the file to ./opencrxServer-3.0.0/apache-tomee-webprofile-1.7.1/webapps/ and restart Tomcat. Then open a browser and enter the URL http://localhost:8080/opencrx-sample-mycontact/index.html.

At startup, the app should display a toolbar and a list of contacts. As a reference see the demo.

In case of troubles consult the browser's console log and / or use Firebug to track warnings and errors.

Congratulations

Congratulations! You have successfully built and run your first openCRX Polymer client.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks