Search in sources :

Example 6 with RetrieveResult

use of com.vmware.vim25.RetrieveResult in project photon-model by vmware.

the class GetMoRef method populate.

public static String populate(final RetrieveResult rslts, final Map<String, ManagedObjectReference> tgtMoref) {
    String token = null;
    if (rslts != null) {
        token = rslts.getToken();
        for (ObjectContent oc : rslts.getObjects()) {
            ManagedObjectReference mr = oc.getObj();
            String entityNm = null;
            List<DynamicProperty> dps = oc.getPropSet();
            if (dps != null) {
                for (DynamicProperty dp : dps) {
                    entityNm = (String) dp.getVal();
                }
            }
            tgtMoref.put(entityNm, mr);
        }
    }
    return token;
}
Also used : ObjectContent(com.vmware.vim25.ObjectContent) DynamicProperty(com.vmware.vim25.DynamicProperty) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Aggregations

ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)5 DynamicProperty (com.vmware.vim25.DynamicProperty)4 ObjectContent (com.vmware.vim25.ObjectContent)4 RetrieveResult (com.vmware.vim25.RetrieveResult)4 PropertyFilterSpec (com.vmware.vim25.PropertyFilterSpec)3 ObjectSpecBuilder (com.vmware.photon.controller.model.adapters.vsphere.util.builders.ObjectSpecBuilder)2 PropertyFilterSpecBuilder (com.vmware.photon.controller.model.adapters.vsphere.util.builders.PropertyFilterSpecBuilder)2 PropertySpecBuilder (com.vmware.photon.controller.model.adapters.vsphere.util.builders.PropertySpecBuilder)2 RetrieveOptions (com.vmware.vim25.RetrieveOptions)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ObjectSpec (com.vmware.vim25.ObjectSpec)1 PropertySpec (com.vmware.vim25.PropertySpec)1 TraversalSpec (com.vmware.vim25.TraversalSpec)1 Map (java.util.Map)1