001 /* 002 // $Id: //open/mondrian/src/main/mondrian/rolap/RolapVirtualCubeMeasure.java#2 $ 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) 2006-2006 Julian Hyde 007 // All Rights Reserved. 008 // You must accept the terms of that agreement to use this software. 009 */ 010 package mondrian.rolap; 011 012 import mondrian.olap.MondrianDef; 013 import mondrian.olap.CellFormatter; 014 015 /** 016 * Measure which is defined in a virtual cube, and based on a stored measure 017 * in one of the virtual cube's base cubes. 018 * 019 * @author jhyde 020 * @version $Id: //open/mondrian/src/main/mondrian/rolap/RolapVirtualCubeMeasure.java#2 $ 021 * @since Aug 18, 2006 022 */ 023 public class RolapVirtualCubeMeasure 024 extends RolapMember 025 implements RolapStoredMeasure 026 { 027 /** 028 * The measure in the underlying cube. 029 */ 030 private final RolapStoredMeasure cubeMeasure; 031 032 public RolapVirtualCubeMeasure( 033 RolapMember parentMember, 034 RolapLevel level, 035 RolapStoredMeasure cubeMeasure) 036 { 037 super(parentMember, level, cubeMeasure.getName()); 038 this.cubeMeasure = cubeMeasure; 039 } 040 041 public Object getPropertyValue(String propertyName, boolean matchCase) { 042 // Look first in this member (against the virtual cube), then 043 // fallback on the base measure. 044 // This allows, for instance, a measure to be invisible in a virtual 045 // cube but visible in its base cube. 046 Object value = super.getPropertyValue(propertyName, matchCase); 047 if (value == null) { 048 value = cubeMeasure.getPropertyValue(propertyName, matchCase); 049 } 050 return value; 051 } 052 053 public RolapCube getCube() { 054 return cubeMeasure.getCube(); 055 } 056 057 public Object getStarMeasure() { 058 return cubeMeasure.getStarMeasure(); 059 } 060 061 public MondrianDef.Expression getMondrianDefExpression() { 062 return cubeMeasure.getMondrianDefExpression(); 063 } 064 065 public RolapAggregator getAggregator() { 066 return cubeMeasure.getAggregator(); 067 } 068 069 public CellFormatter getFormatter() { 070 return cubeMeasure.getFormatter(); 071 } 072 } 073 074 // End RolapVirtualCubeMeasure.java