Mystery of Value Object between Flex and CFC

I ran into a weird issue where Flex was sending a Value Object (VO) to ColdFusion. I currently run ColdFusion 9 on a Windows 2008 Server R2 (64-Bit). When I have the code as follows the VO is transferred to CFC remotely without any issues.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<cfcomponent output="false" alias="com.vo.TestVO">
 
	<cfproperty name="test_id" hint="primary key" type="numeric" />
	<cfproperty name="test_value" hint="some value" type="string" />
 
	<cfscript>
	this.test_id = "";
	this.test_value = "";
	</cfscript>
 
	<cffunction name="init" access="public" returntype=com.vo.TestVO">
		<cfreturn this />
	</cffunction>
</cffunction>

The above value object is sent from Flex to CFC without any issues. However as soon as I put in get and set methods in the VO for some reason I do not receive the VO. See the code below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<cfcomponent output="false" alias="com.vo.TestVO">
 
	<cfproperty name="test_id" hint="primary key" type="numeric" />
	<cfproperty name="test_value" hint="some value" type="string" />
 
	<cfscript>
	this.test_id = "";
	this.test_value = "";
	</cfscript>
 
	<cffunction name="init" access="public" returntype=com.vo.TestVO">
		<cfreturn this />
	</cffunction>
 
        <cffunction name="getTest_id" access="public" output="false" returntype="string">
		<cfreturn this.test_id />
	</cffunction>
 
	<cffunction name="setTest_id" access="public" output="false" returntype="void">
		<cfargument name="test_id" type="string" required="true" />
		<cfset this.test_id = arguments.test_id />
	</cffunction>
 
        <cffunction name="getTest_value" access="public" output="false" returntype="string">
		<cfreturn this.test_value />
	</cffunction>
 
	<cffunction name="setTest_value" access="public" output="false" returntype="void">
		<cfargument name="test_value" type="string" required="true" />
		<cfset this.test_value = arguments.test_value />
	</cffunction>
</cfcomponent>

Unfortunately I did not write the Flex code so I’m not sure what’s happening in the Flex application. Here are my questions.

  1. How does Flex handle the get and set methods from the CFC value objects?
  2. Is get and set necessary if the value object is only used to transfer data between Flex and CFC?
  3. What is the purpose of get and set method?
  4. I see some programmers set it as a variable scope instead of this. Why?

Any help would be much appreciated.

CFLOCATION and onRequestEnd in ColdFusion 9

I discovered recently that when you execute CFLOCATION on ColdFusion 9 the onRequestEnd method in Application.cfc is executed before redirecting the user. Previous to ColdFusion 9 the onRequestEnd method was not invoked prior to CFLOCATION.

My First JIRA

I finally deployed my first JIRA and it was a success. In addition to using JIRA I also integrated Confluence and Crowd. The Crowd was added so I could do a Single Sign-On (SSO) between multiple applications. All of these applications are a product of Atlassian and so far my client loves it. I definitely recommend anyone to try it out. I deployed the application on a IIS7 Windows 2008 R2 Server. There are great documentations from the Atlassian web site on installation and integration with IIS7.

Next is to customize the layout. Wish me luck!

The Future of ColdFusion

I’ve been a ColdFusion programmer since the platform was first invented by Jeremy and JJ Allaire in 1995. Since then the programming language has gone through many changes. The language was originally built in C++ allowing developers to build data driven web pages rapidly. After Allaire Corporation acquisition by Macromedia ColdFusion was rebuilt from the groud up based on the Java EE platform. Later on Macromedia was acquired by Adobe. Through many changes some how ColdFusion have thrived and continue to live on. With the new languages such as PHP, ASP.NET, and Ruby many of the web application programmers have predicted the doom of ColdFusion. But for some reason ColdFusion have not died.

I believe ColdFusion will continue to live on because of the following reason – Service Oriented Architecture (SOA). We could build an interface using Flex, HTML5, JSP, PHP, or ASP.NET and retrieve the data using JSON or Web Services from ColdFusion, PHP, ASP.NET, or Java. The new architecture allows for more flexibility thus providing comprehensive solutions to our clients. For example, I was tasked to import a vehicle inventory data from an outside source while processing hundreds of images and mapping the image data to the inventory data. If I did the entire solution on ColdFusion the image processing alone would have killed the server processor thus I came up with a more elaborate solution as described below.

  • Read and import the data using an ETL tool. We decided to use Pentaho Data Integration tool because it was FREE, portable on any platform, and fairly easy to use.
  • The image processing was done as a scheduled batch job on a separate server. To save on cost we decided to create an instance on the AmazonCloud utilizing Amazon EC2. The platform we chose was Ubuntu and the PHP was used to resize and push the images to the Amazon S3.

In another instance a client wanted to build a vehicle parts inventory system where the system cataloged the parts’ photos while allowing various auto dealerships to re-use the photos for their online parts shopping cart system. Instead of limiting ourselves to ColdFusion as the sole solution the following was implemented.

  • Developed the cataloging interface using Adobe AIR thus allowing the application to be portable in Windows and Mac.
  • The data service layer was built on ColdFusion 9.
  • The parts photo capture, transformation, and extraction was done with a combination of Appcelerator for the iPhone and Android, ColdFusion, and PHP.
  • The online shopping cart solution was purchased from Interspire which allows companies to private label the Shopping Cart then resell the solution as their own product. In addition, the Shopping Cart is mobile browser ready.

“My primary language will always be ColdFusion but that doesn’t mean my solution has to be ColdFusion.”

Please feel free to share your stories where you had to come up with an elaborate solution to combine various technologies.

Our solutions cover range of technologies including ASP.NET, PHP, Java, ColdFusion, Amazon AWS, iPhone and Android development, WordPress and Joomla customization, SQL Server, Oracle, and MySQL