KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > mondrian > MondrianPosition


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.jpivot.mondrian;
14
15 import java.util.ArrayList JavaDoc;
16 import java.util.Iterator JavaDoc;
17 import java.util.List JavaDoc;
18 import com.tonbeller.jpivot.olap.query.PositionBase;
19
20 /**
21  * MondrianPosition is an adapter class for the Mondrian Position.
22  */

23 public class MondrianPosition extends PositionBase {
24
25   mondrian.olap.Position monPosition;
26   MondrianModel model;
27   private int iAxis; // Axis ordinal for result axis
28

29   /**
30    * Constructor
31    * create the array of members
32    * @param monPosition corresponding Mondrian Position
33    * @param model MondrianModel
34    */

35   MondrianPosition(mondrian.olap.Position monPosition, int iAxis, MondrianModel model) {
36     super();
37     this.monPosition = monPosition;
38     this.model = model;
39     this.iAxis = iAxis;
40     // extract the members
41
List JavaDoc l = new ArrayList JavaDoc();
42     Iterator JavaDoc mit = monPosition.iterator();
43     while (mit.hasNext()) {
44       mondrian.olap.Member monMember = (mondrian.olap.Member) mit.next();
45       l.add(model.lookupMemberByUName(monMember.getUniqueName()));
46     }
47     members = (MondrianMember[]) l.toArray(new MondrianMember[l.size()]);
48   }
49
50   /**
51    * get the Mondrian Members for this Axis Position
52    * @return Array of Mondrian members
53   mondrian.olap.Member[] getMonMembers() {
54   this is not used anywhere
55     return monPosition.getMembers();
56   }
57    */

58
59   /**
60    * Returns the iAxis.
61    * @return int
62    */

63   int getAxis() {
64     return iAxis;
65   }
66
67 } // MondrianPosition
68
Popular Tags