Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
ArrayOfAnyType
jholmes
I have a question regarding the object 'ArrayOfAnyType'. We are currently getting values from a MBMetadata using the getMName and getMValue. We now have a situation where there are multiple values for the MName. I'm assuming that I use the getMValues which returns an 'ArrayOfAnyType' object. My question is, how do I iterate over it to pull out the individual values? Does this need to be cast into something else in order to iterate over it?
Thanks,
Jay
Find more posts tagged with
Comments
jholmes
To further clarify the question, we are using the Java API's to access this data...
Jay
Konidala
Hope this will help you.
public static String ParseMBAsset( MBAsset asset ) throws Exception
{
String str = "";
if( asset != null )
{
str += "Name: " + asset.getMName() + "\n";
str += "ID: " + asset.getMID()+ "\n";
str += "Revision: " + asset.getRevision()+ "\n";
str += "Repository Path: " + asset.getRepositoryPath()+ "\n";
str += "Width: " + asset.getWidth()+ "\n";
str += "Height: " + asset.getHeight()+ "\n";
str += "Filesize: " + asset.getFilesize()+ "\n";
str += "Modification Date: " + FormatTime( asset.getModificationDate() ) + "\n";
str += "Resolution: " + asset.getResolution()+ "\n";
str += "Colorspace: " + asset.getColorspace()+ "\n";
//Following this is the list of metadata
//This is the interface's collection
ArrayOfMBMetadata arrMetadata = asset.getMetadata();
if( arrMetadata != null )
{
//This is the true array
MBMetadata[] metadata = arrMetadata.getMBMetadata();
for(int i=0; i< metadata.length; i++)
{
String name = metadata
.getMName();
String id = metadata
.getMID();
str += name + ": ";
if( metadata
.isIsMultipleValue() )
{
//This is the interface's collection
ArrayOfAnyType arrValues = metadata
.getMValues();
//This is the true array
Object[] values = arrValues.getAnyType();
for(int j=0; j<values.length; j++ )
{
str += values.toString() + "\n";
}
}
else
{
Object value = metadata
.getMValue();
//if the metadata is a time value, we need
//to format it correctly
if( value instanceof Calendar )
str += FormatTime( (Calendar) value ) + "\n";
else
str += value.toString() + "\n";
}
}
}
}
return str;
}
Thanks
jholmes
That worked great, thanks!
-Jay