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) 2003-2005 Julian Hyde
008// Copyright (C) 2005-2010 Pentaho
009// All Rights Reserved.
010//
011// jhyde, May 2, 2003
012*/
013package mondrian.xmla;
014
015import org.olap4j.impl.UnmodifiableArrayMap;
016import org.olap4j.metadata.XmlaConstant;
017import org.olap4j.metadata.XmlaConstants;
018
019import java.util.List;
020import java.util.Map;
021
022/**
023 * Contains inner classes which define enumerations used in XML for Analysis.
024 *
025 * @author jhyde
026 * @since May 2, 2003
027 */
028public class Enumeration {
029    public final String name;
030    public final String description;
031    public final RowsetDefinition.Type type;
032    private final XmlaConstant.Dictionary<?> dictionary;
033
034    public static final Enumeration TREE_OP =
035        new Enumeration(
036            "TREE_OP",
037            "Bitmap which controls which relatives of a member are "
038            + "returned",
039            RowsetDefinition.Type.Integer,
040            org.olap4j.metadata.Member.TreeOp.getDictionary());
041
042    public static final Enumeration VISUAL_MODE =
043        new Enumeration(
044            "VisualMode",
045            "This property determines the default behavior for visual "
046            + "totals.",
047            RowsetDefinition.Type.Integer,
048            org.olap4j.metadata.XmlaConstants.VisualMode.getDictionary());
049
050    public static final Enumeration METHODS =
051        new Enumeration(
052            "Methods",
053            "Set of methods for which a property is applicable",
054            RowsetDefinition.Type.Enumeration,
055            XmlaConstants.Method.getDictionary());
056
057    public static final Enumeration ACCESS =
058        new Enumeration(
059            "Access",
060            "The read/write behavior of a property",
061            RowsetDefinition.Type.Enumeration,
062            XmlaConstants.Access.getDictionary());
063
064    public static final Enumeration AUTHENTICATION_MODE =
065        new Enumeration(
066            "AuthenticationMode",
067            "Specification of what type of security mode the data source "
068            + "uses.",
069            RowsetDefinition.Type.EnumString,
070            XmlaConstants.AuthenticationMode.getDictionary());
071
072    public static final Enumeration PROVIDER_TYPE =
073        new Enumeration(
074            "ProviderType",
075            "The types of data supported by the provider.",
076            RowsetDefinition.Type.Array,
077            XmlaConstants.ProviderType.getDictionary());
078
079    public Enumeration(
080        String name,
081        String description,
082        RowsetDefinition.Type type,
083        XmlaConstant.Dictionary<?> dictionary)
084    {
085        this.name = name;
086        this.description = description;
087        this.type = type;
088        this.dictionary = dictionary;
089    }
090
091    public String getName() {
092        return name;
093    }
094
095    public List<? extends Enum> getValues() {
096        return dictionary.getValues();
097    }
098
099    public enum ResponseMimeType {
100        SOAP("text/xml"),
101        JSON("application/json");
102
103        public static final Map<String, ResponseMimeType> MAP =
104            UnmodifiableArrayMap.of(
105                "application/soap+xml", SOAP,
106                "application/xml", SOAP,
107                "text/xml", SOAP,
108                "application/json", JSON,
109                "*/*", SOAP);
110
111        private final String mimeType;
112
113        ResponseMimeType(String mimeType) {
114            this.mimeType = mimeType;
115        }
116
117        public String getMimeType() {
118            return mimeType;
119        }
120    }
121
122}
123
124// End Enumeration.java