1 Reply Latest reply on May 19, 2008 4:23 PM by meena_r

    Converting Java Object to ActionScript Objects

    meena_r Level 1
      Hello,
      I want to pass a java object which has an arraylist, this arraylist has another object added into it, through RemoteObject and blazeDS I am stuck at one place though. My java class has one ArrayList of Objects for example my Java classes are:
      public class UserAccountDTO{
      Private String loginID;
      Private String name;
      private ArrayList<AssignedFunctionDTO> assignedFunction;
      //getter and setter method
      //no args constructor
      // constructor to set all these values from outside
      Public UserAccountDTO(String loginID,String name, ArrayList assignedFunction){
      this.setLoginID(loginID);
      this.setName(name);
      this.setAssignedFunction(assignedFunction);
      }
      }

      public class AssignedFunctionDTO(){
      private int function_id;
      private String function_name;

      //getter and setter methods
      //no args constructor
      //constructor to set all these value from out side
      }

      Then the method which Remote Object service calls
      Public loginUtil(){

      //fetches user records from database
      //creates arraylist of AssignedFunctionDTO by
      assignedFunction.add(new AssignedFunctionDTO(functioned,functionName);
      //returns UserAccountDTO object by
      Return new UserAccountDTO(loginID,name,assignedFunciton);
      }

      I am using blazeds for remoting and cairngorm for structure and created two DTO classes in flex like this:
      Package;
      {
      [RemoteClass(alias=myPackage.UserAccountDTO)]
      Public class UserAccountDTO{
      Public var loginID:String;
      Public var name:String;
      Public var assignedFunctaion:Object //I tried using AssignedFunctionDTO/ArrayCollection too
      }
      }

      Package;
      {
      [RemoteClass(alias=myPackage.AssignedFunctionDTO)]
      Public class AssignedFunctionDTO {
      Public var function_id:int;
      Public var function_name:String;
      }
      }

      In my command class I am not getting value of AssignedFunctionDTO its null
      I am doing : modelLocator.userAccountDTO = event.result;

      This gives me everything other then AssignedFunctionDTO dont know why, if I pass a simple arraylist I get its value, however I do not get value of ArrayList which contains another object inside it&I think I am missing something here however I have no idea about it....please bare with me... please help