KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > jpivot > xmla > XMLA_SwapAxes


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.xmla;
14
15 import com.tonbeller.jpivot.core.ExtensionSupport;
16 import com.tonbeller.jpivot.olap.mdxparse.ParsedQuery;
17 import com.tonbeller.jpivot.olap.navi.SwapAxes;
18
19 /**
20  * swap axes extension
21  */

22 public class XMLA_SwapAxes extends ExtensionSupport implements SwapAxes {
23
24   /**
25    * Constructor sets ID
26    */

27   public XMLA_SwapAxes() {
28     super.setId(SwapAxes.ID);
29   }
30
31   /**
32    * @see com.tonbeller.jpivot.olap.navi.SwapAxes#canSwapAxes()
33    * @return true, if the Mondrian Query exists and has two (or more?) axes
34    */

35   public boolean canSwapAxes() {
36     XMLA_Model model = (XMLA_Model) getModel();
37     ParsedQuery pQuery = model.getPQuery();
38     if (pQuery != null)
39       return (pQuery.getAxes().length >= 2);
40     else
41       return false;
42   }
43
44   /**
45    * @see com.tonbeller.jpivot.olap.navi.SwapAxes#setSwapAxes
46    */

47   public void setSwapAxes(boolean swap) {
48     XMLA_Model model = (XMLA_Model) getModel();
49     // swap the axes of the current query object
50
XMLA_QueryAdapter qad = (XMLA_QueryAdapter) model.getQueryAdapter();
51     qad.setSwapAxes(swap);
52   }
53
54   /**
55    * @see com.tonbeller.jpivot.olap.navi.SwapAxes#isSwapAxes
56    */

57   public boolean isSwapAxes() {
58     XMLA_Model model = (XMLA_Model) getModel();
59     // swap the axes of the current query object
60
XMLA_QueryAdapter qad = (XMLA_QueryAdapter) model.getQueryAdapter();
61     return qad.isSwapAxes();
62   }
63
64 } // End XMLA_SwapAxes
65
Popular Tags