org.cristalise.dsl.scaffold.item_aggregate_groovy.tmpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cristalise-dsl Show documentation
Show all versions of cristalise-dsl Show documentation
CRISTAL-iSE Domain Specific Language module for bootstrapping and funtional testing
import org.cristalise.kernel.persistency.outcome.Outcome
import groovy.xml.MarkupBuilder
//--------------------------------------------------
// item, agent and job are injected by the Script class
// automatically so these declaration are only needed
// to write the script with code completion.
// COMMENT OUT before you run the module generators
//--------------------------------------------------
// ItemProxy item
// AgentProxy agent
// Job job
//--------------------------------------------------
def detailsSchema = '@{item}_Details'
def name = item.getName()
def id = item.getProperty('ID')
def state = item.getProperty('State')
Outcome details = null
if (item.checkViewpoint(detailsSchema, 'last')) {
details = item.getOutcome(item.getViewpoint(detailsSchema, 'last'))
}
def writer = new StringWriter()
def xml = new MarkupBuilder(writer)
xml.@{item} {
Name( name )
ID( id )
State( state )
if (details) Description(details.getField('Description'))
}
//check if this variable was defined as output
@{item}XML = writer.toString()