VMware Cloud Community
qc4vmware
Virtuoso
Virtuoso

VclMap and VclQName what are they and how do I use them?

Anyone have any examples of how to use VclMap and VclQName ( I have VclMap class types that contain VclQName).  I am using the query service and the attribute attached to many of the query results contains otherAttributes which is a VclMap.  I keep fumbling around with it but I can't seem to get anything meaningful.  I think I might just be missing something simple in how I am trying to make use of the VclMap.  About as close as I have gotten to anything meaningful is this VclQname.getLocalPart() which seems to list an attribute like pvdcHighestSupportedHardwareVersion but I can't figure out how to actually show what the value of that is.

0 Kudos
2 Replies
mcfadyenj
Hot Shot
Hot Shot

I believe the metadata items in VCD return VclMap types. You can iterate the results in that like this.

var metadata = object.getMetadata();      // I believe this is a VclMap

var metadataEntries = metadata.getTypedEntries().enumerate();

var value = null;

for each (var metadataEntry in metadataEntries)

{

        if (metadataEntry.key == key) {

        value = metadataEntry.typedValue.getValue(new VclMetadataStringValue).value;

        System.log(    "Retrieved key : " + key + " with value : " + value);

        break;

    }   

}

hope this is useful, I have never put this to the test on checking the types, I just recall it being mentioned some time back.

0 Kudos
qc4vmware
Virtuoso
Virtuoso

Thanks I will let you know if this does the trick.

0 Kudos