You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by Brian Raymes <br...@teotech.com> on 2021/06/15 22:22:20 UTC

RE: [EXTERNAL] Re: users Digest 15 Jun 2021 21:06:12 -0000 Issue 1717

Let me draw out an example to clarify. Lets assume you have the following:

ArrayList, named records, containing the following:

  GenericDTO
     Attributes (0..n items)
  GenericDTO
     Attributes (0..n items)
  GenericDTO
     Attributes (0..n items)
  GenericDTO
     Attributes (0..n items)
  GenericDTO
     Attributes (0..n items)
  . . .
  GenericDTO
     Attributes (0..n items)

If you bind records list to the datagrid, each row will contain a GenericDTO in order in your records ArrayList.

If you want each row to be a unique attribute, then you will have to transform this ArrayList of GenericDTO’s into another List of Attributes:

I’m not entirely certain of your name/attribute relationship, so you may need to build a small VO to hold these for your list, but the following will put all attributes into a new list that you can bind to your datagrid:

            var attributes:ArrayList = new ArrayList();
            for each (var genericDto:GenericDTO in records)
            {
                for (var key:String in genericDto.attributes)
                {
                    attributes.push(genericDto.attributes.get(key));
                }
            }

With this approach, you’ll have an ArrayList with all Attributes that can be bound to the datagrid. Each row being a single attribute.

As I stated above, you may need to do something like this:

            public class NameAttributeVO
            {
                var name:String;
                var attribute:Attribute;

                public NameAttributeVO(name:String, attribute:Attribute)
                {
                    this.name = name;
                    this.attribute = attribute;
                }
            }

Then the following:

            var attributes:ArrayList = new ArrayList();
            for each (var genericDto:GenericDTO in records)
            {
                for (var name:String in genericDto.attributes)
                {
                    attributes.push(new NameAttributeVO(name, genericDto.attributes.get(name)));
                }
            }

With this approach, you’ll have an ArrayList of NameAttributeVO that can be bound to the datagrid. Each row being a single NameAttributeVO.

So, to summarize, yes, your GenericDTO, if you build the AS3 variant that the Java variant maps to, then yes, you can bind to controls, but, the hierarchy of your data may need to be altered to fit the exact scenario you are trying to achieve. You could also transform this list in your backend too, to avoid the frontend from doing unnecessary work.

If you can provide a visual representation of what you are trying to achieve, I can provide further assistance.


Brian

From: romanisitua@yahoo.com <ro...@yahoo.com>
Sent: Tuesday, June 15, 2021 2:43 PM
To: users-digest@royale.apache.org; users-digest-help@royale.apache.org; users@royale.apache.org
Subject: [EXTERNAL] Re: users Digest 15 Jun 2021 21:06:12 -0000 Issue 1717

Thanks for the feedback. Find my responses to your questions below.

Sent from Yahoo Mail on Android<https://go.onelink.me/107872968?pid=InProduct&c=Global_Internal_YGrowth_AndroidEmailSig__AndroidUsers&af_wl=ym&af_sub1=Internal&af_sub2=Global_YGrowth&af_sub3=EmailSignature>

On Tue, 15 Jun 2021 at 22:06, users-digest-help@royale.apache.org<ma...@royale.apache.org>
<us...@royale.apache.org>> wrote:

users Digest 15 Jun 2021 21:06:12 -0000 Issue 1717

Topics (messages 4752 through 4755)

Error using js:remoteObject
    4752 by: romanisitua.yahoo.com
    4753 by: romanisitua.yahoo.com

Support for GenericDTO
    4754 by: romanisitua.yahoo.com

Re: [EXTERNAL] Support for GenericDTO
    4755 by: Brian Raymes

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: users@royale.apache.org<ma...@royale.apache.org>
To unsubscribe, e-mail: users-digest-unsubscribe@royale.apache.org<ma...@royale.apache.org>
For additional commands, e-mail: users-digest-help@royale.apache.org<ma...@royale.apache.org>

----------------------------------------------------------------------

I am trying to call my blazeds service from royale.
Trying to follow the guidelines specified here

https://apache.github.io/royale-docs/features/loading-external-data/remoteobject

I get the following error:

[onFault]

AbstractMessage.readExternal
Language.as:254 ReferenceError: Error #1056: Cannot create property faultDetail on flex.messaging.messages.ErrorMessage
Language.as:254 ReferenceError: Error #1056: Cannot create property faultCode on flex.messaging.messages.ErrorMessage
Language.as:254 ReferenceError: Error #1056: Cannot create property faultString on flex.messaging.messages.ErrorMessage
Language.as:254 ReferenceError: Error #1056: Cannot create property rootCause on flex.messaging.messages.ErrorMessage
Language.as:254 ReferenceError: Error #1056: Cannot create property extendedData on flex.messaging.messages.ErrorMessage



Code snippets are as follows

 trace(" -- registerClassAlias for royale array list -- ");

                          registerClassAlias('org.apache.royale.collections.ArrayList', ArrayList);

The above was registered at the main application.mxml.

<j:beads>
        <js:ApplicationDataBinding />
        <js:RemoteObject id="service"
        endPoint = "http://localhost:8080/messagebroker/websocket-amf"
        destination = "contactService"
        result="onResult(event)" fault="onFault(event)"/>
    </j:beads>


  trace(" about to call contactService.getContacts ... ");
            service.send("contactService.getContacts", null);


 private function onResult(param0:ResultEvent):void
        {
             trace(" -- onResult oh ! -- ");

        }

        private function onFault(param0:FaultEvent):void
        {
                trace(" -- onFailure oh ! -- ");

                var errorMessage : String = param0.message as String;

                trace(" Error :: " + errorMessage);

                trace("[onFault]", param0);
        }


I am using jewel.

I am tested my blazeds end point using the java amf client. It works fine. This is my first attempt at calling a blazeds end point from royale.


Any ideas ?

I found the solution.

The mistake I made was with the method. I fixed it here

 service.send("getContacts", []);


This source was helpful.

https://github.com/apache/royale-asjs/blob/develop/examples/royale/RemoteObjectAMFTest/src/main/royale/App.mxml


Thanks everyone.



On Tuesday, June 15, 2021, 12:17:11 PM GMT+1, romanisitua@yahoo.com<ma...@yahoo.com> <ro...@yahoo.com>> wrote:


I am trying to call my blazeds service from royale.
Trying to follow the guidelines specified here

https://apache.github.io/royale-docs/features/loading-external-data/remoteobject

I get the following error:

[onFault]

AbstractMessage.readExternal
Language.as:254 ReferenceError: Error #1056: Cannot create property faultDetail on flex.messaging.messages.ErrorMessage
Language.as:254 ReferenceError: Error #1056: Cannot create property faultCode on flex.messaging.messages.ErrorMessage
Language.as:254 ReferenceError: Error #1056: Cannot create property faultString on flex.messaging.messages.ErrorMessage
Language.as:254 ReferenceError: Error #1056: Cannot create property rootCause on flex.messaging.messages.ErrorMessage
Language.as:254 ReferenceError: Error #1056: Cannot create property extendedData on flex.messaging.messages.ErrorMessage



Code snippets are as follows

 trace(" -- registerClassAlias for royale array list -- ");

                          registerClassAlias('org.apache.royale.collections.ArrayList', ArrayList);

The above was registered at the main application.mxml.

<j:beads>
        <js:ApplicationDataBinding />
        <js:RemoteObject id="service"
        endPoint = "http://localhost:8080/messagebroker/websocket-amf"
        destination = "contactService"
        result="onResult(event)" fault="onFault(event)"/>
    </j:beads>


  trace(" about to call contactService.getContacts ... ");
            service.send("contactService.getContacts", null);


 private function onResult(param0:ResultEvent):void
        {
             trace(" -- onResult oh ! -- ");

        }

        private function onFault(param0:FaultEvent):void
        {
                trace(" -- onFailure oh ! -- ");

                var errorMessage : String = param0.message as String;

                trace(" Error :: " + errorMessage);

                trace("[onFault]", param0);
        }


I am using jewel.

I am tested my blazeds end point using the java amf client. It works fine. This is my first attempt at calling a blazeds end point from royale.


Any ideas ?


Hi everyone,

From previous royale (flex) docs. I can see that it is possible to bind ui forms to action script objects (DTO's). i.e actionscirpt classes with public getter and setter methods.

The ORM we are using accepts and returns data as custom generic data transfer objects (GenericDTO). This generic dto is implemented as a hashMap of pojo's (by pojo I mean a java class with public getter and setter methods))

See the example java code snippet below:



public class GenericDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    private Map<String, Attribute> attributes = null;

    private String name = null;

    public GenericDTO(String name) {

        notNull(name, "The name of the DTO cannot be null...");

        this.attributes = new HashMap<String, Attribute>();

        this.name = name;

    }

    public GenericDTO add(String name, Attribute attribute) {

        notNull(name, "Attribute name cannot be null");

        notNull(attribute, "Attribute with name: " + name + " is null!");

        this.attributes.put(name, attribute);

        return this;

    }

........

   // there are getter/setter method to return the HashMap of Attributes and name field.


   The attribute class is the base class of all data types. So we have StringType (for String), IntegerType (for Integer) that extend Attribute.

Class Attribute

public Object getInputValue();

public void setInputValue(final Object object);


Is it possible to bind the generic dto to royale ui controls ? e.g. for example I was able to bind an arrayList of ContactDTO successfully. This contactDTO had name and email as fields with public getter and setter methods as follows

 <j:DataGrid localId="dg1" dataProvider="{contacts}">
            <j:columns>
                 <j:DataGridColumn label="Name" dataField="name" columnWidth="200"/>
                <j:DataGridColumn label="Email" dataField="email" columnWidth="200"/>
            </j:columns>
        </j:DataGrid>


Assuming it is possible to create ActionScript (as3) versions of GenericDTO, Attribute (with subclasses StringType, IntegerType e.t.c). Implementing the appropriate get and set functions.

Is it possible to bind an arrayList of GenericDTO to a royale data grid as follows ?

 <j:DataGrid localId="dg1" dataProvider="{records}">
            <j:columns>
                <j:DataGridColumn label="Name" dataField="{attributes.name.inputValue}" columnWidth="200"/>
                <j:DataGridColumn label="Email" dataField="{attributes.email.inputValue}" columnWidth="200"/>
            </j:columns>
        </j:DataGrid>


i.e. use databinding expressions in the dataField of the data grid ?

How about other royale UI controls ? e.g textFields and numberFields in a UI form.


Regards,

Roman,


To understand your problem a bit better, are you saying you’ll have the following?



ArrayList full of GenericDTO, each with a map of attributes? Binding the ArrayList of GenericDTO to the dataProvider will then use a single instance of GenericDTO for each row.



My response: YES. This is what i want to implement.



It almost seems as if you want rows for attributes, not for each GenericDTO?



 My response: the attribute hashmap that belongs to a generic dto should represent a single row of data in the grid only.



You may have to build a new list that contains all attributes you want to render, or look into building/porting the AdvancedDataGrid from Flex. That allows sub-rows (folders) for situations like this.



As for dataFields in Royale, you have a couple of options. You generally set dataField to a relative path within the row’s data instance. For example,  dataField="someValue" or dataField="someObject.someOtherObject.someValue" in more complex object scenarios.



 My response: This implies that the generic dto can be accessed based on code the snippet I shared. Kindly confirm ?



As you can see, binding isn’t used for dataField.



 My response: Noted. Thanks.



You can also use a custom itemRender to build whatever sub-component you want for each cell. For example, I have Lists/DataContainer where each row can be another List/DataContainer, etc.



 My response: I am not sure I understand the  above scenario you mentioned. Though I will definitely keep this in mind. I just started learning royale.



As for all other controls, yes, you can bind directly to their text/value fields.



FYI, maps, in my experience, or at least with the tools I’m using, turn into AS3 generic Objects. I’m coming from a Flex source base, being ported to Royale. Maps now exist, and may be usable with deserialization.



My response:

I intend to create a generic dto in as3. Then create an as3 object to represent the hashmap. This as3 object will use string as "key" to access the "value" from the as3 object.



To summarise my question, does this imply that the generic dto can be accessed based on code the snippet I shared. Kindly confirm ?





From: romanisitua@yahoo.com<ma...@yahoo.com> <ro...@yahoo.com>>
Sent: Tuesday, June 15, 2021 1:20 PM
To: users@royale.apache.org<ma...@royale.apache.org>
Subject: [EXTERNAL] Support for GenericDTO





Hi everyone,



From previous royale (flex) docs. I can see that it is possible to bind ui forms to action script objects (DTO's). i.e actionscirpt classes with public getter and setter methods.



The ORM we are using accepts and returns data as custom generic data transfer objects (GenericDTO). This generic dto is implemented as a hashMap of pojo's (by pojo I mean a java class with public getter and setter methods))



See the example java code snippet below:







public class GenericDTO implements Serializable {



    private static final long serialVersionUID = 1L;



    private Map<String, Attribute> attributes = null;



    private String name = null;



    public GenericDTO(String name) {



        notNull(name, "The name of the DTO cannot be null...");



        this.attributes = new HashMap<String, Attribute>();



        this.name = name;



    }



    public GenericDTO add(String name, Attribute attribute) {



        notNull(name, "Attribute name cannot be null");



        notNull(attribute, "Attribute with name: " + name + " is null!");



        this.attributes.put(name, attribute);



        return this;



    }



........



   // there are getter/setter method to return the HashMap of Attributes and name field.





   The attribute class is the base class of all data types. So we have StringType (for String), IntegerType (for Integer) that extend Attribute.



Class Attribute



public Object getInputValue();



public void setInputValue(final Object object);





Is it possible to bind the generic dto to royale ui controls ? e.g. for example I was able to bind an arrayList of ContactDTO successfully. This contactDTO had name and email as fields with public getter and setter methods as follows



 <j:DataGrid localId="dg1" dataProvider="{contacts}">

            <j:columns>

                 <j:DataGridColumn label="Name" dataField="name" columnWidth="200"/>

                <j:DataGridColumn label="Email" dataField="email" columnWidth="200"/>

            </j:columns>

        </j:DataGrid>





Assuming it is possible to create ActionScript (as3) versions of GenericDTO, Attribute (with subclasses StringType, IntegerType e.t.c). Implementing the appropriate get and set functions.



Is it possible to bind an arrayList of GenericDTO to a royale data grid as follows ?



 <j:DataGrid localId="dg1" dataProvider="{records}">

            <j:columns>

                <j:DataGridColumn label="Name" dataField="{attributes.name.inputValue}" columnWidth="200"/>

                <j:DataGridColumn label="Email" dataField="{attributes.email.inputValue}" columnWidth="200"/>

            </j:columns>

        </j:DataGrid>





i.e. use databinding expressions in the dataField of the data grid ?



How about other royale UI controls ? e.g textFields and numberFields in a UI form.





Regards,



Roman,



Re: [EXTERNAL] Re: users Digest 15 Jun 2021 21:06:12 -0000 Issue 1717

Posted by "romanisitua@yahoo.com" <ro...@yahoo.com>.
 Hi,
I have attempted the first suggestion. I get undefined in the name and email column of the grid

I decided to check the contents of what was returned programmatically by displaying the content of the first record as follows
private function onResult(param0:ResultEvent):void        {             trace(" -- onResult oh ! -- ");
                         if (param0.data is ArrayList)            {                        trace(" -- arrayList has been returned -- ");
               //  var contactList: ArrayList = (param0.data as ArrayList);                               contacts = (param0.data as ArrayList);
                trace(" -- contactList size: " + contacts.length);
                trace(" is first element a record ?? ")                                  if (contacts[0] is Record)                 {                   var record: Record = (contacts[0] as Record);
                    trace(" name:" + record.name);                    trace(" attributes:" + record.attributes);                                          var attributes:Object = record.attributes;
                     var nameField: String = attributes.name.value;                      var emailField: String = attributes.email.value;
                       trace(" attribute name field:" + nameField);                       trace(" attribute email field:" + emailField);
                 }                 else                 trace(" this is a not record oh !! ");
                            }            else            {                 trace(" -- an arrayList was not returned -- ");            }                    }

From the chrome developer tool log, The first record of the arrayList is retrieved successfully. It displays the name and email address that was sent from the server. 
This implies that blazeds successfully serialized the hashmap of attributes and converted it to an as3 object. 
But for strange reasons the jewel datagrid is unable to display it. it shows undefined. Here is the code snippet.
 <j:DataGrid localId="dg1" dataProvider="{contacts}">            <j:columns>                                <j:DataGridColumn label="Name" dataField="attributes.name.value" columnWidth="200"/>                 <j:DataGridColumn label="Email" dataField="attributes.email.value" columnWidth="200"/>                                        </j:columns>        </j:DataGrid>   

It appears the jewel datagrid is unable to handle the as3 Record object. 
I have attached code snippets for the as3 (client) dto classes and the mxml that makes the remote invocation.


Regards,

    On Wednesday, June 16, 2021, 06:35:58 PM GMT+1, romanisitua@yahoo.com <ro...@yahoo.com> wrote:  
 
 Thanks for the detailed feedback. I have started implementing the as3 classes.
I will try this approach you listed first
 " If you bind records list to the datagrid, each row will contain a GenericDTO in order in your records ArrayList. "
Then share the results here.
Thanks for the help so far.


 


Sent from Yahoo Mail on Android 
 
  On Tue, 15 Jun 2021 at 23:22, Brian Raymes<br...@teotech.com> wrote:   #yiv2199214260 -- filtered {}#yiv2199214260 filtered {}#yiv2199214260 filtered {}#yiv2199214260 filtered {}#yiv2199214260 filtered {}#yiv2199214260 p.yiv2199214260MsoNormal, #yiv2199214260 li.yiv2199214260MsoNormal, #yiv2199214260 div.yiv2199214260MsoNormal {margin:0in;font-size:11.0pt;font-family:sans-serif;}#yiv2199214260 a:link, #yiv2199214260 span.yiv2199214260MsoHyperlink {color:blue;text-decoration:underline;}#yiv2199214260 a:visited, #yiv2199214260 span.yiv2199214260MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv2199214260 p.yiv2199214260msonormal0, #yiv2199214260 li.yiv2199214260msonormal0, #yiv2199214260 div.yiv2199214260msonormal0 {margin-right:0in;margin-left:0in;font-size:11.0pt;font-family:sans-serif;}#yiv2199214260 p.yiv2199214260msonormal, #yiv2199214260 li.yiv2199214260msonormal, #yiv2199214260 div.yiv2199214260msonormal {margin-right:0in;margin-left:0in;font-size:11.0pt;font-family:sans-serif;}#yiv2199214260 p.yiv2199214260msochpdefault, #yiv2199214260 li.yiv2199214260msochpdefault, #yiv2199214260 div.yiv2199214260msochpdefault {margin-right:0in;margin-left:0in;font-size:11.0pt;font-family:sans-serif;}#yiv2199214260 span.yiv2199214260emailstyle18 {}#yiv2199214260 p.yiv2199214260msonormal1, #yiv2199214260 li.yiv2199214260msonormal1, #yiv2199214260 div.yiv2199214260msonormal1 {margin:0in;font-size:11.0pt;font-family:sans-serif;}#yiv2199214260 p.yiv2199214260msonormal2, #yiv2199214260 li.yiv2199214260msonormal2, #yiv2199214260 div.yiv2199214260msonormal2 {margin:0in;font-size:11.0pt;font-family:sans-serif;}#yiv2199214260 span.yiv2199214260emailstyle181 {font-family:sans-serif;color:windowtext;}#yiv2199214260 p.yiv2199214260msochpdefault1, #yiv2199214260 li.yiv2199214260msochpdefault1, #yiv2199214260 div.yiv2199214260msochpdefault1 {margin-right:0in;margin-left:0in;font-size:10.0pt;font-family:sans-serif;}#yiv2199214260 span.yiv2199214260EmailStyle26 {font-family:sans-serif;color:windowtext;}#yiv2199214260 .yiv2199214260MsoChpDefault {font-family:sans-serif;}#yiv2199214260 filtered {}#yiv2199214260 div.yiv2199214260WordSection1 {}#yiv2199214260 
Let me draw out an example to clarify. Lets assume you have the following:
 
  
 
ArrayList, named records, containing the following:
 
  
 
  GenericDTO
 
     Attributes (0..n items)
  GenericDTO
 
     Attributes (0..n items)
 
  GenericDTO
 
     Attributes (0..n items)
 
  GenericDTO
 
     Attributes (0..n items)
 
  GenericDTO
 
     Attributes (0..n items)
 
  . . .
 
  GenericDTO
 
     Attributes (0..n items)
 
  
 
If you bind records list to the datagrid, each row will contain a GenericDTO in order in your records ArrayList.
 
  
 
If you want each row to be a unique attribute, then you will have to transform this ArrayList of GenericDTO’s into another List of Attributes:
 
  
 
I’m not entirely certain of your name/attribute relationship, so you may need to build a small VO to hold these for your list, but the following will put all attributes into a new list that you can bind to your datagrid:
 
  
 
            var attributes:ArrayList = new ArrayList();
 
            for each (var genericDto:GenericDTO in records)
 
            {
 
                for (var key:String in genericDto.attributes)
 
                {
 
                    attributes.push(genericDto.attributes.get(key));
 
                }
 
            }
 
  
 
With this approach, you’ll have an ArrayList with all Attributes that can be bound to the datagrid. Each row being a single attribute.
 
  
 
As I stated above, you may need to do something like this:
 
  
 
            public class NameAttributeVO
            {
 
                var name:String;
 
                var attribute:Attribute;
 
            
 
                public NameAttributeVO(name:String, attribute:Attribute)
                {
 
                    this.name = name;
 
                    this.attribute = attribute;
 
                }
 
            }
 
  
 
Then the following:
 
  
 
            var attributes:ArrayList = new ArrayList();
 
            for each (var genericDto:GenericDTO in records)
 
            {
 
                for (var name:String in genericDto.attributes)
 
                {
 
                    attributes.push(new NameAttributeVO(name, genericDto.attributes.get(name)));
 
                }
 
            }
 
  
 
With this approach, you’ll have an ArrayList of NameAttributeVO that can be bound to the datagrid. Each row being a single NameAttributeVO.
 
  
 
So, to summarize, yes, your GenericDTO, if you build the AS3 variant that the Java variant maps to, then yes, you can bind to controls, but, the hierarchy of your data may need to be altered to fit the exact scenario you are trying to achieve. You could also transform this list in your backend too, to avoid the frontend from doing unnecessary work.


 
If you can provide a visual representation of what you are trying to achieve, I can provide further assistance.
 
  
 
  
 
Brian
 
  
 
From: romanisitua@yahoo.com <ro...@yahoo.com> 
Sent: Tuesday, June 15, 2021 2:43 PM
To: users-digest@royale.apache.org; users-digest-help@royale.apache.org; users@royale.apache.org
Subject: [EXTERNAL] Re: users Digest 15 Jun 2021 21:06:12 -0000 Issue 1717
 
  
 
Thanks for the feedback. Find my responses to your questions below.
 
  
 
Sent from Yahoo Mail on Android
 
  
 

On Tue, 15 Jun 2021 at 22:06,users-digest-help@royale.apache.org
 
<us...@royale.apache.org> wrote:
 
  
 
users Digest 15 Jun 2021 21:06:12 -0000 Issue 1717
 
  
 
Topics (messages 4752 through 4755)
 
  
 
Error using js:remoteObject
 
    4752 by: romanisitua.yahoo.com
 
    4753 by: romanisitua.yahoo.com
 
  
 
Support for GenericDTO
 
    4754 by: romanisitua.yahoo.com
 
  
 
Re: [EXTERNAL] Support for GenericDTO
 
    4755 by: Brian Raymes
 
  
 
Administrivia:
 
  
 
---------------------------------------------------------------------
 
To post to the list, e-mail: users@royale.apache.org
 
To unsubscribe, e-mail: users-digest-unsubscribe@royale.apache.org
 
For additional commands, e-mail: users-digest-help@royale.apache.org
 
  
 
----------------------------------------------------------------------
 
  
 
I am trying to call my blazeds service from royale.
 
Trying to follow the guidelines specified here
 
  
 
https://apache.github.io/royale-docs/features/loading-external-data/remoteobject
 
  
 
I get the following error:
 
  
 
[onFault] 
 
  
 
AbstractMessage.readExternal
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultDetail on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultCode on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultString on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property rootCause on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property extendedData on flex.messaging.messages.ErrorMessage
 
  
 
  
 
  
 
Code snippets are as follows
 
  
 
 trace(" -- registerClassAlias for royale array list -- ");
 
  
 
                          registerClassAlias('org.apache.royale.collections.ArrayList', ArrayList);
 
  
 
The above was registered at the main application.mxml.
 
  
 
<j:beads>
 
        <js:ApplicationDataBinding /> 
 
        <js:RemoteObject id="service"
 
        endPoint = "http://localhost:8080/messagebroker/websocket-amf"
 
        destination = "contactService"
 
        result="onResult(event)" fault="onFault(event)"/>      
 
    </j:beads>
 
  
 
  
 
  trace(" about to call contactService.getContacts ... ");
 
            service.send("contactService.getContacts", null);
 
  
 
  
 
 private function onResult(param0:ResultEvent):void
 
        {
 
             trace(" -- onResult oh ! -- ");
 
  
 
        }
 
  
 
        private function onFault(param0:FaultEvent):void
 
        {
 
                trace(" -- onFailure oh ! -- ");
 
  
 
                var errorMessage : String = param0.message as String;
 
  
 
                trace(" Error :: " + errorMessage);
 
  
 
                trace("[onFault]", param0);
 
        }
 
  
 
  
 
I am using jewel.
 
  
 
I am tested my blazeds end point using the java amf client. It works fine. This is my first attempt at calling a blazeds end point from royale.
 
  
 
  
 
Any ideas ? 
 
  
 
I found the solution.
 
  
 
The mistake I made was with the method. I fixed it here
 
  
 
 service.send("getContacts", []);
 
  
 
  
 
This source was helpful.
 
  
 
https://github.com/apache/royale-asjs/blob/develop/examples/royale/RemoteObjectAMFTest/src/main/royale/App.mxml
 
  
 
  
 
Thanks everyone.
 
  
 
  
 
  
 
On Tuesday, June 15, 2021, 12:17:11 PM GMT+1,romanisitua@yahoo.com <ro...@yahoo.com> wrote:
 
  
 
  
 
I am trying to call my blazeds service from royale.
 
Trying to follow the guidelines specified here
 
  
 
https://apache.github.io/royale-docs/features/loading-external-data/remoteobject
 
  
 
I get the following error:
 
  
 
[onFault] 
 
  
 
AbstractMessage.readExternal
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultDetail on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultCode on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultString on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property rootCause on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property extendedData on flex.messaging.messages.ErrorMessage
 
  
 
  
 
  
 
Code snippets are as follows
 
  
 
 trace(" -- registerClassAlias for royale array list -- ");
 
  
 
                          registerClassAlias('org.apache.royale.collections.ArrayList', ArrayList);
 
  
 
The above was registered at the main application.mxml.
 
  
 
<j:beads>
 
        <js:ApplicationDataBinding /> 
 
        <js:RemoteObject id="service"
 
        endPoint = "http://localhost:8080/messagebroker/websocket-amf"
 
        destination = "contactService"
 
        result="onResult(event)" fault="onFault(event)"/>      
 
    </j:beads>
 
  
 
  
 
  trace(" about to call contactService.getContacts ... ");
 
            service.send("contactService.getContacts", null);
 
  
 
  
 
 private function onResult(param0:ResultEvent):void
 
        {
 
             trace(" -- onResult oh ! -- ");
 
  
 
        }
 
  
 
        private function onFault(param0:FaultEvent):void
 
        {
 
                trace(" -- onFailure oh ! -- ");
 
  
 
                var errorMessage : String = param0.message as String;
 
  
 
                trace(" Error :: " + errorMessage);
 
  
 
                trace("[onFault]", param0);
 
        }
 
  
 
  
 
I am using jewel.
 
  
 
I am tested my blazeds end point using the java amf client. It works fine. This is my first attempt at calling a blazeds end point from royale.
 
  
 
  
 
Any ideas ? 
 
  
 
  
 
Hi everyone,
 
  
 
From previous royale (flex) docs. I can see that it is possible to bind ui forms to action script objects (DTO's). i.e actionscirpt classes with public getter and setter methods.
 
  
 
The ORM we are using accepts and returns data as custom generic data transfer objects (GenericDTO). This generic dto is implemented as a hashMap of pojo's (by pojo I mean a java class with public getter and setter methods))
 
  
 
See the example java code snippet below:
 
  
 
  
 
  
 
public class GenericDTO implements Serializable {
 
  
 
    private static final long serialVersionUID = 1L;
 
  
 
    private Map<String, Attribute> attributes = null;
 
  
 
    private String name = null;
 
  
 
    public GenericDTO(String name) {
 
  
 
        notNull(name, "The name of the DTO cannot be null...");
 
  
 
        this.attributes = new HashMap<String, Attribute>();
 
  
 
        this.name = name;
 
  
 
    }
 
  
 
    public GenericDTO add(String name, Attribute attribute) {
 
  
 
        notNull(name, "Attribute name cannot be null");
 
  
 
        notNull(attribute, "Attribute with name: " + name + " is null!");
 
  
 
        this.attributes.put(name, attribute);
 
  
 
        return this;
 
  
 
    }
 
  
 
........
 
  
 
   // there are getter/setter method to return the HashMap of Attributes and name field.
 
   
 
  
 
   The attribute class is the base class of all data types. So we have StringType (for String), IntegerType (for Integer) that extend Attribute.
 
 
 
Class Attribute
 
  
 
public Object getInputValue();
 
  
 
public void setInputValue(final Object object); 
 
   
 
  
 
Is it possible to bind the generic dto to royale ui controls ? e.g. for example I was able to bind an arrayList of ContactDTO successfully. This contactDTO had name and email as fields with public getter and setter methods as follows
 
  
 
 <j:DataGrid localId="dg1" dataProvider="{contacts}">
 
            <j:columns>               
 
                 <j:DataGridColumn label="Name" dataField="name" columnWidth="200"/>
 
                <j:DataGridColumn label="Email" dataField="email" columnWidth="200"/>         
 
            </j:columns>
 
        </j:DataGrid>   
 
  
 
  
 
Assuming it is possible to create ActionScript (as3) versions of GenericDTO, Attribute (with subclasses StringType, IntegerType e.t.c). Implementing the appropriate get and set functions.
 
  
 
Is it possible to bind an arrayList of GenericDTO to a royale data grid as follows ?
 
  
 
 <j:DataGrid localId="dg1" dataProvider="{records}">
 
            <j:columns>               
 
                <j:DataGridColumn label="Name" dataField="{attributes.name.inputValue}" columnWidth="200"/>
 
                <j:DataGridColumn label="Email" dataField="{attributes.email.inputValue}" columnWidth="200"/>         
 
            </j:columns>
 
        </j:DataGrid>   
 
  
 
  
 
i.e. use databinding expressions in the dataField of the data grid ?
 
  
 
How about other royale UI controls ? e.g textFields and numberFields in a UI form.
 
  
 
  
 
Regards,
 
  
 
Roman,
 
  
 
To understand your problem a bit better, are you saying you’ll have the following?
 
 
 
ArrayList full of GenericDTO, each with a map of attributes? Binding the ArrayList of GenericDTO to the dataProvider will then use a single instance of GenericDTO for each row.
 
  
 
My response: YES. This is what i want to implement.
 
  
 
It almost seems as if you want rows for attributes, not for each GenericDTO?
 
  
 
 My response: the attribute hashmap that belongs to a generic dto should represent a single row of data in the grid only.
 
  
 
You may have to build a new list that contains all attributes you want to render, or look into building/porting the AdvancedDataGrid from Flex. That allows sub-rows (folders) for situations like this.
 
 
 
As for dataFields in Royale, you have a couple of options. You generally set dataField to a relative path within the row’s data instance. For example,  dataField="someValue"or dataField="someObject.someOtherObject.someValue" in more complex object scenarios.
 
  
 
 My response: This implies that the generic dto can be accessed based on code the snippet I shared. Kindly confirm ?
 
  
 
As you can see, binding isn’t used for dataField.
 
  
 
 My response: Noted. Thanks.
 
  
 
You can also use a custom itemRender to build whatever sub-component you want for each cell. For example, I have Lists/DataContainer where each row can be another List/DataContainer, etc.
 
  
 
 My response: I am not sure I understand the  above scenario you mentioned. Though I will definitely keep this in mind. I just started learning royale. 
 
  
 
As for all other controls, yes, you can bind directly to their text/value fields.
 
 
 
FYI, maps, in my experience, or at least with the tools I’m using, turn into AS3 generic Objects. I’m coming from a Flex source base, being ported to Royale. Maps now exist, and may be usable with deserialization.
 
 
 
My response:
 
I intend to create a generic dto in as3. Then create an as3 object to represent the hashmap. This as3 object will use string as "key" to access the "value" from the as3 object.
 
  
 
To summarise my question, does this imply that the generic dto can be accessed based on code the snippet I shared. Kindly confirm ?
 
  
 
  
 
From:romanisitua@yahoo.com <ro...@yahoo.com>
Sent: Tuesday, June 15, 2021 1:20 PM
To: users@royale.apache.org
Subject: [EXTERNAL] Support for GenericDTO
 
 
 
 
 
Hi everyone,
 
 
 
From previous royale (flex) docs. I can see that it is possible to bind ui forms to action script objects (DTO's). i.e actionscirpt classes with public getter and setter methods.
 
 
 
The ORM we are using accepts and returns data as custom generic data transfer objects (GenericDTO). This generic dto is implemented as a hashMap of pojo's (by pojo I mean a java class with public getter and setter methods))
 
 
 
See the example java code snippet below:
 
 
 
 
 
 
 
public class GenericDTO implements Serializable {
 
 
 
    private static final long serialVersionUID = 1L;
 
 
 
    private Map<String, Attribute> attributes = null;
 
 
 
    private String name = null;
 
 
 
    public GenericDTO(String name) {
 
 
 
        notNull(name, "The name of the DTO cannot be null...");
 
 
 
        this.attributes = new HashMap<String, Attribute>();
 
 
 
        this.name = name;
 
 
 
    }
 
 
 
    public GenericDTO add(String name, Attribute attribute) {
 
 
 
        notNull(name, "Attribute name cannot be null");
 
 
 
        notNull(attribute, "Attribute with name: " + name + " is null!");
 
 
 
        this.attributes.put(name, attribute);
 
 
 
        return this;
 
 
 
    }
 
 
 
........
 
 
 
   // there are getter/setter method to return the HashMap of Attributes and name field.
 
   
 
 
 
   The attribute class is the base class of all data types. So we have StringType (for String), IntegerType (for Integer) that extend Attribute.
 
 
 
Class Attribute
 
 
 
public Object getInputValue();
 
 
 
public void setInputValue(final Object object); 
 
   
 
 
 
Is it possible to bind the generic dto to royale ui controls ? e.g. for example I was able to bind an arrayList of ContactDTO successfully. This contactDTO had name and email as fields with public getter and setter methods as follows
 
 
 
 <j:DataGrid localId="dg1" dataProvider="{contacts}">
 
            <j:columns>               
 
                 <j:DataGridColumn label="Name" dataField="name" columnWidth="200"/>
 
                <j:DataGridColumn label="Email" dataField="email" columnWidth="200"/>         
 
            </j:columns>
 
        </j:DataGrid>   
 
 
 
 
 
Assuming it is possible to create ActionScript (as3) versions of GenericDTO, Attribute (with subclasses StringType, IntegerType e.t.c). Implementing the appropriate get and set functions.
 
 
 
Is it possible to bind an arrayList of GenericDTO to a royale data grid as follows ?
 
 
 
 <j:DataGrid localId="dg1" dataProvider="{records}">
 
            <j:columns>               
 
                <j:DataGridColumn label="Name" dataField="{attributes.name.inputValue}" columnWidth="200"/>
 
                <j:DataGridColumn label="Email" dataField="{attributes.email.inputValue}" columnWidth="200"/>         
 
            </j:columns>
 
        </j:DataGrid>   
 
 
 
 
 
i.e. use databinding expressions in the dataField of the data grid ?
 
 
 
How about other royale UI controls ? e.g textFields and numberFields in a UI form.
 
 
 
 
 
Regards,
 
 
 
Roman,
 
 
 
  
  

RE: [EXTERNAL] Re: users Digest 15 Jun 2021 21:06:12 -0000 Issue 1717

Posted by "romanisitua@yahoo.com" <ro...@yahoo.com>.
Thanks for the detailed feedback. I have started implementing the as3 classes.
I will try this approach you listed first
 " If you bind records list to the datagrid, each row will contain a GenericDTO in order in your records ArrayList. "
Then share the results here.
Thanks for the help so far.


 


Sent from Yahoo Mail on Android 
 
  On Tue, 15 Jun 2021 at 23:22, Brian Raymes<br...@teotech.com> wrote:   #yiv6809250661 #yiv6809250661 -- _filtered {} _filtered {} _filtered {} _filtered {} _filtered {}#yiv6809250661 #yiv6809250661 p.yiv6809250661MsoNormal, #yiv6809250661 li.yiv6809250661MsoNormal, #yiv6809250661 div.yiv6809250661MsoNormal {margin:0in;font-size:11.0pt;font-family:sans-serif;}#yiv6809250661 a:link, #yiv6809250661 span.yiv6809250661MsoHyperlink {color:blue;text-decoration:underline;}#yiv6809250661 a:visited, #yiv6809250661 span.yiv6809250661MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv6809250661 p.yiv6809250661msonormal0, #yiv6809250661 li.yiv6809250661msonormal0, #yiv6809250661 div.yiv6809250661msonormal0 {margin-right:0in;margin-left:0in;font-size:11.0pt;font-family:sans-serif;}#yiv6809250661 p.yiv6809250661msonormal, #yiv6809250661 li.yiv6809250661msonormal, #yiv6809250661 div.yiv6809250661msonormal {margin-right:0in;margin-left:0in;font-size:11.0pt;font-family:sans-serif;}#yiv6809250661 p.yiv6809250661msochpdefault, #yiv6809250661 li.yiv6809250661msochpdefault, #yiv6809250661 div.yiv6809250661msochpdefault {margin-right:0in;margin-left:0in;font-size:11.0pt;font-family:sans-serif;}#yiv6809250661 span.yiv6809250661emailstyle18 {}#yiv6809250661 p.yiv6809250661msonormal1, #yiv6809250661 li.yiv6809250661msonormal1, #yiv6809250661 div.yiv6809250661msonormal1 {margin:0in;font-size:11.0pt;font-family:sans-serif;}#yiv6809250661 p.yiv6809250661msonormal2, #yiv6809250661 li.yiv6809250661msonormal2, #yiv6809250661 div.yiv6809250661msonormal2 {margin:0in;font-size:11.0pt;font-family:sans-serif;}#yiv6809250661 span.yiv6809250661emailstyle181 {font-family:sans-serif;color:windowtext;}#yiv6809250661 p.yiv6809250661msochpdefault1, #yiv6809250661 li.yiv6809250661msochpdefault1, #yiv6809250661 div.yiv6809250661msochpdefault1 {margin-right:0in;margin-left:0in;font-size:10.0pt;font-family:sans-serif;}#yiv6809250661 span.yiv6809250661EmailStyle26 {font-family:sans-serif;color:windowtext;}#yiv6809250661 .yiv6809250661MsoChpDefault {font-family:sans-serif;} _filtered {}#yiv6809250661 div.yiv6809250661WordSection1 {}#yiv6809250661 
Let me draw out an example to clarify. Lets assume you have the following:
 
  
 
ArrayList, named records, containing the following:
 
  
 
  GenericDTO
 
     Attributes (0..n items)
  GenericDTO
 
     Attributes (0..n items)
 
  GenericDTO
 
     Attributes (0..n items)
 
  GenericDTO
 
     Attributes (0..n items)
 
  GenericDTO
 
     Attributes (0..n items)
 
  . . .
 
  GenericDTO
 
     Attributes (0..n items)
 
  
 
If you bind records list to the datagrid, each row will contain a GenericDTO in order in your records ArrayList.
 
  
 
If you want each row to be a unique attribute, then you will have to transform this ArrayList of GenericDTO’s into another List of Attributes:
 
  
 
I’m not entirely certain of your name/attribute relationship, so you may need to build a small VO to hold these for your list, but the following will put all attributes into a new list that you can bind to your datagrid:
 
  
 
            var attributes:ArrayList = new ArrayList();
 
            for each (var genericDto:GenericDTO in records)
 
            {
 
                for (var key:String in genericDto.attributes)
 
                {
 
                    attributes.push(genericDto.attributes.get(key));
 
                }
 
            }
 
  
 
With this approach, you’ll have an ArrayList with all Attributes that can be bound to the datagrid. Each row being a single attribute.
 
  
 
As I stated above, you may need to do something like this:
 
  
 
            public class NameAttributeVO
            {
 
                var name:String;
 
                var attribute:Attribute;
 
            
 
                public NameAttributeVO(name:String, attribute:Attribute)
                {
 
                    this.name = name;
 
                    this.attribute = attribute;
 
                }
 
            }
 
  
 
Then the following:
 
  
 
            var attributes:ArrayList = new ArrayList();
 
            for each (var genericDto:GenericDTO in records)
 
            {
 
                for (var name:String in genericDto.attributes)
 
                {
 
                    attributes.push(new NameAttributeVO(name, genericDto.attributes.get(name)));
 
                }
 
            }
 
  
 
With this approach, you’ll have an ArrayList of NameAttributeVO that can be bound to the datagrid. Each row being a single NameAttributeVO.
 
  
 
So, to summarize, yes, your GenericDTO, if you build the AS3 variant that the Java variant maps to, then yes, you can bind to controls, but, the hierarchy of your data may need to be altered to fit the exact scenario you are trying to achieve. You could also transform this list in your backend too, to avoid the frontend from doing unnecessary work.


 
If you can provide a visual representation of what you are trying to achieve, I can provide further assistance.
 
  
 
  
 
Brian
 
  
 
From: romanisitua@yahoo.com <ro...@yahoo.com> 
Sent: Tuesday, June 15, 2021 2:43 PM
To: users-digest@royale.apache.org; users-digest-help@royale.apache.org; users@royale.apache.org
Subject: [EXTERNAL] Re: users Digest 15 Jun 2021 21:06:12 -0000 Issue 1717
 
  
 
Thanks for the feedback. Find my responses to your questions below.
 
  
 
Sent from Yahoo Mail on Android
 
  
 

On Tue, 15 Jun 2021 at 22:06,users-digest-help@royale.apache.org
 
<us...@royale.apache.org> wrote:
 
  
 
users Digest 15 Jun 2021 21:06:12 -0000 Issue 1717
 
  
 
Topics (messages 4752 through 4755)
 
  
 
Error using js:remoteObject
 
    4752 by: romanisitua.yahoo.com
 
    4753 by: romanisitua.yahoo.com
 
  
 
Support for GenericDTO
 
    4754 by: romanisitua.yahoo.com
 
  
 
Re: [EXTERNAL] Support for GenericDTO
 
    4755 by: Brian Raymes
 
  
 
Administrivia:
 
  
 
---------------------------------------------------------------------
 
To post to the list, e-mail: users@royale.apache.org
 
To unsubscribe, e-mail: users-digest-unsubscribe@royale.apache.org
 
For additional commands, e-mail: users-digest-help@royale.apache.org
 
  
 
----------------------------------------------------------------------
 
  
 
I am trying to call my blazeds service from royale.
 
Trying to follow the guidelines specified here
 
  
 
https://apache.github.io/royale-docs/features/loading-external-data/remoteobject
 
  
 
I get the following error:
 
  
 
[onFault] 
 
  
 
AbstractMessage.readExternal
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultDetail on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultCode on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultString on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property rootCause on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property extendedData on flex.messaging.messages.ErrorMessage
 
  
 
  
 
  
 
Code snippets are as follows
 
  
 
 trace(" -- registerClassAlias for royale array list -- ");
 
  
 
                          registerClassAlias('org.apache.royale.collections.ArrayList', ArrayList);
 
  
 
The above was registered at the main application.mxml.
 
  
 
<j:beads>
 
        <js:ApplicationDataBinding /> 
 
        <js:RemoteObject id="service"
 
        endPoint = "http://localhost:8080/messagebroker/websocket-amf"
 
        destination = "contactService"
 
        result="onResult(event)" fault="onFault(event)"/>      
 
    </j:beads>
 
  
 
  
 
  trace(" about to call contactService.getContacts ... ");
 
            service.send("contactService.getContacts", null);
 
  
 
  
 
 private function onResult(param0:ResultEvent):void
 
        {
 
             trace(" -- onResult oh ! -- ");
 
  
 
        }
 
  
 
        private function onFault(param0:FaultEvent):void
 
        {
 
                trace(" -- onFailure oh ! -- ");
 
  
 
                var errorMessage : String = param0.message as String;
 
  
 
                trace(" Error :: " + errorMessage);
 
  
 
                trace("[onFault]", param0);
 
        }
 
  
 
  
 
I am using jewel.
 
  
 
I am tested my blazeds end point using the java amf client. It works fine. This is my first attempt at calling a blazeds end point from royale.
 
  
 
  
 
Any ideas ? 
 
  
 
I found the solution.
 
  
 
The mistake I made was with the method. I fixed it here
 
  
 
 service.send("getContacts", []);
 
  
 
  
 
This source was helpful.
 
  
 
https://github.com/apache/royale-asjs/blob/develop/examples/royale/RemoteObjectAMFTest/src/main/royale/App.mxml
 
  
 
  
 
Thanks everyone.
 
  
 
  
 
  
 
On Tuesday, June 15, 2021, 12:17:11 PM GMT+1,romanisitua@yahoo.com <ro...@yahoo.com> wrote:
 
  
 
  
 
I am trying to call my blazeds service from royale.
 
Trying to follow the guidelines specified here
 
  
 
https://apache.github.io/royale-docs/features/loading-external-data/remoteobject
 
  
 
I get the following error:
 
  
 
[onFault] 
 
  
 
AbstractMessage.readExternal
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultDetail on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultCode on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property faultString on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property rootCause on flex.messaging.messages.ErrorMessage
 
Language.as:254 ReferenceError: Error #1056: Cannot create property extendedData on flex.messaging.messages.ErrorMessage
 
  
 
  
 
  
 
Code snippets are as follows
 
  
 
 trace(" -- registerClassAlias for royale array list -- ");
 
  
 
                          registerClassAlias('org.apache.royale.collections.ArrayList', ArrayList);
 
  
 
The above was registered at the main application.mxml.
 
  
 
<j:beads>
 
        <js:ApplicationDataBinding /> 
 
        <js:RemoteObject id="service"
 
        endPoint = "http://localhost:8080/messagebroker/websocket-amf"
 
        destination = "contactService"
 
        result="onResult(event)" fault="onFault(event)"/>      
 
    </j:beads>
 
  
 
  
 
  trace(" about to call contactService.getContacts ... ");
 
            service.send("contactService.getContacts", null);
 
  
 
  
 
 private function onResult(param0:ResultEvent):void
 
        {
 
             trace(" -- onResult oh ! -- ");
 
  
 
        }
 
  
 
        private function onFault(param0:FaultEvent):void
 
        {
 
                trace(" -- onFailure oh ! -- ");
 
  
 
                var errorMessage : String = param0.message as String;
 
  
 
                trace(" Error :: " + errorMessage);
 
  
 
                trace("[onFault]", param0);
 
        }
 
  
 
  
 
I am using jewel.
 
  
 
I am tested my blazeds end point using the java amf client. It works fine. This is my first attempt at calling a blazeds end point from royale.
 
  
 
  
 
Any ideas ? 
 
  
 
  
 
Hi everyone,
 
  
 
From previous royale (flex) docs. I can see that it is possible to bind ui forms to action script objects (DTO's). i.e actionscirpt classes with public getter and setter methods.
 
  
 
The ORM we are using accepts and returns data as custom generic data transfer objects (GenericDTO). This generic dto is implemented as a hashMap of pojo's (by pojo I mean a java class with public getter and setter methods))
 
  
 
See the example java code snippet below:
 
  
 
  
 
  
 
public class GenericDTO implements Serializable {
 
  
 
    private static final long serialVersionUID = 1L;
 
  
 
    private Map<String, Attribute> attributes = null;
 
  
 
    private String name = null;
 
  
 
    public GenericDTO(String name) {
 
  
 
        notNull(name, "The name of the DTO cannot be null...");
 
  
 
        this.attributes = new HashMap<String, Attribute>();
 
  
 
        this.name = name;
 
  
 
    }
 
  
 
    public GenericDTO add(String name, Attribute attribute) {
 
  
 
        notNull(name, "Attribute name cannot be null");
 
  
 
        notNull(attribute, "Attribute with name: " + name + " is null!");
 
  
 
        this.attributes.put(name, attribute);
 
  
 
        return this;
 
  
 
    }
 
  
 
........
 
  
 
   // there are getter/setter method to return the HashMap of Attributes and name field.
 
   
 
  
 
   The attribute class is the base class of all data types. So we have StringType (for String), IntegerType (for Integer) that extend Attribute.
 
 
 
Class Attribute
 
  
 
public Object getInputValue();
 
  
 
public void setInputValue(final Object object); 
 
   
 
  
 
Is it possible to bind the generic dto to royale ui controls ? e.g. for example I was able to bind an arrayList of ContactDTO successfully. This contactDTO had name and email as fields with public getter and setter methods as follows
 
  
 
 <j:DataGrid localId="dg1" dataProvider="{contacts}">
 
            <j:columns>               
 
                 <j:DataGridColumn label="Name" dataField="name" columnWidth="200"/>
 
                <j:DataGridColumn label="Email" dataField="email" columnWidth="200"/>         
 
            </j:columns>
 
        </j:DataGrid>   
 
  
 
  
 
Assuming it is possible to create ActionScript (as3) versions of GenericDTO, Attribute (with subclasses StringType, IntegerType e.t.c). Implementing the appropriate get and set functions.
 
  
 
Is it possible to bind an arrayList of GenericDTO to a royale data grid as follows ?
 
  
 
 <j:DataGrid localId="dg1" dataProvider="{records}">
 
            <j:columns>               
 
                <j:DataGridColumn label="Name" dataField="{attributes.name.inputValue}" columnWidth="200"/>
 
                <j:DataGridColumn label="Email" dataField="{attributes.email.inputValue}" columnWidth="200"/>         
 
            </j:columns>
 
        </j:DataGrid>   
 
  
 
  
 
i.e. use databinding expressions in the dataField of the data grid ?
 
  
 
How about other royale UI controls ? e.g textFields and numberFields in a UI form.
 
  
 
  
 
Regards,
 
  
 
Roman,
 
  
 
To understand your problem a bit better, are you saying you’ll have the following?
 
 
 
ArrayList full of GenericDTO, each with a map of attributes? Binding the ArrayList of GenericDTO to the dataProvider will then use a single instance of GenericDTO for each row.
 
  
 
My response: YES. This is what i want to implement.
 
  
 
It almost seems as if you want rows for attributes, not for each GenericDTO?
 
  
 
 My response: the attribute hashmap that belongs to a generic dto should represent a single row of data in the grid only.
 
  
 
You may have to build a new list that contains all attributes you want to render, or look into building/porting the AdvancedDataGrid from Flex. That allows sub-rows (folders) for situations like this.
 
 
 
As for dataFields in Royale, you have a couple of options. You generally set dataField to a relative path within the row’s data instance. For example,  dataField="someValue"or dataField="someObject.someOtherObject.someValue" in more complex object scenarios.
 
  
 
 My response: This implies that the generic dto can be accessed based on code the snippet I shared. Kindly confirm ?
 
  
 
As you can see, binding isn’t used for dataField.
 
  
 
 My response: Noted. Thanks.
 
  
 
You can also use a custom itemRender to build whatever sub-component you want for each cell. For example, I have Lists/DataContainer where each row can be another List/DataContainer, etc.
 
  
 
 My response: I am not sure I understand the  above scenario you mentioned. Though I will definitely keep this in mind. I just started learning royale. 
 
  
 
As for all other controls, yes, you can bind directly to their text/value fields.
 
 
 
FYI, maps, in my experience, or at least with the tools I’m using, turn into AS3 generic Objects. I’m coming from a Flex source base, being ported to Royale. Maps now exist, and may be usable with deserialization.
 
 
 
My response:
 
I intend to create a generic dto in as3. Then create an as3 object to represent the hashmap. This as3 object will use string as "key" to access the "value" from the as3 object.
 
  
 
To summarise my question, does this imply that the generic dto can be accessed based on code the snippet I shared. Kindly confirm ?
 
  
 
  
 
From:romanisitua@yahoo.com <ro...@yahoo.com>
Sent: Tuesday, June 15, 2021 1:20 PM
To: users@royale.apache.org
Subject: [EXTERNAL] Support for GenericDTO
 
 
 
 
 
Hi everyone,
 
 
 
From previous royale (flex) docs. I can see that it is possible to bind ui forms to action script objects (DTO's). i.e actionscirpt classes with public getter and setter methods.
 
 
 
The ORM we are using accepts and returns data as custom generic data transfer objects (GenericDTO). This generic dto is implemented as a hashMap of pojo's (by pojo I mean a java class with public getter and setter methods))
 
 
 
See the example java code snippet below:
 
 
 
 
 
 
 
public class GenericDTO implements Serializable {
 
 
 
    private static final long serialVersionUID = 1L;
 
 
 
    private Map<String, Attribute> attributes = null;
 
 
 
    private String name = null;
 
 
 
    public GenericDTO(String name) {
 
 
 
        notNull(name, "The name of the DTO cannot be null...");
 
 
 
        this.attributes = new HashMap<String, Attribute>();
 
 
 
        this.name = name;
 
 
 
    }
 
 
 
    public GenericDTO add(String name, Attribute attribute) {
 
 
 
        notNull(name, "Attribute name cannot be null");
 
 
 
        notNull(attribute, "Attribute with name: " + name + " is null!");
 
 
 
        this.attributes.put(name, attribute);
 
 
 
        return this;
 
 
 
    }
 
 
 
........
 
 
 
   // there are getter/setter method to return the HashMap of Attributes and name field.
 
   
 
 
 
   The attribute class is the base class of all data types. So we have StringType (for String), IntegerType (for Integer) that extend Attribute.
 
 
 
Class Attribute
 
 
 
public Object getInputValue();
 
 
 
public void setInputValue(final Object object); 
 
   
 
 
 
Is it possible to bind the generic dto to royale ui controls ? e.g. for example I was able to bind an arrayList of ContactDTO successfully. This contactDTO had name and email as fields with public getter and setter methods as follows
 
 
 
 <j:DataGrid localId="dg1" dataProvider="{contacts}">
 
            <j:columns>               
 
                 <j:DataGridColumn label="Name" dataField="name" columnWidth="200"/>
 
                <j:DataGridColumn label="Email" dataField="email" columnWidth="200"/>         
 
            </j:columns>
 
        </j:DataGrid>   
 
 
 
 
 
Assuming it is possible to create ActionScript (as3) versions of GenericDTO, Attribute (with subclasses StringType, IntegerType e.t.c). Implementing the appropriate get and set functions.
 
 
 
Is it possible to bind an arrayList of GenericDTO to a royale data grid as follows ?
 
 
 
 <j:DataGrid localId="dg1" dataProvider="{records}">
 
            <j:columns>               
 
                <j:DataGridColumn label="Name" dataField="{attributes.name.inputValue}" columnWidth="200"/>
 
                <j:DataGridColumn label="Email" dataField="{attributes.email.inputValue}" columnWidth="200"/>         
 
            </j:columns>
 
        </j:DataGrid>   
 
 
 
 
 
i.e. use databinding expressions in the dataField of the data grid ?
 
 
 
How about other royale UI controls ? e.g textFields and numberFields in a UI form.
 
 
 
 
 
Regards,
 
 
 
Roman,