Compound Theory

v2.0

Categories

  1. Transfer
  2. ColdFusion
  3. Java
  4. ColdSpring
  5. Conduit
  6. JavaLoader
  7. ColdDoc
  8. AsyncHTTP
  9. OO Analysis and Design
  10. Flex
  11. Railo
  12. Hibernate
  13. ColdFusion Builder
  14. XML / XSL
  15. XHTML / CSS
  16. Ubuntu
  17. Eclipse
  18. Oracle Database
  19. Usability / UI Design
  20. cf.Objective()
  21. webDU
  22. cf.Objective(ANZ)
  23. Captcha
  24. MAX
  25. Melbourne CFUG
  26. Martial Arts
  27. Random Things

Recent Posts

Projects

Instant Message

Instantly grab my attention...

Recent Comments

21 March 2007 12:50 PM

Transfer 0.6.3 RC1 is Released

Wow. I have been pushing like crazy the next release of Transfer finished before I fly out for webDU, and I actually made it.  I leave this afternoon for Sydney at 4:00pm, so I am cutting it fine.

This release has 2 great new features, as well as several critical bug fixes, not to mention a greatly expanded documentation, including a new Overview and FAQ.

Rather than try and explain these features all over again, I'm simply going to show off some of the Overview and FAQ:

From the Overview Section:

Transfer Query Language 

There is also a scripting language that allows you to perform database queries based on the information and naming scheme that you set up in your transfer configuration file called Transfer Query Language (TQL).  TQL is very similar to SQL, however since Transfer already knows about the relationships in your system, you don't have to write as much code to perform complicated queries against your database.

For example,  if we wanted to perform a query to list all Posts in my Blog System, with their Author, and all the Categories they belonged to, ordered by the post date we would write this in TQL:

<cfsavecontent variable="tql">
    from
    post.Post as Post
        join system.Category
            join user.User
    order by
        Post.dateTime desc
</cfsavecontent>

And then we would create a Transfer Query Object by passing the TQL to transfer.createQuery(), and then create the actual query we need by passing the Transfer Query Object to transfer.listByQuery(), as in the example below.

<cfscript>
    query = transfer.createQuery(tql);
    qPosts = transfer.listByQuery(query);
</cfscript>

Since Transfer already has the relationships between the Post, Category and User, it can intelligently create the SQL joins for you!  Saving you even more time!

There's another Database Management Method you can use with TQL besides transfer.listByQuery(), and that's transfer.readByQuery(). readByQuery returns a Transfer Object, whereas listByQuery() returns a query. readByQuery() requires TQL that will return only "one row" - if more than one row is returned, an exception is thrown - and it also requires that you specify the class, like all the otherreadBy* methods.

Basically, readByQuery() is a way to create a Transfer Object when you don't want to use the primary key, but specify some other condition that will return only one record.

For more information on these Transfer methods, see Using The Data Management Methods .

From the FAQ:

How do I inject dependencies into a TransferObject?

To inject dependencies into a TransferObject, the 'afterNew' event must be used.  

To register an Observer for the afterNew event:

observer = createObject("component", "InjectorObserver").init(); 

getTransfer().addAfterNewObserver(observer);

The observer must have a method on it that looks like, which is run when the event is fired:

<cffunction name="actionAfterNewTransferEvent" hint="Do something on the new object" access="public" returntype="void" output="false">
    <cfargument name="event" hint="" type="transfer.com.events.TransferEvent" required="Yes">
    <!--- do stuff here --->
</cffunction>

The event is then fired *after* the TransferObject is init()'d and the configure() method is run.

So if you now want to inject something into a TransferObject, you will need to write a setter/getter on it - and you can do it something like this: 

<cffunction name="actionAfterNewTransferEvent" hint="Do something on the new object" access="public" returntype="void" output="false">
    <cfargument name="event" hint="" type="transfer.com.events.TransferEvent" required="Yes">
    <cfif arguments.event.getTransferObject().getClassName() eq "user.User">
         <cfset arguments.event.getTransferObject().setService(getService()) />
    </cfif>
</cffunction>

A <cfcase> statement could be used instead of an <cfif> depending on your needs.

You could put this event directly on a Factory of some description if you  wanted to, or have it on a specific object whose only task is to inject new
TransferObjects with dependencies, depending on your application design.

Full changelog.

A *HUGE* amount of thanks to Nando, Jaime Metcher, and Aaron Roberson for all the hard work they put into the documentation.  It was greatly appreciated.

You may have also noticed a skip in version numbers.  It's okay, you're not going totally crazy.  That was just a decision that I made, to evenly space out all the major feature releases between 0.6.1 and 0.7.

So now the release road map looks like:

0.6.3 : TQL
0.6.6 : Composite Keys
0.6.9 : Soft Deletes
0.7 : All the other small pieces I wanted to fit into 0.7

It also gives me some wiggle room in case I need/want to do a maintenance release between.

Now, I'm off to webDU, and if you are attending, I hope you come and hear me speak!

You can download Transfer from here.

Comments

Posted by todd sharp on 22 May 2007 11:09 PM

Mark: The TransferDoc v0.2 zip (http://compoundtheory.com/download/transfer/transferdoc_v0.2.zip) is empty.

Posted by Mark on 23 May 2007 09:04 AM

@Todd:

Try it now. Somehow the archive had a / before transferdoc, which meant that some archivers couldn't see inside it.

Add Comment