150 likes | 330 Views
J- oy. Template Structure. Template – Overview. expressions.properties. Templates Folder. Path expressions. Resources. settings.properties. < Templates Group >. Template metadata. Scripts. < scripFile >. groovy. < Template >. Scripts. UMLModel. static. < path >. < file >.
E N D
J-oy TemplateStructure
Template – Overview expressions.properties Templates Folder Pathexpressions Resources settings.properties <TemplatesGroup> Templatemetadata Scripts <scripFile>.groovy <Template> Scripts UMLModel static <path> <file> UMLPackage dynamic <path> <file>.gsp UMLClass GSP Templates
Template – Folders Templates Folder Resources <TemplatesGroup> Scripts <Template> UMLModel static UMLPackage dynamic UMLClass Folders with predefined name.
Template – Paths Templates Folder Resources <TemplatesGroup> Scripts <Template> UMLModel static <path> UMLPackage dynamic <path> UMLClass 0, 1 or more nested folders. GString expressions can be used as part of the name. i.e.: ${object.name} Path expressions can be used as part of the name. i.e.: ##exp1##
Template – Static files Templates Folder Resources <TemplatesGroup> Scripts <Template> UMLModel static <path> <file> UMLPackage dynamic <path> UMLClass Static content files. GString expressions can be used as part of the name. i.e.: ${object.name}.gif Path expressions can be used as part of the name. i.e.: ##exp1##.gif
Template – Dynamic files Templates Folder Resources <TemplatesGroup> Scripts <Template> UMLModel static <path> <file> UMLPackage dynamic <path> <file>.gsp UMLClass Groovy Server Pages used for generating dynamic content files. GString expressions can be used as part of the name. i.e.: ${object.name}.gif Path expressions can be used as part of the name. i.e.: ##exp1##.gif
Sample - Groovy Server Pages publicclass ${object.name} implementsSerializable { privatestatic final longserialVersionUID = 1L; @Id @Basic(optional = false) @Column(name = "${object.name}_ID") privateInteger ${object.name}Id; <%object.ownedAttributes.each{attribute->%> @Column private ${attribute?.type?.name} ${attribute?.name}; <%}%> ${object.name}.java.gsp
Template – Scripts Templates Folder Resources <TemplatesGroup> Scripts <scripFile>.groovy <Template> UMLModel static <path> <file> UMLPackage dynamic <path> <file>.gsp UMLClass Groovy files used for providing reusable object-oriented scripting support to GSP templates.
Sample - Groovy Script import org.eclipse.uml2.uml.Property; importorg.eclipse.emf.common.util.EList; classJPAUtil { privateObjectumlClass; JPAUtil(ObjectumlClass){ this.umlClass=umlClass; } StringgetDump() { StringBuildersb = new StringBuilder(); sb.append("\nUMLClass.name: " + umlClass.getName()); sb.append("\nUMLClass.package: " + umlClass.getPackage().getName()); // JPAUtil.groovy
Template – Pathexpressions expressions.properties Templates Folder Resources <TemplatesGroup> Scripts <scripFile>.groovy <Template> UMLModel static <path> <file> UMLPackage dynamic <path> <file>.gsp UMLClass Path expressions file. This file holds expressions that can be used in folder and file names for dynamically generating paths, using scripts that include characters not supported by the file system.
Sample – Path expressions exp1=${umlclass.name} exp2=<%JPAUtil.generateJSFFileName(umlclass)%> expressions.properties
Template – Settingsmetadata expressions.properties Templates Folder Resources settings.properties <TemplatesGroup> Scripts <scripFile>.groovy <Template> UMLModel static <path> <file> UMLPackage dynamic <path> <file>.gsp UMLClass Metadata defining template parameters that must be provided as input for the template execution. Template parameters are provided as an input file to the templates engine. When running in interactive mode, engine can ask for missing parameters if needed.
Sample - Groovy Script # Metadatafortemplaterequiredsettings template.name=EntitiestoJava settings.count=3 setting.0.key=MavenGroupId setting.0.label=MavenGroup Id setting.0.default=ar.com.coonocer setting.0.mandatory=true setting.0.format=String setting.1.key=MavenArtifacId setting.1.label=MavenArtifac Id setting.1.default=web-project ... expressions.properties
Template – Runtimeview Template GSP TemplateGroovyClasses TemplateLibraries? J-oy JRE 1.5
Futherquestions • Ifyouwanttocontribute, haveanyquestionorsuggestion, pleasecontactus at: • info.joy.team@gmail.com