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