|
This article introduces DAOFlex, an open-source tool that automates some of the routine tasks in developing Adobe Flex 2 business applications. Specifically, DAOFlex can take a SQL query and a simple Java class and automatically generate, compile, and prepare all required files for the deployment of a data-driven Flex 2 application.
If you're skeptical about code generator claims, then read this article and examine the rich Internet application that we developed using DAOFlex. Hopefully, this article will ignite your interest in code generators and the DAOFlex tool.
Requirements
Important note: Effective with the release of Adobe LiveCycle ES, the Adobe Flex Data Services 2 server product has been rebranded as a Solution Component of LiveCycle ES. This article was written based on Flex Data Services but will likely work as is with LiveCycle Data Services ES. Any articles referring to or using ColdFusion and Flex Data Services are not compatible with LiveCycle Data Services ES. To learn about the new capabilities of LiveCycle Data Services ES, see the tutorials in the LiveCycle Developer Center and read about Adobe LiveCycle Data Services ES.
Eclipse 3.1 IDE with the Flex Builder plug-in installed.
To create the sample application (ZIP, 3.83K), you'll need to provide following programming input:
An SQL statement (or a stored procedure) that generates the data for your application; for example:
select * from Employee where startDt < :someStartDate
The definition of an abstract Java class, annotated with an SQL statement plus a few metatags that specify the name of the database, update requirements, and so forth. For example:
/**
* @daoflex:service pool=jdbc/theriabook
*/
import java.util.List;
public abstract class Employee{
/*
* @daoflex:sql transferType= EmployeeDTO[]
* sql=:select * from Employee where startDt < :startDate ::
* tableName=EMPLOYEE
*
* keyColumns=EMP_ID
* updateWhere=key_and_modified
* /
public abstract List getEmployees(Date startDate);
}
A .properties file that contains everything needed for DaoFlex to establish a JDBC connection to your DBMS.
Running DBMS (MySQL database backup SQL for sample employee table can be found here.)
A build script (supplied in the ZIP file (ZIP, 9.11 MB) that accompanies this article).
DaoFlex Code Generator (JAR, 78.4K) and DaoFlex Run-time libraries (JAR, 12.9K)
Prerequisite knowledge: A basic understanding of Adobe Flex 2, Java syntax, Apache Ant, and SQL.