| 1 | <!---
|
|---|
| 2 | I am the scaffolder manager. I call the requested functions of the scaffolder.
|
|---|
| 3 |
|
|---|
| 4 | I am triggered by the presence of a scaffolding.go parameter in the URL or Form scope.
|
|---|
| 5 | Valid Values are:
|
|---|
| 6 | url.scaffolding.go = display Show the user interface.
|
|---|
| 7 | url.scaffolding.go = introspectDB Instrospect DB and create scaffolding XML.
|
|---|
| 8 | url.scaffolding.go = build Build the application using the selected template.
|
|---|
| 9 | --->
|
|---|
| 10 |
|
|---|
| 11 | <!--- Need the following line since in all except trivial cases it will take a while to generate the code. --->
|
|---|
| 12 | <cfsetting requestTimeOut = "3600" >
|
|---|
| 13 | <cfif isDefined("url.scaffolding.go") OR isDefined("form.scaffolding.go")>
|
|---|
| 14 | <!--- Set up all the required file and URL paths --->
|
|---|
| 15 | <cfinclude template="/scaffolder/act_findfilepaths.cfm">
|
|---|
| 16 |
|
|---|
| 17 | <!--- Copy URL and Form scope to attributes --->
|
|---|
| 18 | <cfscript>
|
|---|
| 19 | if (NOT IsDefined("attributes"))
|
|---|
| 20 | attributes=structNew();
|
|---|
| 21 | StructAppend(attributes, url, "no");
|
|---|
| 22 | StructAppend(attributes, form, "no");
|
|---|
| 23 | </cfscript>
|
|---|
| 24 |
|
|---|
| 25 | <!--- If we asked for the user interface, show it then stop. Next step will be called by the interface so we stop. --->
|
|---|
| 26 | <cfif ListFindNoCase(attributes.scaffolding.go,"display")>
|
|---|
| 27 | <cfinclude template="/scaffolder/dsp_scaffolding.cfm">
|
|---|
| 28 | <cfabort>
|
|---|
| 29 | </cfif>
|
|---|
| 30 |
|
|---|
| 31 | <!--- Build the argumentsCollection to pass to the metadata object from the available attributes --->
|
|---|
| 32 | <cfset argumentCollection = structNew()>
|
|---|
| 33 | <cfset lArguments = "configFilePath,datasource,username,password,project,template,author,authorEmail,copyright,licence,version,lTables">
|
|---|
| 34 |
|
|---|
| 35 | <cfloop list="#lArguments#" index="thisArgument">
|
|---|
| 36 | <cfif isDefined("attributes.scaffolding.#thisArgument#") AND trim(Evaluate("attributes.scaffolding.#thisArgument#")) IS NOT "">
|
|---|
| 37 | <cfset argumentCollection[thisArgument] = Evaluate("attributes.scaffolding.#thisArgument#")>
|
|---|
| 38 | </cfif>
|
|---|
| 39 | </cfloop>
|
|---|
| 40 | <!--- Create the MetaData object. --->
|
|---|
| 41 | <cfset oMetaData = CreateObject("component","scaffolder.scaffolder.metadata").init(argumentCollection=argumentCollection)>
|
|---|
| 42 |
|
|---|
| 43 | <!--- If we requested the database introspection. --->
|
|---|
| 44 | <cfif ListFindNoCase(attributes.scaffolding.go,"introspectDB")>
|
|---|
| 45 | <cfset oMetaData.introspectDB()>
|
|---|
| 46 | </cfif>
|
|---|
| 47 |
|
|---|
| 48 | <!--- If we requested the code to be generated set up the cftemplate object and call build. --->
|
|---|
| 49 | <cfif ListFindNoCase(attributes.scaffolding.go,"build")>
|
|---|
| 50 | <cfset cftemplate = CreateObject("component","scaffolder.scaffolder.cftemplate").init()>
|
|---|
| 51 | <cfif isDefined("attributes.scaffolding.lTables")>
|
|---|
| 52 | <cfset oMetaData.build(cftemplate=cftemplate,lTables=attributes.scaffolding.lTables,destinationFilePath=baseDirectory,baseURL=form.baseURL)>
|
|---|
| 53 | <cfelse>
|
|---|
| 54 | <cfset oMetaData.build(cftemplate=cftemplate,destinationFilePath=baseDirectory,baseURL=form.baseURL)>
|
|---|
| 55 | </cfif>
|
|---|
| 56 | </cfif>
|
|---|
| 57 |
|
|---|
| 58 | <!--- Since code generation is complete we can stop. --->
|
|---|
| 59 | <cfabort>
|
|---|
| 60 | </cfif>
|
|---|