Hi Guys,

I am facing an implementation issue while transforming a heavy object in to
an object of my requirement.

Object Structure derived from server side (unexposed API - Third party) is
like below

Nodes : Array
[0]
  -ManagedObjects : Object
  -Relationships : Object
  - typeHeirarchy (ex:DB::Region)
[1]
[2]
etc

Individual Structure of MO.

ManagedObject
  -id :String
  - attributes:array

attributes array will have the data to be populated for that particular type
hierarchy.

Individual Structure of relationships

Relationships
  -type:string
  -node : array

This nodes array will in turn have a ManagedObject and Relationship. Like
this it will go deep.
The relationship between parent object and target is the typeHierachy.

For the parent the typeHierachy will be like this DB::Region for the target
node inside the parent object will be having a typeHierachy
DB::Region/DB::DC. like this it will go to some extent.

The above mentioned is for the first object in the top level Nodes array, so
like the first object all the object will have a same kind of depth.

Some coming to my issue, I want to re-structure this format to a form like
below

Region : List<RegionClass> (or) Object
[0]
  -id
  -name
  - desc
  - dc : List <DC> (or) Object
     [0]
      -id
      -name
      -shipAddress
       -room : List<Room> (or) Object
         [0]
[1]
[2]
[3]
etc

We can achieve the format by going for a lot of for-loops and if loops till
the depth (I mean for each node).

But today if I am writing a code by using so many for loops till my depth
but tomorrow client will add one more level in the hierarchy, so i need to
change the code back.

So I want in a generic way some thing like by using a recursive way, i tried
also but I am not able to persist the objects while recursing.

Can anybody help me on this?

Getting bugged because of this for the past two days, hope this is a better
forum to get help to write a better code than normal if and for loops.

PS: I am having a HashMap.as also.I want to maintain that relationship
between objects so I am going for that datastructure.

Thanks,
Veeru

--

You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.


Reply via email to