In Part 1, you learned how to set up a ColdFusion data source and Flash Builder project. In this section, you will generate the ColdFusion components (CFCs) using ColdFusion Builder. This section is optional, as you can use the CFCs provided in the next section to import into the Flash Builder Data Service. You can skip to the next section, or continue to see how easy it is to generate Object-relational mapping (ORM) components. In Part 3, you will set up a Flash Builder data service project with ColdFusion for use with the Fictitious Sales Planner sample application.
Register the local ColdFusion server in ColdFusion Builder
In this section, you will register the local ColdFusion Server with ColdFusion Builder. This will allow you to access all the data sources on the server from within ColdFusion Builder.
- Open ColdFusion Builder, then click on the Add Server button in the Servers view as shown in Figure 1.
Figure 1. The Add Server button within the Servers view.
- Since you are using a local server, type "localhost" for the name.
- Since you are using a local server, set the host name to "localhost" as well.
- For default installations of the standalone ColdFusion server, the web server port should be 8500.You should be able to ignore the Context Root and Application Server Name fields. These are only needed if using ColdFusion deployed on a J2EE server.
- Enter the RDS User Name and RDS Password you assigned during installation.If you did not specify an RDS username when installing, then the default user name is admin.The Server Settings window should appear as shown in Figure 2.
Figure 2. The Server Settings window.
- Click Next.
- Specify the Server Home directory. This is not the web root. This is the folder into which ColdFusion itself is installed. On Microsoft Windows machines using a local development server, this is likely to be: c:\ColdFusion9 (/Applications/ColdFusion9/ for Mac)
- Enter the Document Root (the web root directory). On Windows machines using a C:\ColdFusion9\wwwroot (/Applications/ColdFusion9/wwwroot/ for Mac)
- From the Version drop-down menu, choose 9.0.x as shown in Figure 3. Note: This step is not available on the MAC version of ColdFusion Builder.
Figure 3. The Local Server Settings window.
- Click Finish.
ColdFusion Builder makes it easy for developers to manage the entire ColdFusion development cycle from concept to production in one easy-to-use tool. In this section you will create a project to hold all the files for the FictitiousSalesPlanner application.
- Select File > New > ColdFusion Project.
- Enter the Project Name “F4CF_FictitiousSalesPlanner”.
- Uncheck the Use Default Location check box. Enter the path for your project in the Project Location field. To find the path, browse to your Document Root folder, likely: C:\ColdFusion9\wwwroot(/Applications/ColdFusion9/wwwroot/ on Mac)Create a new folder inside the Document Root named F4CF_FictitiousSalesPlanner as shown in Figure 4.
Figure 4. The ColdFusion Project Information window.
- Click Next.
- Use the Servers drop down list to select localhost, the server you defined above (See Figure 5).
Figure 5. The Server Details within the New ColdFusion Project window.
- Click Finish.
You can generate the data management services for this application using the ColdFusion Builder CFC Generator. The code will use object-relational mapping (ORM) which will manage the database logic and connectivity without writing any SQL.
- In the RDS view, expand the localhost server to reveal the FictitiousSalesPlanner data tables.
- Select the SALESTARGETS table and right-click.
- Choose Adobe CFC Generator > Create ORM CFC. See Figure 6.
Figure 6. Select Create ORM CFC.
- In the Adobe CFC Generator dialog box, click the Browse button.
- In the Select Folder dialog box, select the FictitiousSalesPlanner folder and click OK (See Figure 7).
- Click OK.
- Within the Create ORM CFC wizard, scroll to the bottom of the page and click Generate Code (See Figure 8). Note: For Mac users, if this page appears blank, then close it, navigate to Preferences > ColdFusion > Extensions and check the box next to Use Mozilla browser for extensions. Click Apply. Click OK. Then repeat from Step 3.
Figure 8. Generate the ORM CFC code.
- You should see a message showing the path of the generated CFCs. Click Close (See Figure 9).
- Within the Navigator view, right-click the FictitiousSalesProject project and select Refresh.
- Expand the project to reveal the generated CFCs.
Where to go from here
In this section, you have learned how to generate the ColdFusion components (CFCs) using ColdFusion Builder. In Part 3, you will set up a Flash Builder data service project with ColdFusion for use with the Fictitious Sales Planner sample application.