1 13 package com.tonbeller.jpivot.mondrian; 14 15 import mondrian.olap.Util.PropertyList; 16 import mondrian.rolap.RolapConnectionProperties; 17 18 import com.tonbeller.jpivot.core.ExtensionSupport; 19 import com.tonbeller.jpivot.olap.model.Cell; 20 import com.tonbeller.jpivot.olap.navi.DrillThrough; 21 import com.tonbeller.wcf.table.TableModel; 22 27 public class MondrianDrillThrough extends ExtensionSupport implements DrillThrough { 28 29 private boolean extendedContext = true; 30 31 34 public MondrianDrillThrough() { 35 super.setId(DrillThrough.ID); 36 } 37 38 41 public boolean canDrillThrough(Cell cell) { 42 return ((MondrianCell) cell).getMonCell().canDrillThrough(); 43 } 46 47 50 public TableModel drillThrough(Cell cell) { 51 String sql = ((MondrianCell) cell).getMonCell().getDrillThroughSQL(extendedContext); 52 if (sql == null) { 53 throw new NullPointerException ("DrillThroughSQL returned null"); 54 } 55 MondrianDrillThroughTableModel dtm = new MondrianDrillThroughTableModel(); 56 dtm.setSql(sql); 57 PropertyList connectInfo = ((MondrianModel) getModel()).getConnectProperties(); 58 String jdbcUrl = connectInfo.get(RolapConnectionProperties.Jdbc.name()); 59 String jdbcUser = connectInfo.get(RolapConnectionProperties.JdbcUser.name()); 60 String jdbcPassword = connectInfo.get(RolapConnectionProperties.JdbcPassword.name()); 61 String dataSourceName = connectInfo.get(RolapConnectionProperties.DataSource.name()); 62 dtm.setJdbcUrl(jdbcUrl); 63 dtm.setJdbcUser(jdbcUser); 64 dtm.setJdbcPassword(jdbcPassword); 65 dtm.setDataSourceName(dataSourceName); 66 return dtm; 67 } 68 69 public boolean isExtendedContext() { 70 return extendedContext; 71 } 72 73 public void setExtendedContext(boolean extendedContext) { 74 this.extendedContext = extendedContext; 75 } 76 77 } 78 | Popular Tags |