adobe photo shop font download

cs5 web premium cheapest adobe photoshop 7 free download adobe photoshop cs3 v10 download for windows buy cheap download adobe acrobat pdf writer free download for adobe distiller pc

adobe reader download mac osx

cheap adobe photoshop adobe after effects download adobe reader tar gz download buy cheap find free adobe download adobe 8 download

adobe download interuption

photoshop elements buy cheap download adobe reader version 5 download adobe acrobat 9 cheap internet explorer crashes upon adobe download free adobe acrobat software download

download adobe photoshop cs3 rapidshare

buy cheap adobe dreamweaver adobe acrobat 8 update download adobe photoshop cs3 iso file download cheap free adobe 8 download adobe fine reader free download

adobe flash video exporter download

adobe fireworks cheap adobe pagemaker download full free adobe acrobat 7 pro download buy cheap adobe illustrator cs 2 download for windows adobe illustrator crack download

download adobe documents

buy cheap creative suite 4 adobe master collection torrent download where to download adobe acrobat buy cheap adobe photoshop album download free download adobe illustrator cs3 mac

free adobe photoshop software download

Adobe Creative Suite 5.5 buy cheap how do i download adobe reader for free adobe version 5 download cheap download madden 2005 strategy guides to adobe reader for safe and secure free adobe flash download

unable to download adobe acrobat reader

Adobe Flash CS5.5/a> download adobe illustrator cs download adobe acrobat megaupload cheapest freeware adobe acrobat download free software download adobe reader

adobe live motion download

buy cheap Adobe After Effects CS5.5 free safe download of adobe acrobat reader download free adobe acrobat cheapest download a older version of flash player adobe free to download adobe illustrator

adobe photoshop cs 3 download

adobe software cheap download adobe acrobat reader free adobe reader slowenian download cheapest adobe acrobat 6 full download adobe acrobat 6 pro download

free trial download adobe photoshop mac

creative suite 5 cheapest download record adobe flash movie adobe patch download cheapest internet explorer crashes upon adobe download adobe flashplayer active x download

get free download of adobe flash cs3

buy online adobe incopy adobe photoshop download discount software download adobe 9 free cheap acrobat reader adobe download download the adobe photoshop cs2 book for digital photographers

adobe reader kostenloser download

adobe creative suite 5 cheap adobe 7 free download adobe premiere download cheapest adobe acrobat download vista where to download adobe acrobat

download trial version of adobe acrobat 8 professional

cheap photoshop lightroom 3 download stand alone adobe flash adobe flash palyer download cheap adobe acrobat viewer download free adobe professional download

adobe download

buy online cs5 master collection free download adobe acrobat reader professional 6 cracked adobe indesign cs2 mac download cheap adobe pdf printer download download adobe premiere pro cs3

free adobe acrobat writer download

buy online adobe premiere pro adobe cs3 patch download free adobe flshplayer 9 download buy online free adobe premiere download adobe acrobat pdf writer download

adobe illustrator and download

adobe web premium buy online download free edition adobe photoshop instructions on how to download documents on to adobe reader buy online adobe illustrator cs download adobe flash player downloader free download hunter grabber

Adobe ColdFusion Builder Team blog!!


The Adobe ColdFusion Builder team have started a new blog – http://blogs.adobe.com/cfbuilder/ where the team blogs about the features of the new Adobe ColdFusion Builder, tips and tricks, and more.  There are quite a few interesting posts out there already.  Do check it out.


Bloggers in ColdFusion Product Team


During CFUG presentations, many people had asked me to post a list of bloggers in ColdFusion Product Team.  I am sure most of them already are following a few of the blogs.  Here is the current list:

Adam Lehman: http://www.adrocknaphobia.com/
Bhakti Pingale: http://ajaxforyou.blogspot.com/
Ben Forta: www.forta.com
Jayesh Viradiya: http://askjayvir.blogspot.com/
Josh Adams: http://blog.joshuaadams.com/
Kristen Schofield: http://www.webbschofield.com/
Manjukiran Pacchhipulusu: www.manjukiran.net
Rakshith: http://www.rakshith.net/
Rupesh Kumar: http://www.rupeshk.org 
Sagar Ganatra: http://sagarganatra.blog.com/
Sandeep Paliwal: http://sandeepp.org/blog/
Sankaram Tata: http://sankaramt.wordpress.com/
Terrance Ryan: http://www.terrenceryan.com/blog/

Enjoy!!


ColdFusion-ORM: Define One-to-Many and Many-to-one relationships


Task:
Example to demonstrate how to establish one-to-many and many-to-one Relationships in ColdFusion-ORM

Previous Related Posts:
Getting Started with ORM
ColdFusion-ORM: Using CRUD Functions

Stuff that you would learn:
-  how to establish a One-to-Many relationship between 2 CFCs.
-  how to establish a Many-to-One relationship between 2 CFCs.
-  how to do CRUD operations with CFCs which have a relationship.
-  how to use the implicit relationship methods added by ColdFusion.
-  cascade insert and delete

Steps to Run the example:
-  This example needs the cfartgallery datasource. This is shipped with ColdFusion by default.
-  Create a directory say "1tonorm" under webroot.
-  Create the following files – Application.cfc, Art.cfc, Artists.cfc and index.cfm.
-  Run the URL http://localhost:8500/1tonorm/index.cfm

I have interspersed the example with a lot of comments. You can understand the concept by just following the comments starting with Application.cfc and then Artists.cfc and then Arts.cfc and then index.cfm.

Application.cfc

component
{
    //Name of the application
    this.name = "ORM_One2Many";

    //ormenabled should be set to true so that ORM is enabled for this application
    this.ormenabled = "true";

    //Set the datasource that needs to be used by the ORM Functions.
    this.datasource = "cfartgallery";
}

Artists.cfc

component persistent="true"
{
    property name="artistid" generator="increment";
    property firstname;
    property lastname;
    property address;
    property city;
    property state;
    property postalcode;
    property email;
    property phone;
    property fax;
    property thepassword;

    /*
    Artists have many arts and henace they form a one-to-many relation. The idea is to have all
    the arts as an array of art objects in each Artists' object.

    Set fieldytpe="one-to-many".

    Specify CFC="Art" to convey that the relationship is with Art.cfc.

    fkcolumn="artistid" to specify the foreign key.  But this is not required if foreignkey constraint
    is defined in the database - ColdFusion-ORM will figure it out by inspecting the database.

    cascade="all-delete-orphan": "all" signifies that all the CRUD operations will be cascaded to the
    related objects. "delete-orphan" means that it will delete the orphan objects in the art array
    i.e. if i remove an art from the arts array, it is now an orphan as it has no artist associated
    with it and hence will be automatically deleted.

    Implit Methods:    When a one-to-many relationship is established, the following implicit methods are introduced
    into the artist object:
    void addart(<artobj>) - used to add a art object to the relationship.
    boolean removeart(<artobj>) - used to remove the art object from the relationship.
    boolean hasart() - to check if there are any art objects in the artist object.
    boolean hasart(<artobj>) - to check if the input art object is present in the artist object.

    singularname: Use this attribute to specify custom name to the above implicit methods.

    type=array: To retrieve the arts objects as an array.  If type="struct", then the arts objects are retrieved as
    key-value pairs.  structkeycolumn and structkeytype should be specified in addition to all the above attributes
    to retrieve arts as key-value pairs.

    inverse=true: In a bi-directional relationship like this, you should specify one of the side as the controlling side
    which will set the relationship.  Usually, in a one-to-many bi-directional relationship, the many-to-one side should
    be the controlling side.  To do that, set inverse=true on this side (one-to-many side).
    */
    property name="arts" type="array" fieldtype="one-to-many" cfc="Art" singularname="art" fkcolumn="artistid"
    inverse="true" cascade="all-delete-orphan";
}

Art.cfc

component persistent="true"
{
    property name="artid" generator="increment";
    property name="artname";
    property name="price";
    property name="largeimage";
    property name="mediaid";
    property name="issold";  

/*
  Many arts have an artist and hence form a "many-to-one" relation.

  To establish a "many-to-one" relation, set fieldytpe="many-to-one"

  Specify CFC="Artists" to convey that the relationship is with Artists.cfc.

  fkcolumn="artistid": Used to specify the foreign key.

  missingRowIgnored: If the value is true, and the row that is referenced by the foreign
  key is missing, it is treated as a null association.
*/
    property name="artist" fieldtype="many-to-one" fkcolumn="artistid"
    cfc="Artists" missingRowIgnored="true";
}

index.cfm

<!---
This example will teach you
- how to establish a One-to-Many relationship between 2 CFCs.
- how to establish a Many-to-One relationship between 2 CFCs.
- how to do CRUD operations with CFCs which have a relationship.
- how to use the implicit relationship methods added by ColdFusion.
- Using cascade in one-to-many to many-to-one relationships.

cfartgallery datasource is used for this application.
--->
<cfscript>
    ormreload();

    /*
        Display the existing records in Artists Table.
        This will display the artist and their arts.
    */
    WriteOutput("<b>Initial state of the Artists and Art tables<br></b>");
    DisplayArtists();

    /*
        Create an artist object and 2 art objects
    */
    newArtist = new Artists();
    newArtist.setfirstname("Daniel");
    newArtist.setlastname("Richard");

    newArt1 = new Art();
    newArt1.setArtName("Champions");

    newArt2 = new Art();
    newArt2.setArtName("Isolate");

    /*
        Associate the Arts to the Artist.  Notice that the
        implicit-relationship method - addArt is called.
    */
    newArtist.addArt(newArt1);
    newartist.addArt(newArt2);

    /*
        The one-to-many relationship should be established from both
        the ends.  Hence set the Artist to the new Arts.
    */
    newArt1.setArtist(newArtist);
    newArt2.setArtist(newArtist);

    /*
        Save the new artist. Note that EntitySave will save the artist as
        well as the associated arts as well (cascade-insert)
    */
    EntitySave(newArtist);
    ormflush();

    /*
        Display the existing records to check whether insert succeeded.
    */
    WriteOutput("<b>State of the Artists and Art tables after insert.  Notice that the new
                artist - Daniel Richard is added with his arts 'Champions' and 'Isolate'<br></b>");
    DisplayArtists();

    /*
        Remove newArt2 and add newArt3.  In a way, you are just modifying the 'arts' array.  Notice that
        we are using the implicit=relationship method - removeArt is called.
    */
    newArt3 = new Art();
    newArt3.setArtName("Holiday");
    newArt3.setArtist(newArtist);
    newArtist.addArt(newArt3);
    newArtist.removeArt(newArt2);
    ormflush();    

    /*
        Check if delete and update of art succeeded.
    */
    WriteOutput("<b>State of the Artists and Art tables after Deleting/Updating his Arts.  Notice that
                    the art 'Isolate' is removed and the art 'Holiday' is added.<br></b>");
    DisplayArtists();

    /*
        Delete the Artist.  Note that EntityDelete will delete
        the Artist as well as the associated arts. (cascade-delete).
    */
    EntityDelete(newArtist);
    ormflush();

    /*
        Check if delete succeeded.
    */
    WriteOutput("<b>State of the Artists and Art tables after deleting the Artist.
                Notice that the artist 'Daniel Richard' is deleted.  All his arts are also deleted!<br></b>");
    DisplayArtists();

    /*
        A Utility function to display artists and his arts
    */
    function DisplayArtists()
    {
        query1 = new Query();
        query1.setSQL("select ArtistID, firstname, lastname from Artists where ArtistID>10");
        WriteDump(query1.execute().getresult());

        query1.setSQL("select ArtID, ArtName, ArtistID from Art where ArtID>50");
        WriteDump(query1.execute().getresult());
    }
</cfscript>

del.icio.us Tags: ,,