• Platform
    • Manager
    • Maestro
    • Exchange
    • Workspaces
    • Analytics
    • Springboard
    • API
Transact Services Guide (TSG)

Transact Services Guide (TSG)

  • Getting Started
  • Groovy Guide
  • Service Development
  • Groovy Services API
  • REST API

›Groovy Guide

Getting Started

  • Introduction

Groovy Guide

  • Groovy Guide
  • Groovy Declarations
  • Control Statements

Service Development

  • Service Development
  • Transaction Processing Sequence
  • Service Logging
  • Remote Service Calls
  • Fluent Security Configuration
  • Third-party Libraries

Groovy Services API

  • Groovy Services API
  • Fluent Function
  • Delivery Function
  • Form Version Selector
  • Form Security Filter
  • Form Prefill
  • Tracking Number
  • Form Dynamic Data
  • Submission Preprocessor
  • Receipt Number
  • Form Saved Processor
  • Submission Data Validator
  • Submission Completed Processor
  • Render Receipt Service
  • Delivery Process
  • Task Expiry Process
  • Email Service
  • Job Action
  • Scheduled Service
  • Groovy Service
  • SSO Revalidation
  • SSO Get Authentication Token
  • SSO Authentication OK Response
  • SSO Authentication Provider
  • Transaction History Publisher
  • Virus Scan

REST API

  • REST API
  • REST Application Package API
  • REST Delivery API
  • REST Form Groups API
  • REST Groovy Service Invoke v2
  • REST Service Definitions API
  • REST Tasks API
  • REST TestCenter API
  • REST TPac API
  • REST Transactions API
  • REST Transaction History API

Workspaces API

  • Workspaces API
  • Filters
  • Sort
  • Workspaces Category API
  • Workspaces Current User API
  • Workspaces Extract Name API
  • Workspaces Form API
  • Workspaces Group API
  • Workspaces Job API
  • Workspaces Org API
  • Workspaces Property Name API
  • Workspaces Space API
  • Workspaces Txn API
  • Workspaces User API

Groovy Guide

Groovy is a powerful scripting language which runs on the Java Virtual Machine. This gives you access to all the facilities provided by Journey Manager and Java, while providing a scripting language without the steep learning curve of Java.

You can think of Groovy as JavaScript for the server. It is a dynamic language, there are no compile and deploy steps. Just write it and run it.

The Temenos Journey platform provides customized Groovy runtime with security constraints for running in an application server context. For Groovy version information, see 'Groovy Lang' in Third-party Libraries.

Simple Example

The simple hello world example below defines a variable called name, and assigns it the value 'World'. Then on the next line this variable $name is included in the Hello text and this line is printed using the println function.

def name = 'World' 
println "Hello $name!"

And as expected the result is:

Hello World!

Learning Groovy

If you are familiar with programming in a modern language then you will be able to quickly learn Groovy. It has a C like syntax in common with C#, JavaScript and Java, but has scripting features so you don't have to write lots of code.

This Groovy Guide will provide you with a quick and gental introduction to the language, but will give you the skills you need to develop Groovy Service scripts.

As you are working through the Groovy Guide examples, please use the Groovy Script Console under the System menu. This provides you a play ground to try out examples and prototype Groovy scripts.

Groovy Script Console

Script Type Checking

Where possible configure your services to use the Groovy script Type Checked option. When using the option the script will be parsed before executing to see whether there are any script type errors. These compilation style errors messages are generally more informative that the standard Groovy dynamic execution errors.

The example below has the Type Checked option and is showing the cause of the error and its line number.

Groovy Script Type Checked

Without type checking the corresponding error is illustrated below. Note this error includes no line number and you would need to search you script to find the corresponding missing method.

Thu Apr 17 11:41:54 EST 2014
2014-04-17
groovy.lang.MissingMethodException: No signature of method: java.util.Date.formatter() is applicable for argument types: (java.lang.String) values: [yyyy-MM-dd'T'HH:mm:ss]
Possible solutions: format(java.lang.String), format(java.lang.String, java.util.TimeZone)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
    at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at Script1.run(Script1.groovy:9)
    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:518)
    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:556)
    at groovy.lang.GroovyShell.evaluate(GroovyShell.java:527)

Please note when using the Groovy Type Checked option you may need to write your scripts in a more statically declared Java like fashion to enable the Groovy runtime to figure out what you are trying to achieve.

To configure Groovy Type Checked on your service please configure the service definitions groovyTypeChecked Service Parameter to be true. By default this option is set to off, to ensure backward compatiblity with older scripts.

Groovy Script Type Checked Configuration

Next Steps

The next topic discusses Groovy Declarations.

Once you have completed this Groovy Guide and you want to learn more please see the Groovy Language Documentation.

← IntroductionGroovy Declarations →

Terms & Conditions

Privacy Policy

Cookie Policy

Copyright © 2003-2022 Temenos Headquarters SA