1 20 package org.openi.analysis; 21 22 import java.util.Collection ; 23 import java.util.HashMap ; 24 import java.util.Iterator ; 25 import java.util.LinkedList ; 26 import java.util.List ; 27 import java.util.Map ; 28 29 import org.openi.xmla.XmlaConnector; 30 31 import com.tonbeller.jpivot.olap.model.OlapException; 32 import com.tonbeller.jpivot.olap.model.OlapItem; 33 34 37 public class AnalysisGenerator { 38 39 42 public AnalysisGenerator() { 43 super(); 44 } 45 public Map generateMdxForDimensions(String uri, String catalog, String cube) throws OlapException{ 46 return this.generateMdxForDimensions(uri, catalog, cube, null, null); 47 } 48 49 55 public Map generateMdxForDimensions(String uri, String catalog, String cube, String user, String pwd) throws OlapException { 56 Map mdx = new HashMap (); 57 Iterator dimensions = discoverDimensions(uri, catalog, cube, user, pwd).iterator(); 58 while(dimensions.hasNext()){ 59 String dimensionName = (String )dimensions.next(); 60 if(!"measures".equalsIgnoreCase(dimensionName) ){ 61 mdx.put("by " + dimensionName, generateMdx(uri, catalog, user, pwd, cube, dimensionName) ); 62 } 63 } 64 return mdx; 65 } 66 67 68 69 private String generateMdx(String uri, String catalog, String user, String pwd, String cube, String dimensionName) throws OlapException{ 70 return new XmlaConnector().createDefaultMdx(uri, catalog, user, pwd, cube, dimensionName); 71 } 72 73 private List discoverCubes(String uri, String catalog, String user, String pwd) throws OlapException{ 74 return new XmlaConnector().getCubeList(uri, catalog, user, pwd); 75 } 76 77 private List discoverDimensions(String uri, String catalog, String cube, String user, String pwd) throws OlapException{ 78 return new XmlaConnector().getDimensionList(uri, catalog, cube, user, pwd); 79 } 80 81 82 83 89 public Collection generate(String uri, String catalog, String cube) { 90 Collection analyses = new LinkedList (); 91 return analyses; 92 } 93 94 } 95 | Popular Tags |