• Home
  • About Me
  • AIR Central
  • AS3 Libs
  • Books
  • Flex Central
  • Resources
  • The Guru's
  •  

    Cairngorm 2 AS3VOGenerator

    July 7th, 2006

    The Cairngorm AS3VOGenerator has been updated to use the new Cairngorm class paths.
    (i.e. com.adobe.cairngorm…..)

    Here is the original updated post:

    http://everythingflex.wordpress.com/2006/02/14/installing-as3vogenerator/


    AS3VOGenerator Update

    April 27th, 2006

    I have updated the Cairngorm and non Cairngorm AS3VOGenerators to implement IUID as well as the neccessary getters and setters for a new private var _uid.  This var is neccessary for components extending from listClasses to function properly when the data is bound to dataGrids, etc.

    In addition to the import statement and implementation of IUID, ere is what was added:
    private var _uid:String;
    public function get uid():String{
    return this._uid
    }
    public function set uid(uid:String):void{
    this._uid = uid;
    }

    Here is the AS3VOGererator and install directions for Hibernate Synchrinizer:

    http://everythingflex.wordpress.com/2006/02/14/installing-as3vogenerator/


    Installing AS3VOGenerator

    February 14th, 2006

    This template should be used with Eclipse 3.1 or higher and Hibernate Synchronizer 3.1.1.

    Open eclipse and go window -> preferences -> Hibernate Synchronizer -> Templates
    Hit New and enter template name AS3VOGeneratorCairngorm or AS3VOGenerator depending on which you choose below.  You can install both as long as they are named differently.
    Click OK and paste the following into your editor:

    CAIRNGORM 2 VERSION
    /*
    * This class has been automatically generated by the EverythingFlex ActionScipt 3 VO Generator template within Hibernate Synchronizer.
    *
    * For more information on ActionScipt 3 VO Generator template, visit The ActionScipt VO Builder page
    * at http://www.everythingflex.com/blog/index.cfm?mode=cat&category_id=68E24EA3-112F-5312-55A176172CDFCC38
    * or contact Rich Tretola at rich@richtretola.com.
    *
    * This is the object class that relates to the ${class.AbsoluteValueObjectSignatureClassName} Java Class
    * @ignore
    */
    package ${class.ValueObjectPackage}{

    import com.adobe.cairngorm.vo.ValueObject;
    import mx.core.IUID;

    [RemoteClass(alias=”${class.AbsoluteValueObjectSignatureClassName}”)]

    [Bindable]
    public class ${class.ValueObjectSignatureClassName} implements ValueObject,IUID {

    // neccessary to make class bindable to components extending from listClasses (datagrids, etc)
    private var _uid:String;

    public function get uid():String{
    return this._uid
    }
    public function set uid(uid:String):void{
    this._uid = uid;
    }

    #if ($class.Id)
    #if ($class.Id.hasExternalClass())
    public var ${class.Id.Property.Name}:Number;
    #else
    #foreach ($prop in $class.Id.Properties)
    #if (${prop.ClassName} == “Date”)
    public var ${prop.Name}:Date;
    #elseif (${prop.ClassName} == “String”)
    public var ${prop.Name}:String = “”;
    #elseif (${prop.ClassName} == “Boolean” || ${prop.ClassName} == “boolean”)
    public var ${prop.Name}:Boolean = false;
    #elseif (${prop.ClassName} == “Byte” || ${prop.ClassName} == “Short” || ${prop.ClassName} == “Integer” || ${prop.ClassName} == “Long” || ${prop.ClassName} == “Float” || ${prop.ClassName} == “Double” || ${prop.ClassName} == “byte” || ${prop.ClassName} == “short” || ${prop.ClassName} == “int” || ${prop.ClassName} == “long” || ${prop.ClassName} == “float” || ${prop.ClassName} == “double”)
    public var ${prop.Name}:Number;
    #else
    // UNABLE TO MAP DATATYPE FOR CLASS ${prop.FullClassName}  PLEASE TELL RICH TRETOLA (rich@richtretola.com) ABOUT THIS
    public var ${prop.Name}:${prop.FullClassName};
    #end
    #end
    #end
    #end
    #if ($class.Version)
    public var ${class.Version.Name}:${class.Version.FullClassName};
    #end
    #if ($class.Timestamp)
    public var ${class.Timestamp.Name}:Date;
    #end
    #if ($class.Properties.size() > 0)
    #foreach ($prop in $class.Properties)
    #if (${prop.ClassName} == “Date”)
    public var ${prop.Name}:Date;
    #elseif (${prop.ClassName} == “String”)
    public var ${prop.Name}:String = “”;
    #elseif (${prop.ClassName} == “Boolean” || ${prop.ClassName} == “boolean”)
    public var ${prop.Name}:Boolean = false;
    #elseif (${prop.ClassName} == “Byte” || ${prop.ClassName} == “Short” || ${prop.ClassName} == “Integer” || ${prop.ClassName} == “Long” || ${prop.ClassName} == “Float” || ${prop.ClassName} == “Double” || ${prop.ClassName} == “byte” || ${prop.ClassName} == “short” || ${prop.ClassName} == “int” || ${prop.ClassName} == “long” || ${prop.ClassName} == “float” || ${prop.ClassName} == “double”)
    public var ${prop.Name}:Number;
    #else
    // UNABLE TO MAP DATATYPE FOR CLASS ${prop.FullClassName}  PLEASE TELL RICH TRETOLA (rich@richtretola.com) ABOUT THIS
    public var ${prop.Name}:${prop.FullClassName};
    #end
    #end
    #end
    #if ($class.Version)
    public var ${class.Version.Name}:${class.Version.FullClassName};
    #end
    #if ($class.Timestamp)
    public var ${class.Timestamp.Name}:Date;
    #end
    #if ($class.ComponentList.size() > 0)
    #foreach ($component in $class.ComponentList)
    public var ${component.Name}:${component.AbsoluteValueObjectClassName};
    #end
    #end
    #if ($class.OneToOneList.size() > 0)
    #foreach ($prop in $class.OneToOneList)
    public var ${prop.Name}:${prop.AbsoluteSignatureClassName};
    #end
    #end
    #if ($class.ManyToOneList.size() > 0)
    #foreach ($prop in $class.ManyToOneList)
    public var ${prop.Name}:${prop.AbsoluteSignatureClassName};
    #end
    #end
    #if ($class.CollectionList.size() > 0)
    #foreach ($prop in $class.CollectionList)
    public var ${prop.Name}:Array;
    #end
    #end

    public function ${class.ValueObjectSignatureClassName}() {
    }
    }
    }

    NON CAIRNGORM VERSION

     /*
    * This class has been automatically generated by the EverythingFlex ActionScipt 3 VO Generator template within Hibernate Synchronizer.
    *
    * For more information on ActionScipt 3 VO Generator template, visit The ActionScipt VO Builder page
    * at http://www.everythingflex.com/blog/index.cfm?mode=cat&category_id=68E24EA3-112F-5312-55A176172CDFCC38
    * or contact Rich Tretola at rich@richtretola.com.
    *
    * This is the object class that relates to the ${class.AbsoluteValueObjectSignatureClassName} Java Class
    * @ignore
    */
    package ${class.ValueObjectPackage}{

        import mx.core.IUID;

    [RemoteClass(alias=”${class.AbsoluteValueObjectSignatureClassName}”)]

    [Bindable]
    public class ${class.ValueObjectSignatureClassName}  implements IUID {

    // neccessary to make class bindable to components extending from listClasses (datagrids, etc)
            private var _uid:String;

    public function get uid():String{
    return this._uid
    }
    public function set uid(uid:String):void{
    this._uid = uid;
    }

    #if ($class.Id)
    #if ($class.Id.hasExternalClass())
    public var ${class.Id.Property.Name}:Number;
    #else
    #foreach ($prop in $class.Id.Properties)
    #if (${prop.ClassName} == “Date”)
    public var ${prop.Name}:Date;
    #elseif (${prop.ClassName} == “String”)
    public var ${prop.Name}:String = “”;
    #elseif (${prop.ClassName} == “Boolean” || ${prop.ClassName} == “boolean”)
    public var ${prop.Name}:Boolean = false;
    #elseif (${prop.ClassName} == “Byte” || ${prop.ClassName} == “Short” || ${prop.ClassName} == “Integer” || ${prop.ClassName} == “Long” || ${prop.ClassName} == “Float” || ${prop.ClassName} == “Double” || ${prop.ClassName} == “byte” || ${prop.ClassName} == “short” || ${prop.ClassName} == “int” || ${prop.ClassName} == “long” || ${prop.ClassName} == “float” || ${prop.ClassName} == “double”)
    public var ${prop.Name}:Number;
    #else
    // UNABLE TO MAP DATATYPE FOR CLASS ${prop.FullClassName}  PLEASE TELL RICH TRETOLA (rich@richtretola.com) ABOUT THIS
    public var ${prop.Name}:${prop.FullClassName};
    #end
    #end
    #end
    #end
    #if ($class.Version)
    public var ${class.Version.Name}:${class.Version.FullClassName};
    #end
    #if ($class.Timestamp)
    public var ${class.Timestamp.Name}:Date;
    #end
    #if ($class.Properties.size() > 0)
    #foreach ($prop in $class.Properties)
    #if (${prop.ClassName} == “Date”)
    public var ${prop.Name}:Date;
    #elseif (${prop.ClassName} == “String”)
    public var ${prop.Name}:String = “”;
    #elseif (${prop.ClassName} == “Boolean” || ${prop.ClassName} == “boolean”)
    public var ${prop.Name}:Boolean = false;
    #elseif (${prop.ClassName} == “Byte” || ${prop.ClassName} == “Short” || ${prop.ClassName} == “Integer” || ${prop.ClassName} == “Long” || ${prop.ClassName} == “Float” || ${prop.ClassName} == “Double” || ${prop.ClassName} == “byte” || ${prop.ClassName} == “short” || ${prop.ClassName} == “int” || ${prop.ClassName} == “long” || ${prop.ClassName} == “float” || ${prop.ClassName} == “double”)
    public var ${prop.Name}:Number;
    #else
    // UNABLE TO MAP DATATYPE FOR CLASS ${prop.FullClassName}  PLEASE TELL RICH TRETOLA (rich@richtretola.com) ABOUT THIS
    public var ${prop.Name}:${prop.FullClassName};
    #end
    #end
    #end
    #if ($class.Version)
    public var ${class.Version.Name}:${class.Version.FullClassName};
    #end
    #if ($class.Timestamp)
    public var ${class.Timestamp.Name}:Date;
    #end
    #if ($class.ComponentList.size() > 0)
    #foreach ($component in $class.ComponentList)
    public var ${component.Name}:${component.AbsoluteValueObjectClassName};
    #end
    #end
    #if ($class.OneToOneList.size() > 0)
    #foreach ($prop in $class.OneToOneList)
    public var ${prop.Name}:${prop.AbsoluteSignatureClassName};
    #end
    #end
    #if ($class.ManyToOneList.size() > 0)
    #foreach ($prop in $class.ManyToOneList)
    public var ${prop.Name}:${prop.AbsoluteSignatureClassName};
    #end
    #end
    #if ($class.CollectionList.size() > 0)
    #foreach ($prop in $class.CollectionList)
    public var ${prop.Name}:Array;
    #end
    #end

    public function ${class.ValueObjectSignatureClassName}() {
    }
    }
    }


    Enter a description if you want and then save the file

    Now right click on your project and click properties
    Select Hibernate Synchronizer and click on Template and then new
    Select the template from the list and paste ${class.ValueObjectClassName}.as as the Output name
    Browse to the place you want the files created
    Check the overwrite box and click save

    Now when you synchronize your hbm.xml files you will get both java file and AS3 as file generation.