com.flexive.shared.scripting.groovy
Class GroovyScriptExporter

java.lang.Object
  extended by com.flexive.shared.scripting.groovy.GroovyScriptExporter

public class GroovyScriptExporter
extends java.lang.Object

GroovyScriptExporter - generate Groovy structure creation code from a given StructureExporterCallback instance Utilises GroovyScriptExporterTools as the utility class to generate the script code

Usage

- Create a new GroovyScriptExporter object providing a StructureExporterCallback interface obj:
GroovyScriptExporter exporter = new GroovyScriptExporter(callback);
- Either use the setters to provide the exporter with the relevant (boolean) options:
generateImportStatements: set to true if the script code should contain package import statements
generateDeleteCode: set to true if the script code should contain content instance / structure deletion code for all affected exported nodes
generateScriptAssignments: set to true if the script code should contain script assignments found during the export
defaultsOnly: set to true if the structure creation code should only contain the assignment names (using GroovyTypeBuilder defaults)

addRoot: add the ROOT node to the generated script code

run(..) methods:
run() .. generates the script code (use setters for options)
run(boolean reset) .. create the script code and optionally (reset = true will regenerate the script code if the run(...) method was invoked beforehand
run(generateImportStatements, generateDeleteCode, generateScriptAssignments, defaultsOnly, addRoot, reset) --> this is the shorthand method if you want to avoid using the setters

Author:
Christopher Blasnik (c.blasnik@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)

Constructor Summary
GroovyScriptExporter(StructureExporterCallback callback)
           
 
Method Summary
 java.lang.String getDeleteCode()
           
 java.lang.String getImportStatements()
           
 java.lang.String getScriptAssignments()
           
 java.lang.String getScriptCode()
           
 boolean isAddSystemTypes()
           
 boolean isAddWorkflow()
           
 boolean isDefaultsOnly()
           
 boolean isGenerateDeleteCode()
           
 boolean isGenerateImportStatements()
           
 boolean isGenerateScriptAssignments()
           
 boolean isScriptOverride()
           
 GroovyScriptExporter run(boolean reset)
          main method to perform script code generation (use setters to override def.
 GroovyScriptExporter run(boolean generateImportStatements, boolean generateDeleteCode, boolean generateScriptAssignments, boolean scriptOverride, boolean defaultsOnly, boolean addSystemTypes, boolean withoutDependencies, boolean addWorkflow, boolean reset)
          main method to perform script code generation
 void setAddSystemTypes(boolean addSystemTypes)
           
 void setAddWorkflow(boolean addWorkflow)
           
 void setCustomDeleteCode(java.lang.String customCode, boolean prepend)
          Add custom code to the generated structure / instance deletion code
 void setDefaultsOnly(boolean defaultsOnly)
           
 void setDeleteCode(java.lang.String deleteCode)
           
 void setGenerateDeleteCode(boolean generateDeleteCode)
           
 void setGenerateImportStatements(boolean generateImportStatements)
           
 void setGenerateScriptAssignments(boolean generateScriptAssignments)
           
 void setImportStatements(java.lang.String importStatements)
           
 void setScriptAssignments(java.lang.String scriptAssignments)
           
 void setScriptCode(java.lang.String scriptCode)
           
 void setScriptCode(java.lang.String customCode, boolean prepend)
          Add custom code to the generated structure creation code
 void setScriptOverride(boolean scriptOverride)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroovyScriptExporter

public GroovyScriptExporter(StructureExporterCallback callback)
Method Detail

run

public GroovyScriptExporter run(boolean reset)
main method to perform script code generation (use setters to override def. options)

Parameters:
reset - set to true in order to regenerate any code
Returns:
the GroovyScriptExporter itself for chained calls

run

public GroovyScriptExporter run(boolean generateImportStatements,
                                boolean generateDeleteCode,
                                boolean generateScriptAssignments,
                                boolean scriptOverride,
                                boolean defaultsOnly,
                                boolean addSystemTypes,
                                boolean withoutDependencies,
                                boolean addWorkflow,
                                boolean reset)
main method to perform script code generation

Parameters:
generateImportStatements - set to true to add package imports
generateDeleteCode - set to true to add structure / instance deletion code
generateScriptAssignments - set to true to add script events for types / assignments
scriptOverride - set to true to add script override code (overwrite event script if it exists)
defaultsOnly - set to true if the script export should disregard any existing options and use the defaults only
addSystemTypes - set to true if the script export should include the [fleXive] system types
withoutDependencies - set to true if dependencies should be ignored (affects assignments from derived types on flat exports)
addWorkflow - set to true if the script export should include names of workflows
reset - set to true in order to regenerate any code
Returns:
the GroovyScriptExporter itself for chained calls

getDeleteCode

public java.lang.String getDeleteCode()

setDeleteCode

public void setDeleteCode(java.lang.String deleteCode)

isGenerateImportStatements

public boolean isGenerateImportStatements()

setGenerateImportStatements

public void setGenerateImportStatements(boolean generateImportStatements)

getImportStatements

public java.lang.String getImportStatements()

setImportStatements

public void setImportStatements(java.lang.String importStatements)

isDefaultsOnly

public boolean isDefaultsOnly()

setDefaultsOnly

public void setDefaultsOnly(boolean defaultsOnly)

isGenerateDeleteCode

public boolean isGenerateDeleteCode()

setGenerateDeleteCode

public void setGenerateDeleteCode(boolean generateDeleteCode)

isGenerateScriptAssignments

public boolean isGenerateScriptAssignments()

setGenerateScriptAssignments

public void setGenerateScriptAssignments(boolean generateScriptAssignments)

isAddSystemTypes

public boolean isAddSystemTypes()

setAddSystemTypes

public void setAddSystemTypes(boolean addSystemTypes)

isScriptOverride

public boolean isScriptOverride()

setScriptOverride

public void setScriptOverride(boolean scriptOverride)

isAddWorkflow

public boolean isAddWorkflow()

setAddWorkflow

public void setAddWorkflow(boolean addWorkflow)

setCustomDeleteCode

public void setCustomDeleteCode(java.lang.String customCode,
                                boolean prepend)
Add custom code to the generated structure / instance deletion code

Parameters:
customCode - custom code as a String
prepend - set to true if it should be prepended to the existing delete code, false = append

getScriptCode

public java.lang.String getScriptCode()

setScriptCode

public void setScriptCode(java.lang.String scriptCode)

getScriptAssignments

public java.lang.String getScriptAssignments()

setScriptAssignments

public void setScriptAssignments(java.lang.String scriptAssignments)

setScriptCode

public void setScriptCode(java.lang.String customCode,
                          boolean prepend)
Add custom code to the generated structure creation code

Parameters:
customCode - custom code as a String
prepend - set to true if it should be prepended to the existing delete code, false = append