All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cristalise.dsl.scaffold.item_aggregate_groovy.tmpl Maven / Gradle / Ivy

Go to download

CRISTAL-iSE Domain Specific Language module for bootstrapping and funtional testing

There is a newer version: 6.0.0
Show newest version
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()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy