...
calling services:
Code Block Map runService(String serviceName, Map inputMap)
Code Block Map run(Map args)
Info The "run" method is implemented using named parameters and supports service calls with the following style:
Code Block result = run service: 'createProduct', with: [productId: 'WG-1111']
retrieving data TODO: expand to support conditions; TODO: for more complex queries use the entity builder (work in progress); TODO: properly manage EntityListIterator for larger sets of data
Code Block GenericValue findOne(String entityName, Map inputMap)
Code Block List findList(String entityName, Map inputMap)
Code Block EntityQuery select(...)
Code Block EntityQuery from(...)
Info The "select" and "from" methods can be used in the following ways:
Code Block record = select().from('Product').where(productId, 'WG-1111').queryOne() // selects all the columns of the record record = from('Product').where(productId, 'WG-1111').queryOne() // same as above record = select('internalName').from('Product').where(productId, 'WG-1111').queryOne() // selects one column of the record
For more details refer to the Javadocs of EntityQuery.
modifying data:
Code Block GenericValue makeValue(String entityName)
and then call the methods on the GenericValue object (remove/store etc...)
logging (they all accept a GString i.e. $notation):
Code Block logInfo(String message)
Code Block logWarning(String message)
Code Block logError(String message)
returning from the service or event (the methods simply return a Map for services or a string for events but you still have to use the "return" keyword to return the map back; when used by events the error method adds also the error message, if specified, to the request object):
Code Block def success(String message)
Code Block Map failure(String message)
Code Block def error(String message)