1 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.mdxparse.QueryAxis; 18 import com.tonbeller.jpivot.olap.navi.NonEmpty; 19 20 23 public class XMLA_NonEmpty extends ExtensionSupport implements NonEmpty { 24 25 26 29 public XMLA_NonEmpty() { 30 super.setId(NonEmpty.ID); 31 } 32 33 36 public boolean isNonEmpty() { 37 38 XMLA_Model m = (XMLA_Model) getModel(); 39 XMLA_QueryAdapter adapter = (XMLA_QueryAdapter) m.getQueryAdapter(); 40 ParsedQuery pQuery = adapter.getParsedQuery(); 41 42 46 QueryAxis[] qAxes = pQuery.getAxes(); 47 for (int i = 0; i < qAxes.length; i++) { 48 QueryAxis qAxis = qAxes[i]; 49 if (!qAxis.isNonEmpty()) 50 return false; 51 } 52 return true; 54 } 55 56 59 public void setNonEmpty(boolean nonEmpty) { 60 61 XMLA_Model m = (XMLA_Model) getModel(); 62 XMLA_QueryAdapter adapter = (XMLA_QueryAdapter) m.getQueryAdapter(); 63 ParsedQuery pQuery = adapter.getParsedQuery(); 64 65 68 boolean bChange = false; 69 QueryAxis[] qAxes = pQuery.getAxes(); 70 for (int i = 0; i < qAxes.length; i++) { 71 QueryAxis qAxis = qAxes[i]; 72 if (qAxis.isNonEmpty() != nonEmpty) { 73 qAxis.setNonEmpty(nonEmpty); 74 bChange = true; 75 } 76 } 77 78 if (bChange) 79 m.fireModelChanged(); 80 81 } 82 83 84 } | Popular Tags |