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) 2006-2007 Pentaho and others
008// All Rights Reserved.
009*/
010package mondrian.udf;
011
012import mondrian.olap.type.*;
013import mondrian.util.Format;
014
015/**
016 * User-defined function <code>CurrentDateMember</code>.  Arguments to the
017 * function are as follows:
018 *
019 * <blockquote>
020 * <code>
021 * CurrentDateMember(&lt;Hierarchy&gt;, &lt;FormatString&gt;)
022 * returns &lt;Member&gt;
023 * </code>
024 * </blockquote>
025 *
026 * The function returns the member from the specified hierarchy that matches
027 * the current date, to the granularity specified by the &lt;FormatString&gt;.
028 *
029 * The format string conforms to the format string implemented by
030 * {@link Format}.
031 *
032 * @author Zelaine Fong
033 */
034public class CurrentDateMemberExactUdf extends CurrentDateMemberUdf {
035
036    public String getDescription() {
037        return "Returns the exact member within the specified dimension "
038            + "corresponding to the current date, in the format specified by "
039            + "the format parameter. "
040            + "If there is no such date, returns the NULL member. "
041            + "Format strings are the same as used by the MDX Format function, "
042            + "namely the Visual Basic format strings. "
043            + "See http://www.apostate.com/programming/vb-format.html.";
044    }
045
046    public Type[] getParameterTypes() {
047        return new Type[] {
048            new HierarchyType(null, null),
049            new StringType()
050        };
051    }
052
053    public String[] getReservedWords() {
054        return null;
055    }
056}
057
058// End CurrentDateMemberExactUdf.java