The QueryBuilder makes it easy to find the attributes of a dimension in the Java-client user interface.
To find the attributes of a dimension programmatically, you call the getAttributes
method of the MDDimension
object that represents the dimension.
The following code gets the Product dimension and finds the attributes that have been defined for the dimension. Descriptions of the attributes are stored in a String
array.
// mdManager is the MetadataManager MDDimension mdProductDimension = null; MDAttribute[] mdAttributes = null; String[] strAttDescriptions = null; try{ // get the Product dimension mdProductDimension = mdManager.getDimension(MDU.OBJECT_NAME, "PRODUCT"); // get the attributes mdAttributes = mdProductDimension.getAttributes(); strAttDescriptions = new String[mdAttributes.length]; for (int i = 0; ((mdAttributes != null) && (i < Attributes.length)) ; i ++ ) { strAttDescriptions[i] = mdAttributes[i].getShortLabel(); } } catch (MetadataManagerException mme){ mme.printStackTrace(); }