Package org.saiku.service.util.exception

Examples of org.saiku.service.util.exception.SaikuServiceException


      if (context.containsKey(queryName)) {
        QueryContext qc = context.remove(queryName);
        qc.destroy();
      }
    } catch (Exception e) {
      throw new SaikuServiceException(e);
    }
  }
View Full Code Here


        mdx += "\r\n RETURN " + returns;
      }
      ResultSet rs = stmt.executeQuery(mdx);
      return rs;
    } catch (SQLException e) {
      throw new SaikuServiceException("Error DRILLTHROUGH: " + queryName, e);
    } finally {
      try {
        if (stmt != null) {
          stmt.close();
        }
View Full Code Here

      final OlapConnection con = olapDiscoverService.getNativeConnection(cube.getConnection());
      stmt = con.createStatement();
      ResultSet rs = stmt.executeQuery(query.getMdx());
      return rs;
    } catch (SQLException e) {
      throw new SaikuServiceException("Error DRILLTHROUGH: " + query.getMdx() + " DRILLTHROUGH MDX:" + query.getMdx(),
          e);
    } finally {
      try {
        if (stmt != null) {
          stmt.close();
View Full Code Here

      LOG.debug("Drill Through for query (" + queryName + ") : \r\n" + select);
      ResultSet rs = stmt.executeQuery(select);
      return rs;
    } catch (Exception e) {
      throw new SaikuServiceException("Error DRILLTHROUGH: " + queryName, e);
    } finally {
      try {
        if (stmt != null) {
          stmt.close();
        }
View Full Code Here

      }

      ResultSet rs = stmt.executeQuery(mdx);
      return CsvExporter.exportCsv(rs);
    } catch (SQLException e) {
      throw new SaikuServiceException("Error DRILLTHROUGH: " + queryName, e);
    } finally {
      try {
        if (stmt != null) {
          stmt.close();
        }
View Full Code Here

        ThinQuery old = context.get(queryName).getOlapQuery();
        Cube cub = olapDiscoverService.getNativeCube(old.getCube());
        Query q = Fat.convert(old, cub);

        if (cs == null) {
          throw new SaikuServiceException("Cannot zoom in if last cellset is null");
        }
        if (realPositions == null || realPositions.size() == 0) {
          throw new SaikuServiceException("Cannot zoom in if zoom in position is empty");
        }

        Map<Hierarchy, Set<Member>> memberSelection = new HashMap<Hierarchy, Set<Member>>();
        for (List<Integer> position : realPositions) {
          for (int k = 0; k < position.size(); k++) {
            Position p = cs.getAxes().get(k).getPositions().get(position.get(k));
            List<Member> members = p.getMembers();
            for (Member m : members) {
              Hierarchy h = m.getHierarchy();
              if (!memberSelection.containsKey(h)) {
                Set<Member> mset = new HashSet<Member>();
                memberSelection.put(h, mset);
              }
              memberSelection.get(h).add(m);
            }
          }
        }


        for (Hierarchy h : memberSelection.keySet()) {
          QueryHierarchy qh = q.getHierarchy(h);
          for (QueryLevel ql : qh.getActiveQueryLevels()) {
            ql.getInclusions().clear();
            ql.getExclusions().clear();
            ql.setMdxSetExpression(null);
          }
          for (Member m : memberSelection.get(h)) {
            qh.includeMember(m);
          }
        }
        ThinQuery tqAfter = Thin.convert(q, old.getCube());
        q = null;
        return tqAfter;
      } else {
        throw new SaikuServiceException("Cannot get query result from context: " + queryName);
      }

    } catch (Exception e) {
      throw new SaikuServiceException("Error zoom in on query: " + queryName, e);
    }

  }
View Full Code Here

      CellSet cs = context.get(queryName).getOlapResult();


      Set<Level> levelSet = new HashSet<Level>();
      if (cs == null) {
        throw new SaikuServiceException("Cannot drill across. Last CellSet empty");
      }
      for (int i = 0; i < cellPosition.size(); i++) {
        List<Member> members = cs.getAxes().get(i).getPositions().get(cellPosition.get(i)).getMembers();
        for (Member m : members) {
          QueryHierarchy qh = query.getHierarchy(m.getHierarchy());
          if (qh.getHierarchy().getDimension().getName().equals("Measures")) {
            Measure measure = query.getMeasure(m.getName());
            if (!query.getDetails().getMeasures().contains(measure)) {
              query.getDetails().add(measure);
            }

          } else {
            qh.clearSelection();
            qh.clearFilters();
            qh.clearSort();
            query.moveHierarchy(qh, Axis.FILTER);
            qh.includeMember(m);
            levelSet.add(m.getLevel());
          }

        }
      }
      boolean clearedMeasures = false;

      if (levels != null) {
        for (String key : levels.keySet()) {
          String dimensionName = key.split("###")[0];

          if ("Measures".equals(dimensionName)) {
            if (!clearedMeasures) {
              query.getDetails().getMeasures().clear();
              clearedMeasures = true;
            }
            for (String measureName : levels.get(key)) {
              Measure measure = query.getMeasure(measureName);
              if (measure != null) {
                query.getDetails().add(measure);
              } else {
                for (Measure m : cub.getMeasures()) {
                  if (m.getUniqueName().equals(measureName)) {
                    query.getDetails().add(m);
                  }
                }
              }
            }
            continue;
          }
          String hierarchyName = key.split("###")[1];
          Dimension d = cub.getDimensions().get(dimensionName);
          Hierarchy h = d.getHierarchies().get(hierarchyName);
          QueryHierarchy qh = query.getHierarchy(h);
          for (Level l : h.getLevels()) {
            for (String levelU : levels.get(key)) {
              if (l.getUniqueName().equals(levelU) || l.getName().equals(levelU)) {
                qh.includeLevel(l);
              }
            }
          }
          if (qh.getActiveQueryLevels().size() > 0) {
            query.moveHierarchy(qh, Axis.ROWS);
          }
        }
      }
      if (query.getDetails().getMeasures().size() == 0) {
        QueryHierarchy qh = query.getHierarchy("Measures");
        Member defaultMeasure = qh.getHierarchy().getDefaultMember();
        query.getDetails().add(query.getMeasure(defaultMeasure.getName()));
      }
      return Thin.convert(query, old.getCube());
    } catch (Exception e) {
      throw new SaikuServiceException("Error drilling across: " + queryName, e);
    }
  }
View Full Code Here

          hierarchy.getDimension().getUniqueName(),
          hierarchy.isVisible(),
          convertLevels(hierarchy.getLevels()),
          convertMembers(hierarchy.getRootMembers()));
    } catch (OlapException e) {
      throw new SaikuServiceException("Cannot get root members", e);
    }
  }
View Full Code Here

          level.getDescription(),
          level.getDimension().getUniqueName(),
          level.getHierarchy().getUniqueName(),
          level.isVisible());
    } catch (Exception e) {
      throw new SaikuServiceException("Cannot convert level: " + level, e);
    }
  }
View Full Code Here

        }
      }
      return elements;

    } catch (Exception e) {
      throw new SaikuServiceException("Error converting ResultSet into SimpleCubeElement", e);
    } finally {
      if (rs != null) {
        Statement statement = null;
        Connection con = null;
        try {
          statement = rs.getStatement();

        } catch (Exception e) {
          throw new SaikuServiceException(e);
        } finally {
          try {
            rs.close();
            if (statement != null) {
              statement.close();
View Full Code Here

TOP

Related Classes of org.saiku.service.util.exception.SaikuServiceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.