Rip's Domain

ICEGen rewritten for version 20050521b

Posted in ICEGen by rip747 on May 22, 2007

If you downloaded ICEGen yesterday (version 20070521), you probably had a hell of a time getting it to work. I accidently uploaded the wrong version (be kind, it’s my first time doing an open source project of this size).

Anywho. Last night I decided to sit down and rewrite probably about 90% of the Coldfusion code and about 20% of the XSL code. I didn’t like how it was coming out and some of the logic that I was using wasn’t the best. The other thing was that the generated XML code was a complete mess when I viewed it in a text editor, it had a lot of spaces and it made it hard to read.

I’m very happy with this rewrite. Some of the things that changed were:

I’m using the StringBuffer Java library to build the XML. I didn’t really do this for speed as I can’t see a speed increase in the app. I did this because it allowed me to control the spaces that the generated XML outputted, so now it’s very readable and easy on the eyes.

I got rid of the way I was doing getters and setters. Before I used a generic get() and set() method where you would pass the property name and value. So if you wanted to set a property you would use set(property, value) and to get you would use get(property) . While it made the classes smaller, it hindered what you could do in a set method and it made creating decorators a nightmare, so now each property has it’s own get and set method.

There’s now an HTML frontend. It’s very basic, but it does what it needs to do. Here you will enter in the name of the datasource that you want to generate code from; I don’t ask for the username and password for the datasource for security reasons. On that note, make sure that the datasource has the username and password set from within the CF Administrator. There’s a drop down to select the database type although you can only select MSSQL for the moment. Once I support more databases the list will grow. Finally you enter in the releative path from your webroot to the folder you want the generated files and folders stored in; for example let’s say you had a folder called “model” off your webroot. In the input box you would enter in “/model”.

The last thing I didn’t was add the ability for you to inject your custom defaults for columns. The reason behind this was because some defaults are just to hard to translate into CF code. An example would be datepart(year, getdate()) for say a paymentyear column. With the custom default you could translate this default into #datepart(“yyyy”, now())#, the pound signs are important since it will take the actually string you put in and assign that as the default. All this can be accomplished be editting the __Customize__.xml file that is located in the base path you specify.

That’s it for now. I’m begging people to send me some suggestions and comments, so get to it! With that, go and download ICEGen and give it a shot.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: