HashMap<String, MondrianCatalogComplementInfo> map = new HashMap<String, MondrianCatalogComplementInfo>();
if ( doc.getElementChildren().length > 0 ) {
DOMWrapper dataSource = doc.getElementChildren()[ 0 ];
DOMWrapper catalogs = null;
// Search Catalogs
for ( int i = 0; i < dataSource.getElementChildren().length; i++ ) {
DOMWrapper element = dataSource.getElementChildren()[ i ];
if ( element.getTagName().equals( "Catalogs" ) ) { //$NON-NLS-1$
catalogs = element;
break;
}
}
// Generate the map. We need the name and the variables
for ( int i = 0; i < catalogs.getElementChildren().length; i++ ) {
final DOMWrapper catalog = catalogs.getElementChildren()[ i ];
if ( !"Catalog".equals( catalog.getTagName() ) ) { //$NON-NLS-1$
continue;
}
MondrianCatalogComplementInfo complementInfo = new MondrianCatalogComplementInfo();
// Iterate through whereConditions
for ( int j = 0; j < catalog.getElementChildren().length; j++ ) {
final DOMWrapper whereNode = catalog.getElementChildren()[ j ];
if ( "WhereCondition".equals( whereNode.getTagName() ) ) { //$NON-NLS-1$
complementInfo.addWhereCondition( whereNode.getAttribute( "cube" ), whereNode.getText() ); //$NON-NLS-1$
}
}
map.put( getDOMWrapperElementText( catalog, "Definition" ), complementInfo ); //$NON-NLS-1$
}