Package org.olap4j

Examples of org.olap4j.OlapException$Region


    public OlapException createException(Throwable cause) {
        return new OlapException(cause.getMessage(), cause);
    }

    public OlapException createException(String msg, Throwable cause) {
        return new OlapException(msg, cause);
    }
View Full Code Here


    public OlapException createException(String msg, Throwable cause) {
        return new OlapException(msg, cause);
    }

    public OlapException createException(Cell context, String msg) {
        OlapException exception = new OlapException(msg);
        exception.setContext(context);
        return exception;
    }
View Full Code Here

    }

    public OlapException createException(
        Cell context, String msg, Throwable cause)
    {
        OlapException exception = new OlapException(msg, cause);
        exception.setContext(context);
        return exception;
    }
View Full Code Here

    public OlapException toOlapException(SQLException e) {
        if (e instanceof OlapException) {
            return (OlapException) e;
        } else {
            return new OlapException(null, e);
        }
    }
View Full Code Here

      final OlapConnection olapConnection = wrapper
          .unwrap(OlapConnection.class);

      if (olapConnection == null) {
        throw new OlapException("Services.Session.NullConnection"); //$NON-NLS-1$
      } else {

        // sessions.get(userId).get(sessionId).putConnection(connectionId,
        // olapConnection);

        // Obtaining a connection object doesn't mean that the
        // credentials are ok or whatever. We'll test it.
        // this.discoveryService.getCubes(userId, sessionId,
        // connectionId);

        return connectionId;

      }

    } catch (ClassNotFoundException e) {
      // LOG.error(e);
      throw new OlapException(e.getMessage(), e);
    } catch (SQLException e) {
      // LOG.error(e);
      throw new OlapException(e.getMessage(), e);
    } catch (RuntimeException e) {
      // The XMLA driver wraps some exceptions in Runtime stuff.
      // That's on the FIX ME list but not fixed yet... c(T-T)b
      if (e.getCause() instanceof OlapException) {
        throw (OlapException) e.getCause();
View Full Code Here

          setTotals(q, queryElement);
          Properties p = getProperties(queryElement);
          q.setProperties(p);
          return q;
        } else {
          throw new OlapException("Can't find child <QueryModel>");
        }

      } catch (OlapException e) {
        throw new QueryParseException(e.getMessage(), e);
      }
View Full Code Here

          SaikuCube cube = new SaikuCube(connectionName, cubeName, cubeName, cubeName, catalogName, schemaName);
          IQuery q = new MdxQuery(connection, cube, queryName, mdxElement.getText());
          q.setProperties(props);
          return q;
        } else {
          throw new OlapException("Can't find child <MDX>");
        }

      } catch (OlapException e) {
        throw new QueryParseException(e.getMessage(), e);
      }
View Full Code Here

      for (int i = 0; i < axesElement.getChildren("Axis").size(); i++) {
        Element axisElement = (Element) axesElement.getChildren("Axis").get(i);

        String location = axisElement.getAttributeValue("location");
        if (!StringUtils.isNotBlank(location)) {
          throw new OlapException("Location for Axis Element can't be null");
        }

        QueryAxis qAxis = qm.getAxes().get(getAxisName(location));

        String nonEmpty = axisElement.getAttributeValue("nonEmpty");
View Full Code Here

    if (StringUtils.isNotBlank(dimName)) {

      QueryDimension dim = qm.getDimension(dimName);

      if (dim == null) {
        throw new OlapException("Dimension not found:" + dimName);
      }

      String sortOrder = dimension.getAttributeValue("sortOrder");
      if (StringUtils.isNotBlank(sortOrder)) {
        dim.sort(SortOrder.valueOf(sortOrder));
      }

      String hierarchizeMode = dimension.getAttributeValue("hierarchizeMode");
      if (StringUtils.isNotBlank(hierarchizeMode)) {
        dim.setHierarchizeMode(HierarchizeMode.valueOf(hierarchizeMode));
      }

      String hierarchyConsistent = dimension.getAttributeValue("hierarchyConsistent");
      if (StringUtils.isNotBlank(hierarchyConsistent)) {
        dim.setHierarchyConsistent(Boolean.parseBoolean(hierarchyConsistent));
      }

      qm.getAxes().get(Axis.Standard.valueOf(location)).getDimensions().add(dim);

      Element inclusions = dimension.getChild("Inclusions");
      if (inclusions != null) {
        for (int z = 0; z < inclusions.getChildren(SELECTION).size(); z++) {
          Element selectionElement = (Element) inclusions.getChildren(SELECTION).get(z);
          String name = selectionElement.getAttributeValue("node");
          String operator = selectionElement.getAttributeValue("operator");
          String type = selectionElement.getAttributeValue("type");
          Selection sel = null;
          if ("level".equals(type)) {
            for (Hierarchy hierarchy : dim.getDimension().getHierarchies()) {
              for (Level level : hierarchy.getLevels()) {
                if (level.getUniqueName().equals(name)) {
                  sel = dim.include(level);
                }
              }
            }
          } else if ("member".equals(type)) {
            sel = dim.include(Selection.Operator.valueOf(operator),
                IdentifierNode.parseIdentifier(name).getSegmentList());
          }


          Element contextElement = selectionElement.getChild("Context");
          if (sel != null && contextElement != null) {
            for (int h = 0; h < contextElement.getChildren(SELECTION).size(); h++) {
              Element context = (Element) contextElement.getChildren(SELECTION).get(h);
              String contextname = context.getAttributeValue("node");
              String contextoperator = context.getAttributeValue("operator");
              String contextDimension = context.getAttributeValue("dimension");
              QueryDimension contextDim = qm.getDimension(contextDimension);
              if (contextDim != null) {
                Selection contextSelection = contextDim.createSelection(Selection.Operator.valueOf(contextoperator),
                    IdentifierNode.parseIdentifier(contextname)
                                  .getSegmentList());
                if (contextSelection != null) {
                  sel.addContext(contextSelection);
                } else {
                  throw new OlapException(
                      "Cannot create selection for node: " + contextname + " operator:" + contextoperator
                      + " on dimension: " + dim.getName()
                  );
                }
              } else {
                throw new OlapException("Context dimension is null");
              }
            }

          }

        }
      }

      Element exclusions = dimension.getChild("Exclusions");
      if (inclusions != null) {
        for (int z = 0; z < exclusions.getChildren(SELECTION).size(); z++) {
          Element selectionElement = (Element) exclusions.getChildren(SELECTION).get(z);
          String name = selectionElement.getAttributeValue("node");
          String operator = selectionElement.getAttributeValue("operator");
          dim
              .exclude(Selection.Operator.valueOf(operator), IdentifierNode.parseIdentifier(name).getSegmentList());
          // ADD CONTEXT ?
        }
      }

    } else {
      throw new OlapException("No Dimension name defined");
    }


  }
View Full Code Here

      throws SQLException {
    if (!StringUtils.isNotBlank(catalogName)) {
      try {
        connection.setCatalog(catalogName);
      } catch (SQLException e) {
        throw new OlapException(e.getMessage(), e);
      }
    }

    Cube cube = null;
    if (connection != null) {
      for (Database db : connection.getOlapDatabases()) {
        Catalog cat = db.getCatalogs().get(catalogName);
        if (cat != null) {
          for (Schema schema : cat.getSchemas()) {
            if (schema.getName().equals(schemaName)
                || (schema.getName().equals("") && schemaName == null)) {
              for (Cube cub : schema.getCubes()) {
                if (cub.getName().equals(cubeName) || cub.getUniqueName().equals(cubeName)) {
                  cube = cub;
                }
              }
            }
          }
        }
      }
    }
    if (cube != null) {
      try {
        return new Query(queryName, cube);
      } catch (SQLException e) {
        throw new OlapException("Error creating query :" + queryName, e);
      }
    } else {
      throw new OlapException("No Cube with name: " + cubeName + " found");
    }

  }
View Full Code Here

TOP

Related Classes of org.olap4j.OlapException$Region

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.