001 /*
002 // $Id: DrillDownOnPositionTransform.java 482 2012-01-05 23:27:27Z jhyde $
003 //
004 // Licensed to Julian Hyde under one or more contributor license
005 // agreements. See the NOTICE file distributed with this work for
006 // additional information regarding copyright ownership.
007 //
008 // Julian Hyde licenses this file to you under the Apache License,
009 // Version 2.0 (the "License"); you may not use this file except in
010 // compliance with the License. You may obtain a copy of the License at:
011 //
012 // http://www.apache.org/licenses/LICENSE-2.0
013 //
014 // Unless required by applicable law or agreed to in writing, software
015 // distributed under the License is distributed on an "AS IS" BASIS,
016 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 // See the License for the specific language governing permissions and
018 // limitations under the License.
019 */
020 package org.olap4j.transform;
021
022 import org.olap4j.*;
023 import org.olap4j.mdx.*;
024 import org.olap4j.metadata.Member;
025
026 import java.util.List;
027
028 /**
029 * Drill down on position transform
030 *
031 * TODO: transform to be completed, not working for now.
032 *
033 * <p>Description: Adds the children of a member at a specific position on an
034 * axis. The member to drill is identified from a CellSet with the axis,
035 * positionOrdinalInAxis and memberOrdinalInPosition arguments. The drilled
036 * member will still be present on the axis, in addition to its children. It
037 * is recommended to apply a Hierarchize transform to the same axis of the
038 * resulting query, in order to have members in correct hierarchical order.
039 *
040 * <p>Example of use: the user clicks on a member in a crosstab axis, in order
041 * to see its children in addition to the member itself.
042 *
043 * <p>Applicability: this transform is applicable only to members in a query
044 * that are drillable, i.e. non-leaf members. The CellSet resulting from the
045 * execution of the initial MDX query must also be available.
046 *
047 * @author etdub
048 * @author jhyde
049 * @version $Id: DrillDownOnPositionTransform.java 482 2012-01-05 23:27:27Z jhyde $
050 * @since Jul 30, 2008
051 */
052 public class DrillDownOnPositionTransform extends AxisTransform {
053
054 // private final int positionOrdinalInAxis;
055 // private final int memberOrdinalInPosition;
056 // private final CellSet cellSet;
057
058 private final Position positionToDrill;
059 private final Member memberToDrill;
060 private final List<Member> pathToMember;
061
062 /**
063 * ctor
064 *
065 * @param axis
066 * @param positionOrdinalInAxis
067 * @param memberOrdinalInPosition
068 * @param cellSet
069 */
070 public DrillDownOnPositionTransform(
071 Axis axis,
072 int positionOrdinalInAxis,
073 int memberOrdinalInPosition,
074 CellSet cellSet)
075 {
076 super(axis);
077 // this.positionOrdinalInAxis = positionOrdinalInAxis;
078 // this.memberOrdinalInPosition = memberOrdinalInPosition;
079 // this.cellSet = cellSet;
080
081 positionToDrill =
082 TransformUtil.getPositionFromCellSet(
083 axis, positionOrdinalInAxis, cellSet);
084 memberToDrill = TransformUtil.getMemberFromCellSet(
085 axis, positionOrdinalInAxis, memberOrdinalInPosition, cellSet);
086 pathToMember = TransformUtil.getPathToMember(
087 positionToDrill,
088 memberOrdinalInPosition);
089 }
090
091 public String getName() {
092 return "Drill down a member on a specific position";
093 }
094
095 public String getDescription() {
096 return "Expand a member on a position by adding its children";
097 }
098
099 @Override
100 protected ParseTreeNode processAxisExp(ParseTreeNode exp) {
101 // TODO: implement me!
102
103 return null;
104 }
105
106
107 // visitor for a tree of expressions inside a query axis
108 // (not sure this should go here)
109 class DrillDownOnPositionVisitor
110 implements ParseTreeVisitor<ParseTreeNode>
111 {
112
113 public ParseTreeNode visit(SelectNode selectNode) {
114 // TODO Auto-generated method stub
115 return null;
116 }
117
118 public ParseTreeNode visit(AxisNode axis) {
119 // TODO Auto-generated method stub
120 return null;
121 }
122
123 public ParseTreeNode visit(WithMemberNode calcMemberNode) {
124 // TODO Auto-generated method stub
125 return null;
126 }
127
128 public ParseTreeNode visit(WithSetNode calcSetNode) {
129 // TODO Auto-generated method stub
130 return null;
131 }
132
133 public ParseTreeNode visit(CallNode call) {
134 // TODO Auto-generated method stub
135 return null;
136 }
137
138 public ParseTreeNode visit(IdentifierNode id) {
139 // TODO Auto-generated method stub
140 return null;
141 }
142
143 public ParseTreeNode visit(ParameterNode parameterNode) {
144 // TODO Auto-generated method stub
145 return null;
146 }
147
148 public ParseTreeNode visit(CubeNode cubeNode) {
149 // TODO Auto-generated method stub
150 return null;
151 }
152
153 public ParseTreeNode visit(DimensionNode dimensionNode) {
154 // TODO Auto-generated method stub
155 return null;
156 }
157
158 public ParseTreeNode visit(HierarchyNode hierarchyNode) {
159 // TODO Auto-generated method stub
160 return null;
161 }
162
163 public ParseTreeNode visit(LevelNode levelNode) {
164 // TODO Auto-generated method stub
165 return null;
166 }
167
168 public ParseTreeNode visit(MemberNode memberNode) {
169 // TODO Auto-generated method stub
170 return null;
171 }
172
173 public ParseTreeNode visit(LiteralNode literalNode) {
174 // TODO Auto-generated method stub
175 return null;
176 }
177
178 public ParseTreeNode visit(PropertyValueNode propertyValueNode) {
179 // TODO Auto-generated method stub
180 return null;
181 }
182 }
183
184 }
185
186 // End DrillDownOnPositionTransform.java