public void prepareScript(Script script) { if (script instanceof CpsScript) { CpsScript cs = (CpsScript) script; cs.execution = execution; try { cs.$initialize(); } catch (IOException e) { // TODO: write a library to let me throw this throw new RuntimeException(e); } } }
final CpsScript s = parseScript(); scriptClass = s.getClass(); s.$initialize();
/** Default constructor for {@link CpsFlowExecution}. */ public CpsScript() throws IOException { // if the script is instantiated in workflow, automatically set up the contextual // 'execution' object. This allows those scripts to invoke workflow steps without // any special setup, making it easy to write reusable functions. CpsThread c = CpsThread.current(); if (c!=null) { execution = c.getExecution(); $initialize(); } }