Remote Synthesis
Search my blog:
Viewing By Entry / Main
Nov 24, 2006

Updates to Flex Powered Code Generator

You asked for it, and you got it! I updated the recently released Flex-ified version of my code generator with some of the most requested features. You can get the latest version under the branches in subversion or by clicking the download link for this post. Here are the new features:
  • Save to File - you can now click to save files directly to your site files; if the directories don't exist, they will be created for you.
  • CFProperty tags in bean for Flex integration of generated code
  • ActionScript Value Object Template for Flex integration of generated code
  • MySQL type fixes generously donated by Jared Rypka-Hauer
  • More detailed docs on how to install and use

I think I am considering this feature complete for the moment, perhaps for a 1.0 release. For the moment, the HTML version of the code is still the primary download in the trunk of Subversion, but that will be changing soon depending on how further testing goes with the Flex version.

As always, if you have bug fixes or new templates to contribute, please feel free to submit them, and if you love this software and it saves you time, I gladly accept iTunes gift certificates :)

Download the attachment.

Comments
Josen Ruiseco
I'm still having trouble getting this to work. I am getting the messages as follows:

Send failed
Client.Error.MessageSend
Fault occured in GetTemplateCommand

Send failed
Client.Error.MessageSend
Fault occured in GetTemplateCommand

I am running CF 7.0.2 and Sql Server Express 2005. I have one Sql DSN setup in Windows ODBC and in CF ODBC.

I ran the code snippet <cfdump var="#createObject('component','cfcgenerator.com.cf.model.generatorRemote').getDSNs()#"> in the test.cfm file as you suggested. It comes back with the following:

component cfcgenerator.com.cf.model.datasource.datasource
GETDSNNAME function getDsnName
Arguments: none
Return Type: string

Roles:

Access: public

Output: false


GETDSNTYPE function getDsnType
Arguments: none
Return Type: string

Roles:

Access: public

Output: false


INIT function init
Arguments:
Name Required Type Default
dsnName Optional string [empty string]
dsnType Optional string [empty string]

Return Type: cfcgenerator.com.cf.model.datasource.datasource

Roles:

Access: public

Output: false


SETDSNNAME function setDsnName
Arguments:
Name Required Type Default
dsnName Optional string [empty string]

Return Type: void

Roles:

Access: public

Output: false


SETDSNTYPE function setDsnType
Arguments:
Name Required Type Default
dsnType Optional string [empty string]

Return Type: void

Roles:

Access: public

Output: false


SETDBMS function setDbms
Arguments: none
Return Type: void

Roles:

Access: public

Output: false


GETDBMS function getDbms
Arguments: none
Return Type: any

Roles:

Access: public

Output: false


Any help is appreciated.


Brian Rinaldi
Josen, Clearly Flex and CF are not talking on whatever environment you are testing on. Have you run any other Flex apps? The getDSNs is returning at least one datasource object it appears, but the Send Failed indicates that Flex and CF are not seeing each other. I am not sure what else to tell you other than to make sure that Flex support is enabled in your CF admin and check to see if you can run anything else using Flex connecting to CF. Let me know if I can be of any other assistance.


Josen Ruiseco
Brian, I removed and re-installed CF and now everything is good.

Thanks!


Brian Rinaldi
Just to note that the existing download has a bug in the getTables() function in com/cf/model/datasource/oracle.cfc, the returntype should be array. This bug has been corrected in svn and I have updated the zip.


Aaron Roberson
Brain,

I have ColdFusion 7.0.2 and MySQL 5 but I am getting the same errors as the others:

error executing database query
server.processing
fault occurred in GetTablesCommand

This happens when the app is first loaded in the browser and when I select different databases. It did list the databases but it will not list any tables.

Is there something I am missing? Do I need to install Flex Builder or the Flex 2 SDK or dataservices?

Thanks for your hard work!


Aaron Roberson
I got it!!!

I had to completely uninstall ColdFusion and MySQL, download ColdFusion 7.0.2 and MySQL 5 and reinstall. I also downloaded and installed Flex Builder 2.

Wow, those downloads were huge and for some reason they kept freezing half way through. A couple of times they even got to 80% and 90% before I had to start all over. Also, it is a good thing I backed up my database before I uninstalled MySQL and reinstalled it...

So it was a real pain and required a lot of work to get running, but creating beans, DAOs, gateways and services in a snap will pay off. It really only should have taken two easy steps, as Brian outlined. I think the problem really was with ColdFusion - for some reason it required being uninstalled and then reinstalled.

Awesome App Brian. You're Awesome!


Brian Rinaldi
Glad you liked it and sorry for all the trouble. It is interesting however that you are the second person to tell me they had to uninstall and reinstall CF to get the Flex connectivity going...wonder what is the deal with that?


Aaron Roberson
I am loving it already!

FEATURE REQUEST:
It would be really nice if there was a check box for selecting duck typing so that each method omitted the return type attribute, and each argument omitted the type attribute.

Also, as a best practice, it is not necessary to specify both the default and required attribute if the argument is not required. If the argument is not required I usually just specify default="" and omit the required attribute altogether. Visa versa is acceptable as well, but does not take advantage of the ability to parameterize the arguments. For obvious reasons, it is also true that you should not specify a default value if the argument is required.

If I had the source I would try to go in and make these changes myself - but I don't think that you have released the source and you could probably do it quicker anyways.


Write your comment



(it will not be displayed)