Using predefined data objects classes.

I am always trying to be a better, more efficient Flex developer and I was looking at a project by Christophe Coenraets where he created collaberative forms using Flex/BlazeDS. I saw in his application that he was using multidirectional binding to a Class Object for each form in the application. For example, this is the MortgageApplication.as
package
    import mx.collections.ArrayCollection;
    [Bindable]
    public class MortgageApplication
        public var firstName:String;
        public var lastName:String;
        public var ssn:String;
        public var phone:String;
        public var mobilePhone:String;
        public var email:String;
        public var notify:Boolean;
        public var usCitizen:Boolean;
        public var address:String
        public var city:String
        public var state:String
        public var zip:String
        public var singleFamily:Boolean;
        public var salePrice:Number = 500000;
        public var downPayment:Number = 100000;
        public var closingDate:Date;
        public var jobList:ArrayCollection = new ArrayCollection();
I have an application that I use multiple forms to input information into the database and then I use Objects (actually ObjectProxys) and ArrayCollections to store information to display. I use the Mate Framework and have manager classes that store predefined bindable variables (empty)  that are injected into the view as needed or requested. In the manager class I just create a new ObjectProxy (or ArrayCollection) and use the information passed in (an ArrayCollection from ColdFusion) and create/modify the ObjectProxy/ArrayCollection before having it injected.
Is it better practice or more efficent to predefine object classes (such as above from the example) then just populate them in the manager class before the injection or just create an new blank Object or ArrayCollection on the fly. Is there any difference?
Set up a seperate Class:
package
    [Bindable]
    public class Person
        public var firstName:String;
        public var lastName:String;
        public var phone:String;
and do this in the Manager:
public function setPerson():void {
     var person = new Person();
     person.firstName = "Steve";
     person.lastName = "Smith";
     person.phone = "555.555.1212";
OR just have this declaired in the Manager as
[Bindable] public var person:ObjectProxy;
public function setPerson():void {
     person = new ObjectProxy();
     person.firstName = "Steve";
     person.lastName = "Smith";
     person.phone = "555.555.1212";
Thanks to anyone who wants to help me become a better developer!

ObjectProxy access is significantly slower that data class access.  ObjectProxy will not tell you if you mistype the name of a property and you can spend hours trying to find some place were you typed ssm insead of ssn.

Similar Messages

  • Sorting a vector of objects using attribute of object class as comparator

    i would like to sort a vector of objects using an attribute of object class as comparator. let me explain, i'm not sure to be clear.
    class MyObject{
    String name;
    int value1;
    int value2;
    int value3;
    i've got a Vector made of MyObject objects, and i would sort it, for instance, into ascending numerical order of the value1 attribute. Could someone help me please?
    KINSKI.

    Vector does not implement a sorted collection, so you can't use a Comparator. Why don't you use a TreeSet? Then you couldclass MyObject
      String name;
      int value1;
      int value2;
      int value3;
      // Override equals() in this class to match what our comparator does
      boolean equals (Object cand)
        // Verify comparability; this will also allow subclasses.
        if (cand !instanceof MyObject)
          throw new ClassCastException();
        return value1 = cand.value1;
      // Provide the comparator for this class. Make it static; instance not required
      static Comparator getComparator ()
        // Return this class's comparator
        return new MyClassComparator();
      // Define a comparator for this class
      private static class MyClassComparator implements Comparator
        compare (Object cand1, Object cand2)
          // Verify comparability; this will also allow subclasses.
          if ((cand1 !instanceof MyObject) || (cand2 !instanceof MyObject))
            throw new ClassCastException();
          // Compare. Less-than return -1
          if ((MyObject) cand1.value1 < (MyObject) cand2.value1))
            return -1;
          // Greater-than return 1
          else if ((MyObject) cand1.value1 > (MyObject) cand2.value1))
            return 1;
          // Equal-to return 0.
          else
            return 0;
    }then just pass MyObject.getComparator() (you don't need to create an instance) when you create the TreeSet.

  • Generating Data Object Classes

    Is JDeveloper able to generate object classes from a database table? Example I have a table called car that has color and brand for columns. Can JDeveloper generate the class called CarDO that has the getters and setters for the table called car? If so please help I have several large tables to convert to objects.
    Thanks!

    I recommend you take a look at the JOB extension: http://otn.oracle.com/products/jdev/htdocs/partners/addins/exchange/job/content.html
    HTH,
    Bill

  • Using a Data Object in Place of a Database Connection

    <p>We&#39;ve got about 2000 users that will need to access the same data set for an on-demand report.  We&#39;re using logic at report run time to restrict how much of that data set a given user can see.  We&#39;d like to avoid the stress on our database server of a few hundred people hitting it at the same time.  </p><p>Is there a Crystal or Business Objects object that we can load the data into and then have the report use that object?  The data is only updated on a monthly basis, so loading such an object with the most recent data is a reasonable solution for us.</p>

    <p>Business Objects has a few offerings in this area:<br /></p><p>Business Objects Enterprise, CR Server, CR.com. </p><p> </p><p>All three options will allow you to schedule a report and have your end users viewing only a scheduled instance of a report with Saved data.  </p>

  • Data types and Data object

    Can Any one give me Clear definition of Data type and Data objects.
    Concept i know clearly.. but unable to explain it..
    Regards,
    Prasanna

    Data consists of strings of bytes in the memory area of the program. A string of related bytes is called a field. Each field has an identity (a name) and a data type. All programming languages have a concept that describes how the contents of a field are interpreted according to the data type.
             In the ABAP type concept, fields are called data objects. Each data object is an instance of an abstract data type. Data types in ABAP are not just attributes of fields, but can be defined in their own right. There are separate name spaces for data objects and data types. This means that a name can at the same time be the name of a data   object as well as the name of a data type.
    <b>Data Types:</b>
                     As well as occurring as attributes of a data object, data types can also be defined independently. The definition of a user-defined data type is based on a set of predefined elementary data types. You can define data types either locally in the declaration part of a program (using the TYPES statement) or globally in the ABAP Dictionary. You can use your own data types to declare data objects or to check the types of parameters in generic operations.
             Data types can be divided into elementary, reference, and complex types
    <b>Data objects:</b>
                      Data objects are the physical units with which ABAP statements work at runtime. Each ABAP data object has a set of technical attributes, which are fully defined at all times when an ABAP program is running. The technical attributes of a data object are its length, number of decimal places, and data type. ABAP statements work with the contents of data objects and interpret them according to their data type. You declare data objects either statically in the declaration part of an ABAP program (the most important statement for this is DATA), or dynamically at runtime (for example, when you call procedures). As well as fields in the memory area of the program, the program also treats literals like data objects.
    ABAP contains the following kinds of data objects
      Literals
       Named Data Objects
      Predefined Data Objects
      Dynamic Data Objects

  • Date objects and prepared statements

    Hi, I am trying to parse a String into a Date object with format "dd/MM/yyyy hh/mm/ss". Anyway, i have a method in a separate class which reads in a String and converts it to a formatted Date object.
    static public Date convertToDate(String t) throws ParseException {
    Date dd = new Date();
    ParsePosition p = new ParsePosition(0);
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
    //y, M, etc are retrieved as substrings of String t. I know these methods are deprecated as well
    dd.setYear(y);
    dd.setMonth(M);
    dd.setDate(d);
    dd.setHours(h);
    dd.setMinutes(m);
    dd.setSeconds(s);
    String formattedDate = formatter.format(dd);
    Date theDate = formatter.parse(formattedDate);
    return theDate;
    Anyway, I am trying to use this in an SQL statement because I am using an Access DB which has a field of Date/Time value. Is this correct to use a Date object then? I have a prepared statement -
    PreparedStatement query = connection.prepareStatement(
    "SELECT FText FROM wnioutput WHERE Id = ? AND Section = ? AND Start = " +
    "? AND Field = ?");
    //start is the Date object returned from the previous method in a separate class
    query.setInt(1, id);
    query.setInt(2, section);
    query.setDate(3, formattedStart); - with this part, i get a setDate method not found, or something
    query.setString(4, ch);
    Can anybody tell me what the problem is? I know there are Date objects of java.util and java.sql. Should i be using an sql Date object? And if so, how, and where do I do this? Thank you!

    ok, i just tried
    query.setTimestamp(3, new java.sql.Timestamp(formattedStart.getTime()));
    where formattedStart is a java.util.Date object
    and I get the following error message -
    Error occured in getting endDateAndTime: java.sql.SQLException: Exception in databaseDisplay: the error message is:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    java.lang.NullPointerException
    where endDateAndTime is
    // takes in the startDateAndTime as a formatted String (before it is converted into a Date object)
    public String getEndTime(int s, int ID, String stDateAndTime) {
    String end = null;
    gui g = new gui();
    try {
    String sql = "SELECT End FROM wnioutput WHERE Id = " + ID +
    " AND Section = " + s +
    " AND Start = '" + stDateAndTime + "' AND Field = 'Wind50m'";
    ResultSet result = g.queryDatabase(sql);
    if (result.next())
    end = result.getString("End");
    } catch (SQLException sqlex) {
    System.out.println("Error occured in getting endDateAndTime: " + sqlex.toString());
    return end;
    Although this method worked fine before. So the error is in setting the date object in the prepared statement. Anymore suggestions??

  • How do I reference the data object in a DataGrid to show an image correctly in Acrobat?

    I'm creating an inferface for an Acrobat application  and I'm having a issue with displaying an image in a grid.  When I hard code the source="statusNONE.png" it works as intended (with an image, not the image associated with each grid item), however, when I try to use the source="{data.@icon}" to reference the dataProvider (XMLListCollection) I get nothing.  Not a broken image or anything.  I think I may just not be referencing the XMLListCollection correctly, otherwise I don't know why it would work with hard coding vs. fetching the string from the XML.
    //Application Header (Flex 4.5)
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                     xmlns:s="library://ns.adobe.com/flex/spark"
                                     xmlns:mx="library://ns.adobe.com/flex/mx"
                                     width="100%" height="100%" creationComplete="eaton_creationCompleteHandler(event)"
                                     currentState="Review">
    //Sample of XML that gets used as basis for XMLListCollection
    <Annots>
         <Annot name='TEST' index='14' feedback='' canConstruct='0' icon='statusNONE.png'/>
    </Annots>
    //creation of the XMLListCollection from String
    [Bindable] protected var fullXML:XML;
    [Bindable] protected var fullXMLCol:XMLListCollection;
    protected function loadXML(xmlString:String):void
          fullXML = new XML(xmlString);
         var fullXMLList:XMLList = fullXML.children();
          fullXMLCol = new XMLListCollection(fullXMLList);
    //DataGrid
    <s:DataGrid left="0" top="0" bottom="0" width="142" dataProvider="{fullXMLCol}"
                                            requestedRowCount="4" rowHeight="30"
                                            top.Confirm="87">
                        <s:columns>
                                  <s:ArrayList>
                                            <s:GridColumn dataField="@name" headerText="Annotations"></s:GridColumn>
                                            <s:GridColumn headerText="status" width="30" >
                                                      <s:itemRenderer>
                                                                <fx:Component>
                                                                          <s:GridItemRenderer>
                                                                                    <s:Image width="30" height="30" source="{data.@icon}"/> //THIS IS THE PART THAT SEEMS TO BE GIVNG ME TROUBLE!
                                                                          </s:GridItemRenderer>
                                                                </fx:Component>
                                                      </s:itemRenderer>
                                            </s:GridColumn>
                                  </s:ArrayList>
                        </s:columns>
                        <s:typicalItem>
                                  <fx:Object dataField1="Sample Data" dataField2="Sample Data" dataField3="Sample Data"></fx:Object>
                        </s:typicalItem>
              </s:DataGrid>
    Additional information.  I'm using the resources tab for the flash embedding in Acrobat for my images. This works when I am hard coding the file name string works for the source without having to add a full path, the images are not technically bundled into the swf.   I just don't understand why using the data object to get that same string would show different results.
    tl;dr: GridItemRenderer works to show images when hard coded but not when using {data}.
    UPDATE: Figured it out, needed to add a toString() to the data.@icon.   I had assumed it was a string being handed over, I assumed wrong.

    Probably because data.@icon isn't a String, it is an XMLList, and source property is an Object not a String so the runtime doesn't automatically convert it.
      Try [email protected]()

  • Why is data object completely emptied by XSLT on Output Data Association?

    I have an activity in a BPM 11g workflow that invokes a DbAdapter that does a Select, which may not return any rows in the normal course of processing.  My Data Associations for the Output uses an XSLT to map the returned values into one of my process data objects, accounting for the fact they could be empty because no row was found.
    The problem: While I only mapped one column from the results of the Select into my data object using an XSLT, when no row is returned, all other values are removed from my data object.  I need those to remain intact in the data object.
    Why is that?  How can I prevent that from happening?
    More details...
    Here is a snippet of my XSLT used to grab the result of the Select into my data object.  Notice it only maps docId, does not include totalEarnings or bW2IsAttached.
    <xsl:template match="/">
      <ns1:InterfaceTable>
        <xsl:if test='/ns0:AccountingDataCollection/ns0:AccountingData/ns0:docId != ""'>
          <ns1:docId>
            <xsl:value-of select="/ns0:AccountingDataCollection/ns0:AccountingData/ns0:docId"/>
          </ns1:docId>
        </xsl:if>
      </ns1:InterfaceTable>
    </xsl:template>
    Here's my process data object contents before the DbAdapter activity runs the Select.  Notice it includes docId, totalEarnings and bW2IsAttached.
    <?xml version="1.0" encoding="UTF-8" ?><MyTestData xmlns="http://xmlns.oracle.com/bpm/bpmobject/Data/MyTestData">
       <docId>123456</docId>
       <totalEarnings>100.0</totalEarnings>
       <bW2IsAttached>false</bW2IsAttached>
    </MyTestData>
    Now after the Select runs, and no row is found (which can happen), I end up with this empty data object:
    <?xml version="1.0" encoding="UTF-8" ?><MyTestData xmlns:ns1="http://xmlns.oracle.com/bpm/bpmobject/Data/MyTestData" xmlns="http://xmlns.oracle.com/bpm/bpmobject/Data/MyTestData"/>
    I need the totalEarnings and bW2IsAttached fields to remain in the data object.  How can I do that?

    I tried using the data object as a second data source to map the values back to themselves, but that did not work for some unknown reason.  Perhaps I'll try that again.
    The only reason I'm using an XSLT is to handle the case of no row returned from the DB Select.  So if there is another way to check that, this would be fine.  How can I check using an exclusive gateway for a row returned?  I just tried to create this setup, but the data object containing the row read from the service activity is not available in the gateway for checking.  This would be the ideal solution if you could tell me how to access the data object holding the result of the Select in the gateway.  Thanks!

  • How do you use a TimeZone object?

    Hi,
    When I did this:
    TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
    GregorianCalendar calendar = new GregorianCalendar(tz, Locale.US);
    Date now = calendar.getTime();
    System.out.println(now);I expected the current time on my computer to be converted to the time in Los Angeles--but that didn't happen. The code ouputs the current time on my computer. So, I'm left wondering what a TimeZone object is used for?

    A TimeZone object is used by a Calendar when you ask it to do date and time arithmetic, and when you set its value. If you say "set the time to 4 am" then the code needs to convert that to an offset relative to a time in GMT, and clearly it would need to know what time zone you meant that 4 am to be in.
    But you used a Date object and printed it. Date doesn't have a time zone attribute. Yes, I know you got the Date from a Calendar but since a Date doesn't have a time zone, it can't magically interpret itself in terms of the Calendar you got it from.
    Fortunately SimpleDateFormat does have a time zone attribute. So if you want to print a date interpreted in a certain time zone, that's what you would use. And generally you should use SimpleDateFormat to turn dates into text anyway.

  • _system.date() as a date object?

    My system reports back _system.date() as mm/dd/yy which I
    could easily parse but I understand that the system date format is
    dependent on the user's OS, preference settings, language, mood ;-)
    There’s got to be an easy way to get the system date as a
    date object. I saw in an earlier post that OpenSpark has written a
    bunch of cool calendar math routines but I need to start with
    today’s date as a date object.

    I use JavaScript syntax exclusively anymore, so I use the
    JavaScript syntax Date object. It’s fairly robust and
    x-platform. This is much like ensamblador’s use of the Flash
    Date object. The Flash Date object and the JavaScript syntax Date
    object are both implementations of ECMAScript 262, so it’s
    one of those “six of one half dozen of the other”
    situations. If you are scripting in Lingo then you would need to
    create a Flash object and then instantiate a Date object in it. If
    you’re scripting in JavaScript syntax then just use its
    native Date object. When using the Date object you gotta remember
    that the day of the week – dateObject.getDay() - and the
    month - dateObject.getMonth() – are zero indexed... 0 =
    Sunday, 0 = January etc. When I have to display day names or month
    names I use arrays to store the names I want to display. Also,
    hours are in 24 hour (military) time, so dateObject.getHours()
    would return 16 at 4:27 pm. You can account for that by subtracting
    12 from the returned Hours value if it is greater than 12.
    function exitFrame(me)
    var dObj = new Date();
    var theHour = dObj.getHours();
    var apendTime = " am";
    var dayArray = new
    Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
    var dateArray = new
    Array("January","February","March","April","May","June","July","August","September","Octo ber","November","December");
    var iText = member("infoText");
    ///// show the date textually
    iText.text = dayArray[dObj.getDay()] + " " +
    dateArray[dObj.getMonth()] + " " + dObj.getDate() + ", " +
    dObj.getFullYear();
    ///// mm/dd/yyyy format
    iText.text += "\n" + (dObj.getMonth() + 1) + "/" +
    dObj.getDate() + "/" + dObj.getFullYear();
    ///// show the time like a digital clock
    // 24 hour (military) time
    iText.text += "\n" + theHour + dObj.getMinutes() + ":" +
    dObj.getSeconds();
    // civilian time
    if (theHour > 12)
    iText.text += "\n" + (theHour - 12);
    apendTime = " pm";
    } else {
    iText.text += "\n" + theHour;
    apendTime = " am";
    // the minutes and seconds
    iText.text += ":" + dObj.getMinutes() + ":" +
    dObj.getSeconds() + apendTime;
    _movie.go(_movie.frame);
    }

  • Data Object is performning slow

    I am using a data object which is tied to external view.The datbase view is holding data from multiple table.But from the bam side the entire configuration is functioning slow.Is there any other way by which i can handle this issue.or should i go with integrating ODI with bam for this requirement.

    What is the BAM version?
    Can you provide details on slow performance? What is being shown - how much data are you retreiving?
    Is the External DO (i.e. DB machine) co-located in the same facility or in another network?
    Can you check on the DB EM on how much does the query take i.e. is the time lag in display vs. query?
    Regards
    Payal

  • Problem of update rows in data object

    Hi everybody,
    I got the error message.
    Cannot update rows in data object /Samples/Monitor Express/BI_default_Project1_Process1.java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    Please advise!!!!

    Are you using alterts related to that data object?
    Do you have any open report that uses that data object?

  • Entity Object Classes Example

    Hi,
    Does anyone have an example on how to use Entity Object Class for a given Entity Object (i.e. a table). I was looking for an example that shows usage of a DML operation (say for e.g. insert) using this Entity Object Class.
    I did google, and searched this forum, but could not find an example.
    Please help, Thanks you,
    J
    Edited by: 843190 on Apr 5, 2011 2:13 PM

    Thank you Shay.
    I was searching just a little bit off, and moreover I could not see any end to end example, then. Thanks as always for your guidance.
    I ended up doing the following for inserting a new row to a table using the entity object class as follows:
    EntityDefImpl wmDoc = DocumentImpl.getDefinitionObject();
    DocumentImpl newDoc;
    newDoc = (DocumentImpl)wmDoc.createInstance2(((ApplicationModuleImpl)am).getDBTransaction(), null);
    newDoc.setBlah(blah);
    newDoc.setBlooh(blooh);
    try
    {    ((ApplicationModuleImpl)am).getDBTransaction().commit(); 
    } catch (JboException ex) {   
    ((ApplicationModuleImpl)am).getDBTransaction().rollback();
    throw ex;
    Configuration.releaseRootApplicationModule(am, false);

  • Message class as result data object

    hello brf+ users,
    is it possible to use as Result data object in a Case expression a message from a custom message class?
    thanks
    danilo

    thanks Carsten,
    my requirement can be simplified in
    IF FISCAL CODE
    equals to " " then "001" ENTRY MISSING is returned
    otherwise "000" check ok is returned.
    where 000,001 are domain values of an element (MESSAGE RESULT).
    can i use the message class as result? is there a way to anchor the result to the message class?
    thanks
    danilo

  • Using XML-based object structures to represent data in code/at run-time

    Hello,
    I have quite a "high level" question which has be bothering me for some time, and I haven't found the subject tackled in any books. I believe J2SE/J2EE is not an important divide here.
    Lets say I want to develop a J2SE game application with two programs: a "level designer", and a "level viewer", and I want to store the level files in an XML format.
    My question, and I use this example only to try and illustrate it, is:
    when coding the level designer or viewer, is it reasonable to use an XML-based object hierarchy for representing a level in code/at run-time, i.e. using the standard Java DOM APIs? Or should one (as I would have done before XML came along) develop a set of classes much closer to modelling the real form of a level, and then add a means to convert those objects to/from to XML format?
    This second option of course I would use/would have used if I wasn't thinking about XML, but isn't it sometimes easier to just read in an XML file into a DOM representation and just use the data straight out of that structure, rather than go through the bother of parsing the XML into a set of unrelated objects defined by a different family of classes? What shapes your decision here? And if the second option is best, what is the easiest way of converting to/from the XML?
    Thank you for any advice.
    Greg

    Hi Christian,
    Can I ask: what about if your domain was quite 'close' to an object/DOM representation of XML?
    For instance, what if a game operated by acting out a theatrical script, a spoken conversation, between two characters, perhaps somehow influenced at points by the user, and a particular level was just a different script for the characters.
    One could imagine that the object representation of this would in the end be quite similar to how you'd represent XML, i.e. like a tree of nodes, where each node was a line from the script, and some nodes were a decision point where different nodes could be chosen from.
    Would you still want to avoid using XML-based classes to represent the underlying 'game', or is there a point where you would 'give it' to the similarity and use existing XML structures directly?
    Thank you for any advice
    Greg

Maybe you are looking for

  • Changing fonts in Screen painter

    Hi experts, I have a screen, that displays information. I need to display the information in a different font than usual, e.g. Bold or Italic. Could you please let me know the ways to change the FONTS in screen painter. Is it feasible to do so? Thank

  • Re-Publishing an iWeb site with GoDaddy

    I am having a very frustrating issue when a attempt to re-upload my already made iWeb site onto a domain that I am paying for through GoDaddy. I started the site two years ago with a two year plan for hosting on GoDaddy. Everything was fine for those

  • ITunes Store Preview Script

    I downloaded from "Doug's Scripts" a while back a script that once you ran it would start playing the preview of the first song of an album in the iTunes store, and it would then go to song 2 play it, then 3, and so on... It now does not work in iTun

  • Sharepoint configuration wizard : Unable to configure database due to Microsoft office Infopath

    An exception of type Microsoft.SharePoint.Upgrade.SPUpgradeException was thrown.  Additional exception information: Failed to call GetTypes on assembly Microsoft.Office.InfoPath.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e942

  • Every CC program shuts down immediately after starting

    This happens without any error pop-up, the programs just disappear. I haven't the faintest idea why this is happening and would really appreciate some help.