001 /* 002 // This software is subject to the terms of the Common Public License 003 // Agreement, available at the following URL: 004 // http://www.opensource.org/licenses/cpl.html. 005 // Copyright (C) 2007-2007 Julian Hyde 006 // All Rights Reserved. 007 // You must accept the terms of that agreement to use this software. 008 */ 009 package mondrian.olap4j; 010 011 import org.olap4j.metadata.NamedSet; 012 import org.olap4j.metadata.Cube; 013 import org.olap4j.mdx.ParseTreeNode; 014 import org.olap4j.impl.Named; 015 016 import java.util.Locale; 017 018 /** 019 * Implementation of {@link org.olap4j.metadata.NamedSet} 020 * for the Mondrian OLAP engine. 021 * 022 * @author jhyde 023 * @version $Id: //open/mondrian/src/main/mondrian/olap4j/MondrianOlap4jNamedSet.java#1 $ 024 * @since Nov 12, 2007 025 */ 026 public class MondrianOlap4jNamedSet implements NamedSet, Named { 027 private final MondrianOlap4jCube olap4jCube; 028 private mondrian.olap.NamedSet namedSet; 029 030 MondrianOlap4jNamedSet( 031 MondrianOlap4jCube olap4jCube, 032 mondrian.olap.NamedSet namedSet) 033 { 034 this.olap4jCube = olap4jCube; 035 this.namedSet = namedSet; 036 } 037 038 public Cube getCube() { 039 return olap4jCube; 040 } 041 042 public ParseTreeNode getExpression() { 043 final MondrianOlap4jConnection olap4jConnection = 044 olap4jCube.olap4jSchema.olap4jCatalog.olap4jDatabaseMetaData 045 .olap4jConnection; 046 return olap4jConnection.toOlap4j(namedSet.getExp()); 047 } 048 049 public String getName() { 050 return namedSet.getName(); 051 } 052 053 public String getUniqueName() { 054 return namedSet.getUniqueName(); 055 } 056 057 public String getCaption(Locale locale) { 058 // todo: i18n 059 return namedSet.getCaption(); 060 } 061 062 public String getDescription(Locale locale) { 063 // todo: i18n 064 return namedSet.getDescription(); 065 } 066 } 067 068 // End MondrianOlap4jNamedSet.java