Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Create a concept for usage of  the template engine.

6th. call  (

...

Th.,

...

11. July 2013)

Agenda:

Querstions:

  • None - just discuss status und further steps

Summery:

After Michael made some notes to my code and my proposed usage example, i made some changes and we discussed the example. I renamed 'metadata' to 'mappers' as it is more precise.

Next Michael pointed me to a mistake i made. The approach above saves a specific data, where we actually want a variable. So that we may generate a document for different instances.

More precise: insted of "metadata":{"client":"/api/v1/clients/3"} we change it to {"mappers":"/api/v1/clients/{{clentID}}"} and the user has to send the clientID

So we end up with the new approach:

POST (creates new) TEMPLATE:

curl -X POST -i -H "Accept: application/json" -H "Content-type: application/json" -k --user mifos -d '{"text":"<html><header><title>This is title</title></header><body>Hello {{client.name}}, bye {{sender}}</body></html>","name":"foo","mappers":{"client":"/api/v1/clients/{{url.clientID}}"}}' https://localhost:8443/mifosng-provider/api/v1/templates?tenantIdentifier=default

GET MERGED TEMPLATE (e.g. for template with 3313):

curl  -k --user mifos -X POST -i  -H "Accept: text/html" -H "Content-type: application/json" -d '{"sender":"me", "clientID": 736}' https://localhost:8443/mifosng-provider/api/v1/templates/3313&clientID=736?tenantIdentifier=default

 

Further thoughts (for next versions of feature):

specify in the value of the mappers not only a url, but also what it is and how to get it:

  • "mapper":{"client":"GET JSON /api/v1/clients/{{url.clientID}}"
  • "mapper":{"client" :"GET JSON /api/v1/clients/{{url.clientID}}", "now": "java: new java.util.Date()"}
  • "mapper":{"client" :"java: getClient({{url.clientID}}) }

ToDo:

Implement url templating (or more generic, the value of the mappers)