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

org.cristalise.dsl.scaffold.entity_changeName_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.common.ObjectAlreadyExistsException
import org.cristalise.kernel.lifecycle.instance.predefined.ChangeName
import org.cristalise.kernel.utils.Logger

//--------------------------------------------------
// 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 outcome = job.getOutcome()
def currentName = item.getName()
def newName = outcome.getField('Name')

if (currentName && newName && (newName != currentName)) {
    def params = new String[2]

    params[0] = currentName
    params[1] = newName

    agent.execute(item, ChangeName.getClass(), params)
}
else
    Logger.msg(5, "New name or current name were empty or new name is equal to the current one")




© 2015 - 2024 Weber Informatics LLC | Privacy Policy