Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all articles
Browse latest Browse all 1860

Unable to get the list of values getting populated to Flex UI. Need to clarify about the Mediator class working.

$
0
0

Hi,

I need to display the host list and its belonging cluster list from my vCenter folder level.

Is there a way to get the List of Hosts and its belonging Clusters at the vCenter Folder level in vsphere web client 5.5…

The above discussion was initiated by me sometime back and now I am able to get the required list where I have used the approach2 - via vSphere Web Services SDK to traverse the vCenter tree.

 

I have my java related code in provider and Flex related code in ui folders respectively.

I have a class in java side say DataList which has below definitions in DataList.java,

public class DataList {

   public ArrayList<String> clusterlist;

   public ArrayList<String> hostlist;

}

 

For ui side I have created DataList.as class as below

package com.vmware.samples.wssdkui.model {

import com.vmware.core.model.DataObject;

import mx.collections.ArrayCollection;

[Bindable]

[RemoteClass(alias="com.vmware.samples.wssdkprovider.DataList")]

public class DataList extends DataObject {

   public var clusterlist:ArrayCollection;

   public var hostlist:ArrayCollection;

}

}

 

In my ProviderImpl.java class, I have the below way to put all the host and clusters. (Testing, so hard-coded few index values)

DataList ds   = new DataList(); [ds object is of type: ArrayList<String>]

ds.clusterlist.add(0, host_objcs[0].cluster);  ds.hostlist.add(0,host_objcs[0].host);    

ds.clusterlist.add(1, host_objcs[1].cluster);  ds.hostlist.add(1,host_objcs[1].host);

 

In my Mediator class on UI side has

_view.datalist = result as DataList;  in onDataRetrieved fn

 

In my Flex UI .mxml class,

dgArray  =  [{cluster:datalist.clusterlist.getItemAt(0),host:datalist.hostlist.getItemAt(0)},

                  {cluster:datalist.clusterlist.getItemAt(1),host:datalist.hostlist.getItemAt(1)}];

list = new ArrayCollection(dgArray);

and providing dataProvider="{list}" in my Table Grid View.

 

UI doesnt throw any error. Instead nothing is displayed since datalist.clusterlist.getItemAt(0) is having some problem.

Query:

1. What kind of mapping to be done in between the UI side DataList.as which is of  ArrayList<String> type and  with DataList.java class of type clusterlist:ArrayCollection (mxml:Collection)

2. In case if I give the type as "String" it works perfectly fine. How to retrieve more than one element, like list of values ?

3. We also know the Mediator class is where this kind of mapping takes place,

public function onDataRetrieved(request:PropertyRequest, result:Object, error:Error):

void { if (error != null) {  _logger.debug("onDataRetrieved error: " + error); return; }

_view.datalist = result as DataList }    // in onDataRetrieved fn

 

_view.datalist = result as DataList;   // works in case of one vale (i.e) String and fails in case of list of values as Array type.

So how we need to map <arrayList> java to <ArrayCollection> Flex ?

4. I cannot add any other Property constraint at this vCenter folder level since my _contextObject is "Folder" and I need this list at this level, hence I have traversed the whole tree manually.

So is there any way to achieve my need at this level ? Or is there any constraint I can use at this level to get the list ?

 

Kindly guide me on the design approach for me to achieve this.


Viewing all articles
Browse latest Browse all 1860

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>