001    /*
002    // $Id: //open/mondrian/src/main/mondrian/rolap/RolapCubeUsages.java#1
003    // This software is subject to the terms of the Common Public License
004    // Agreement, available at the following URL:
005    // http://www.opensource.org/licenses/cpl.html.
006    // Copyright (C) 2001-2008 Julian Hyde and others
007    // All Rights Reserved.
008    // You must accept the terms of that agreement to use this software.
009    //
010    */
011    
012    package mondrian.rolap;
013    
014    import mondrian.olap.MondrianDef;
015    
016    /**
017     * <code>RolapCubeUsages</code>
018     * This provides us with the base cubes that a virtual cube uses and
019     * specifies if unrelated dimensions to measures from these cubes should be
020     * ignored.
021     * @author ajoglekar
022     * @since Nov 22 2007
023     * @version $Id: //open/mondrian/src/main/mondrian/rolap/RolapCubeUsages.java#4 $
024     */
025    
026    public class RolapCubeUsages {
027        private MondrianDef.CubeUsages cubeUsages;
028    
029        public RolapCubeUsages(MondrianDef.CubeUsages cubeUsage) {
030            this.cubeUsages = cubeUsage;
031        }
032    
033        public boolean shouldIgnoreUnrelatedDimensions(String baseCubeName) {
034            if (cubeUsages == null || cubeUsages.cubeUsages == null) {
035                return false;
036            }
037            for (MondrianDef.CubeUsage usage : cubeUsages.cubeUsages) {
038                if (usage.cubeName.equals(baseCubeName)
039                    && Boolean.TRUE.equals(usage.ignoreUnrelatedDimensions)) {
040                    return true;
041                }
042            }
043            return false;
044        }
045    }
046    
047    // End RolapCubeUsages.java