The following extensions are automatically installed with ColdFusion Builder if you selected the Install Extensions option when creating a server. For more information, see Adding ColdFusion servers.

  • Adobe CFC Generator
  • ActionScript Class Generator

The information covered here discusses how to use these extensions. It does not cover information about developing the extensions.

Note:

The extension user interface is rendered in the default browser of your computer. If you want to specify the browser as Mozilla, go to the Preferences dialog box and select ColdFusion > Extensions. Then, select Use Mozilla Browser For Extensions.

Adobe CFC Generator

The Adobe CFC Generator generator generates ORM CFCs (ColdFusion Components) from database tables. The Adobe CFC Generator extension lets you create a traditional CFC or an ORM CFC from a set of tables.

Object Relational Mapping (ORM) is a programming technique that lets you define a mapping strategy to store and retrieve data from a relational database using object models. The Adobe CFC Generator lets you define the mapping for relations, specify join conditions, and generate services for the CFCs. For more information about ORM, see ColdFusion ORM.

Install Adobe CFC Generator

The Adobe CFC Generator extension is installed with ColdFusion Builder, if you selected the Install Extension option when creating a server.

If you did not install the extension when creating a server and want to install it now, see Install and uninstall extensions. The Adobe CFC Generator extension archive file (AdobeCfcGenerator.zip) comes packaged with ColdFusion Builder. The archive file is in the Extensions directory within the ColdFusion Builder installation.

Use Adobe CFC Generator (in ColdFusion Builder 2.0)

  1. In the ColdFusion Builder perspective, select RDS Dataview.

  2. If you have configured an RDS user name and password, specify the RDS user name and password.

    Note:

    You set the RDS password in the ColdFusion Administrator. Do not confuse the RDS password with the ColdFusion Administrator password, which is also managed through the ColdFusion Administrator.

  3. The list of data sources available in the configured server are listed.

  4. Select a data source and the table for which you want to generate CFCs. You can select multiple tables at once by pressing Shift and selecting the table names.

  5. Right-click the selected tables, select Adobe CFC Generator, and select one of the following options:

    Note:

    The Adobe CFC Generator option appears only if you right-click a table name. Clicking the data source or records within the data source does not show these options.

  • Create CFC Generates a ColdFusion component.
  • *Create ORM CFC * Generates an ORM CFC and maps it to the database.

Create CFC

  1. Right-click a table in the selected data source, for example, APP.EMPLOYEES table, and select Adobe CFC Generator > Create CFC.

  2. In the Adobe CFC Generator dialog box, do the following:

    • Specify the location to store the generated CFC.
    • Select Generate Service to automatically generate methods.

You can modify the CFC source code to provide additional functionality.

Create ORM CFC

  1. Right-click a table in the selected data source, for example, APP.EMPLOYEES table, and select Adobe CFC Generator > Create ORM CFC.

  2. Specify the location to store the generated CFCs.

  3. The Adobe CFC Generator dialog box displays the selected database tables and fields in a dynamic, editable, sortable, data grid.

    Note:

    Because the data grid is an Ajax-rich user interface, it can sometimes take a few moments to load.

    You can customize the ORM CFC as follows:

    • Change the CFC Name: You can edit the auto-generated CFC name in the CFC Name field.
    • Change the property name: You can edit the property name in the Property Name field.
    • Change the property type: To edit a property type, click the property type that appears in the Property Type column and select a property type from the drop-down list.
    • Specify the primary key: You can edit the primary key settings by selecting "True" or "False" for the required column.
    • You can include or exclude columns that you want to generate in the CFC by selecting or deselecting the check box next to each column name.
    • Sorting data: You can sort tables and columns that appear in the data grid. The direction of the sort can be either ascending or descending. To sort table names, click the Tables column and select the sort order. To sort column data, click the column heading and select the sort order.
  4. To generate a basic ORM CFC, click the Generate Code link. To define relations and join conditions for the ORM CFC, do the following:

    • In the Relationships data grid, click Insert. A new row is inserted.
    • Click the Relation Name field and enter a name for the relationship. For example, you can define a relationship between the Art table and Artists table.
    • Select the target table from the Target Table drop-down list.
    • Specify the relationship type by selecting the Multiplicity drop-down list.
    • Specify a Link table, if necessary.
    • Click Save.
    • When you define a relationship, define a join condition. To define a join condition for the specified relationship, click the target table that you selected in step 3.
    • Click Insert in the Join Conditions data grid.
    • Select the source field from the Source drop-down list.
    • Select the target field from the Target drop-down list.
    • Click Save.
    • Click the Generate Code link.
  5. In the Navigator view, right-click the folder that contains the CFC and select Refresh. You can modify the CFC source code to provide additional functionality.

Use Adobe CFC Generator (in ColdFusion Builder 2.0.1)

The Adobe CFC Generator has been enhanced in ColdFusion Builder 2.0.1 to provide a better user experience.

  1. In ColdFusion Builder, select RDS Data View. It is assumed that you have added a ColdFusion server in the servers view.

  2. Select tables within a data source for which you wish to generate CFCs.

  3. Right-click on selected tables within the data source and then select Adobe CFC Generator > Create ORM CFC.

  4. You can choose to generate services and scripts CFCs by selecting appropriate options. When Generate Services option is selected, CRUD (create, read, update, and delete) operations are created for each selected table. Scripts CFC allows you to generate code in Scripts style instead of tags.

  5. Specify the location to store the generated CFCs.

  6. The Adobe CFC Generator displays the selected tables along with their fields.

Adobe CFC Generator dialog box

Move table

On the Adobe CFC Generator, click the table header and drag to move a table.

Edit table

  1. Double-click the table header to display the Table Editor.

  2. You can now do any of the following:

    • If necessary, you can change the name of the CFC.
    • Click property name to edit it.
    • Click the property-type you wish to change and select from the drop-down list.
    • Individually select/unselect table fields using the check box (first grid column). If not selected, the property is not created for that field. If no field is selected in the table, then the CFC for that table is not generated.

Create, edit, and delete relationship

  • To create a relationship between two fields of different tables, drag one field on to other. This displays a connector between the two connected fields..
  • Double-click the connector to edit the relationship on the Edit Relationship screen dialog box.
  • Select to create property for both primary and foreign key.
  • Set cardinality of relationship at each end and specify relationship name.
  • (For many-to-many relationship) Select a link table from the drop-down list.
  • To edit conditions of relationship, click the field that you want to edit.
  • To add new condition, click the last empty row of the table.
  • To delete relationship, click the X mark in the last column of the table.
  • Click the circle in the middle of the linking line to delete the relationship.

AS Class Generator

The AS Class Generator generates ActionScript classes with or without offline metadata. Offline metadata is a part of the ColdFusion-AIR offline integration feature of ColdFusion. You can generate ActionScript classes either from a CFC or directly from a database table.

Install AS Class Generator

The AS Class Generator extension is installed with ColdFusion Builder, if you selected the Install Extension option when creating a server.

If you did not install the AS Class Generator extension when creating a server and want to install it now, use the AS Class Generator extension archive file (ASClassGenerator.zip). The AS Class Generator extension archive file comes packaged with ColdFusion Builder and is in the Extensions directory within the ColdFusion Builder installation. For more information on installing an extension, see Install and uninstall extensions.

Use AS Class Generator

The AS Class Generator application is available at the following levels:

  • RDS Dataview view
  • Project Navigator view

AS class generation is supported in the following scenarios:

  • From a database table
  • From a CFC You can generate the AS class from either an ORM CFC or a traditional CFC.

AS Class Generation from a database table

  1. In the ColdFusion Builder perspective, select RDS Dataview.

  2. If you have configured an RDS user name and password, specify the RDS user name and password.

    Note:

    You set the RDS password in the ColdFusion Administrator. Do not confuse the RDS password with the ColdFusion Administrator password, which is also managed through the ColdFusion Administrator.

  3. The list of data sources available in the configured server are listed.

  4. Select a data source.

  5. Right-click a table in the data source and select Generate AS Class from DB Table > Generate AS Class.

    Note:

    The Generate AS Class from DB Table option appears only if you right-click the table name. Clicking the data source or records within the data source does not show these options.

  6. Enter the following details in the Generate AS Class dialog box.

  • Specify or select a location to store the ActionScript class files.
  • Select the Include AS Metadata Tags check box to include the following metadata tags:
  • [RemoteClass] Maps the ColdFusion CFC or Java objects on the ColdFusion server with the generated ActionScript class
  • [Entity] Indicates that the generated ActionScript class has to be persisted to the AIR SQLite database as a table. This tag is a ColdFusion-AIR offline integration tag.
  • [Id] Specifies the AS Class property as a primary key after the ActionScript class is persisted to the AIR SQLite database table.
  • Enter the path to the remote CFC class using dot notation relative to the web root. For example, if the path to the CFC is C:\ColdFusion9\wwwroot\CFProj\xyz.cfc, the dot notation path is CFProj.xyz

Note:

This entry is ignored if you have not selected the AS Metadata Tags check box.

  • Enter the name of the package. The naming convention is the same as the ActionScript naming convention.
  1. The ActionScript Class file is created with the naming convention databasetablename.as

Reviewing the generated ActionScript Class file

The following code is an example of an ActionScript class file - Employees.as that is generated from the Employees table in the cfdocexamples data source.

Code Description
package package1 The package is created with the name “package1”
[RemoteClass(alias="cfproj.xyz")] The ActionScript Class maps with cfproj/xyz.cfc on the server.
public class EMPLOYEES
{
[Id]
public var EMP_ID:int;
public var FIRSTNAME:String;
public var LASTNAME:String;
public var EMAIL:String;
public var PHONE:String;
public var DEPARTMENT:String;
public var LOCATION:String;
public var IM_ID:String;
public function EMPLOYEES()
{
}
}
The class name is the same as the database table name. Each property in this class corresponds to a column in the Employees database table. The data type of each property is mapped automatically after introspecting the column data type.

AS Class Generation from CFC

From an ORM CFC

  1. Create an ORM CFC.

  2. In the Project Navigator, right-click the ORM CFC and select Generate AS Class from CFC > Generate AS Class.

  3. Enter the following details in the Generate AS Class dialog box.

    • Specify or select a location to store the ActionScript class files.
    • Enter the name of the package. The naming convention is the same as the ActionScript naming convention.
    • Select the Include AS Metadata tags check box to include the [RemoteClass] tag.
    • Select the Include CF-AIR Offline Metadata check box to include the following tags:
    • [Entity]
    • [Id]
    • If the ORM CFC already has the necessary information like, primary key and data type for each property, you need not enter the ColdFusion data source.

From a traditional CFC

  1. In the Navigator view, right-click the CFC and select Generate AS Class from CFC > Generate AS Class.

    Note:

    CFCs for which ActionScript classes are generated must be within the ColdFusion web root.

  2. Enter the following details in the Generate AS Class dialog box.

    • Specify or select a location to store the ActionScript class files.
    • Enter the name of the package. The naming convention is the same as the ActionScript naming convention.
    • Select the Include AS Metadata tags check box to include the [RemoteClass] tag.
    • Select the Include CF-AIR Offline Metadata check box to include the following tags:
    • [Entity]
    • [Id]
    • If the primary key and data type for each property is not specified in the CFC, enter the ColdFusion data source name.

Points to remember

  • For CF-AIR offline integration, column-specific metadata tag [Column] additions are not currently supported. However, you can manually add the column-specific metadata tags after the ActionScript class file is generated.
  • RDS does not provide information about the primary key of a table in the data source. Use the cfdbinfo }}tag to identify the primary key. The {{cfdbinfo }}tag does not support ODBC drivers including Microsoft Access. Hence, for unsupported data sources, you manually define the {{Id column in the generated ActionScript Class file.
  • CFCs for which ActionScript class files are generated must be within the ColdFusion web root.
  • In an ORM CFC, datatype/type is an optional attribute of the {{cfproperty }}tag. If this attribute is not present in the CFC, ActionScript class files are not generated. To ensure that the ActionScript class files are generated, specify the ColdFusion data source. Data type information is retrieved from the database table and the ActionScript class file is created.

Model-Glue Assistant

Model-Glue Assistant is a ColdFusion Builder application that is designed to help you get started with Model-Glue.

Model-Glue is a web application framework to develop ColdFusion web applications.

Prerequisites to use Model-glue Assistant extension

Before you use the Model-Glue Assistant extension, install the following supporting frameworks:

If you already have the supporting frameworks installed on your computer, you do not have to reinstall the frameworks again.

The Model-Glue Assistant is designed to work with Model-Glue version v2.0.304. If the version of Model-Glue on your computer is other than the specified version, update Model-Glue Assistant.

Install Model-Glue Assistant extension

The Model-Glue Assistant extension is installed with ColdFusion Builder, if you selected the Install Extension option when creating a server.

If you did not install the Model-Glue Assistant extension when creating a server and want to install it now, see Install and uninstall extensions. The Model-Glue Assistant extension archive file (ModelGlue Assistant.zip) comes packaged with ColdFusion Builder. The archive file is in the Extensions directory within the ColdFusion Builder installation.

Create a ColdFusion project

  1. Create a ColdFusion project under the web root. See Creating a ColdFusion project for details.

  2. In the Add Existing Sources and Referenced Project dialog box, ensure that you select the ModelGlue Assistant Application check box in the list of Applications.

  3. Once you create the ColdFusion project, right-click the project in the Project Navigator and select Refresh to see the files and folders that are created. The ModelGlue.xml and ColdSpring.xml files in the Config folder are automatically configured for your project.

  4. To check if the Model-Glue Assistant is configured correctly, enter the following URL in your web browser: http://_localhost_/_project name_/index.cfmThe ModelGlue 2.0 web page appears with the message that it is up and running. You see many debug messages that you can comment out; see Debug Trace Toggle for details.

Use Model-Glue Assistant

In the Project Navigator, right-click the configured project and select ModelGlue Assistant. You see the following options. Relevant code is generated for each of following actions.

Add Event

In Model-Glue, when you add an event, you associate a CFM page with the event. When you add an event, the code that is added to the CFM file is typically as follows:

<broadcasts>
<message name="Hello" />
</broadcasts>
<views>
<include name="body" template="dspPhrase.cfm">
<value name="xe.translationForm" value="translationForm" />
</include>
</views>
</event-handler>

The code includes a handler name, a message to broadcast when the event runs, and a view that is associated with a CFM file. 

The Model-Glue Assistant lets you add this code easily as follows:

  1. Right-click the project in the Navigator and select ModelGlue Assistant > Add Event.Enter the following details in the Add Event dialog box.

  2. Enter a name for the event.

  3. Enter a broadcast message, if necessary. The message that you enter is broadcast when the event runs.

  4. Enter a view name.

  5. Enter the location to store the CFM file associated with the view. The location must be a folder or subfolder within the Views folder of the project.

  6. Enter a value name and value, if necessary.

  7. To check if the event is added, enter the following URL in your web browser:

    http://_localhost_/_project name_/index.cfm?event=event name

Model-Glue Assistant displays a default message in the web page. To change this message, edit the CFM file that you associated with the view.

Generated code

Model-Glue Assistant adds an event handler entry to the ModelGlue.xml file.

Debug Trace Toggle

The Debug Trace Toggle functionality lets you toggle the display of the Model-Glue web page between showing the debugging messages and clearing them.

  1. Right-click the project in the Navigator and select ModelGlue Assistant > Debug Trace Toggle.

  2. Enter the following URL in your web browser: http://_localhost_/_project name_/index.cfmThe debugging messages are removed.

  3. To display the debugging messages, right-click the project in the Navigator and again select ModelGlue Assistant > Debug Trace Toggle.

Generated code

Model-Glue Assistant toggles the value of the debug node in the ColdSpring.xml file.

Enable Reactor

For database-related events, Model-Glue works with the Reactor framework. To get Model-Glue working with Reactor, enable Reactor. To enable Reactor, clear comments on the Reactor entries in the ColdSpring.xml file (located in the Config folder of your project).

  • Right-click the project in the Navigator and select ModelGlue Assistant > Enable Reactor.

Generated code

Model-Glue Assistant clears the comments on the Reactor entries in the ColdSpring.xml file.

Creating Scaffolds

Using the Model-Glue Assistant you can create Scaffolds that let you quickly create basic user interfaces to the database table.

  1. In the ColdFusion Builder perspective, select RDS Dataview.

  2. If you have configured an RDS user name and password, specify the RDS user name and password.

    Note:

    You set the RDS password in the ColdFusion Administrator. Do not confuse the RDS password with the ColdFusion Administrator password, which is also managed through the ColdFusion Administrator.

  3. The list of data sources available in the configured server are listed.

  4. Select a data source.

    Note:

    Scaffolds do not support all type of data sources.

  5. Right-click a table in the data source, and select ModelGlue Assistant > Create Scaffold Entry.

    Note:

    The ModelGlue Assistant option appears only if you right-click the table name. Clicking the data source or records within the data source does not show the Create Scaffold Entry option.

    Enter the following details in the Create Scaffold Entry dialog box.

  6. Select the project configured for Model-Glue Assistant.

  7. Enter the data source user name and password.

    Note:

    You set the data source user name and password in the ColdFusion Administrator. The data source password is different from the RDS password and the ColdFusion Administrator password.

  8. Select the data source type from the DB Type drop-down list.

  9. To check if the Scaffold entry is added, enter the following URL in your web browser: http://_localhost_/_project name_/index.cfm?event=table name.list

  10. After verifying that the Scaffold entry is created, you see that the following files are created under the Scaffolds folder in the project:

    • dsp_tablename_.cfm
    • dsp_tablename_List.cfm
    • frm_tablename_.cfm
     

Generated code

  • A Scaffold entry is added to Reactor.xml for the selected table. Table relationships are not added.
  • The Reactor configuration in ColdSpring.xml is updated to point to the correct data source.
  • A Scaffold object entry is added to ModelGlue.xml

Update Model-Glue Assistant

You can update the Model-Glue Assistant extension to the version of Model-Glue and supporting frameworks on your computer.

  1. Go to the location in the web root where you have installed Model-Glue Assistant.

  2. In the Model-Glue Assistant folder, you see a Handlers folder and the ide_config.xml file.

  3. To update the Model Glue Application template files to point to the version of Model-Glue on your computer, edit the modelapp.ini file in the Handlers folder. The code in the modelapp.ini file is as follows:

    <sampleapp name="modelglueapplicationtemplate" location="" />
    </model>

    Specify the absolute path to Model-Glue Application Template folder in the location attribute. For example, location="C:\ColdFusion9\wwwroot\ModelGlueApplicationTemplate"

Model-Glue Assistant performs string-handling operations for code generation. To customize the code generated, you can update the CFM files in the Handler folder, as required.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy