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) 1998-2005 Julian Hyde
008// Copyright (C) 2005-2011 Pentaho and others
009// All Rights Reserved.
010*/
011package mondrian.olap;
012
013import java.util.Locale;
014
015/**
016 * An <code>OlapElement</code> is a catalog object (dimension, hierarchy,
017 * level, member).
018 *
019 * @author jhyde, 21 January, 1999
020 */
021public interface OlapElement {
022    String getUniqueName();
023    String getName();
024
025    String getDescription();
026
027    /**
028     * Looks up a child element, returning null if it does not exist.
029     */
030    OlapElement lookupChild(
031        SchemaReader schemaReader,
032        Id.Segment s,
033        MatchType matchType);
034
035    /**
036     * Returns the name of this element qualified by its class, for example
037     * "hierarchy 'Customers'".
038     */
039    String getQualifiedName();
040
041    String getCaption();
042
043    /**
044     * Returns the value of a property (caption or description) of
045     * this element in the given locale.
046     *
047     * @param locale Locale
048     * @return Localized caption or description
049     */
050    String getLocalized(LocalizedProperty prop, Locale locale);
051
052    Hierarchy getHierarchy();
053
054    /**
055     * Returns the dimension of a this expression, or null if no dimension is
056     * defined. Applicable only to set expressions.
057     *
058     * <p>Example 1:
059     * <blockquote><pre>
060     * [Sales].children
061     * </pre></blockquote>
062     * has dimension <code>[Sales]</code>.</p>
063     *
064     * <p>Example 2:
065     * <blockquote><pre>
066     * order(except([Promotion Media].[Media Type].members,
067     *              {[Promotion Media].[Media Type].[No Media]}),
068     *       [Measures].[Unit Sales], DESC)
069     * </pre></blockquote>
070     * has dimension [Promotion Media].</p>
071     *
072     * <p>Example 3:
073     * <blockquote><pre>
074     * CrossJoin([Product].[Product Department].members,
075     *           [Gender].members)
076     * </pre></blockquote>
077     * has no dimension (well, actually it is [Product] x [Gender], but we
078     * can't represent that, so we return null);</p>
079     */
080    Dimension getDimension();
081
082    /**
083     * Returns whether this element is visible to end-users.
084     *
085     * <p>Visibility is a hint for client applications. An element's visibility
086     * does not affect how it is treated when MDX queries are evaluated.
087     *
088     * @return Whether this element is visible
089     */
090    boolean isVisible();
091
092    enum LocalizedProperty {
093        CAPTION,
094        DESCRIPTION
095    }
096}
097
098// End OlapElement.java