Package org.pentaho.platform.plugin.action.mondrian.catalog

Examples of org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalogComplementInfo


    String whereMdx = ""; //$NON-NLS-1$
    StringBuffer rowsMdx = new StringBuffer();

    // Get catalog info, if exists
    String catalog = connection.getCatalogName();
    MondrianCatalogComplementInfo catalogComplementInfo =
      MondrianCatalogHelper.getInstance().getCatalogComplementInfoMap( catalog );

    try {

      Schema schema = connection.getSchema();
      if ( schema == null ) {
        Logger
          .error(
            "MondrianModelComponent", Messages.getInstance()
            .getErrorString( "MondrianModel.ERROR_0002_INVALID_SCHEMA",
              connection.getConnectString() ) ); //$NON-NLS-1$ //$NON-NLS-2$
        return null;
      }

      Cube[] cubes = schema.getCubes();
      if ( ( cubes == null ) || ( cubes.length == 0 ) ) {
        Logger
          .error(
            "MondrianModelComponent", Messages.getInstance()
            .getErrorString( "MondrianModel.ERROR_0003_NO_CUBES",
              connection.getConnectString() ) ); //$NON-NLS-1$ //$NON-NLS-2$
        return null;
      }

      if ( ( cubes.length > 1 ) && ( cubeName == null ) ) {
        Logger
          .error(
            "MondrianModelComponent", Messages.getInstance()
            .getErrorString( "MondrianModel.ERROR_0004_CUBE_NOT_SPECIFIED",
              connection.getConnectString() ) ); //$NON-NLS-1$ //$NON-NLS-2$
        return null;
      }

      Cube cube = null;
      if ( cubes.length == 1 ) {
        cube = cubes[ 0 ];
      } else {
        for ( Cube element : cubes ) {
          if ( element.getName().equals( cubeName ) ) {
            cube = element;
            break;
          }
        }
      }

      if ( cube == null ) {
        Logger
          .error(
            "MondrianModelComponent", Messages.getInstance()
            .getErrorString( "MondrianModel.ERROR_0005_CUBE_NOT_FOUND", cubeName,
              connection.getConnectString() ) ); //$NON-NLS-1$ //$NON-NLS-2$
        return null;
      }

      // If we have any whereConditions block, we need to find which hierarchies they are in
      // and not include them in the rows
      HashSet<Hierarchy> whereHierarchies = new HashSet<Hierarchy>();
      if ( catalogComplementInfo != null && catalogComplementInfo.getWhereCondition( cube.getName() ) != null
        && !catalogComplementInfo.getWhereCondition( cube.getName() ).equals( "" ) ) { //$NON-NLS-1$

        final String rawString = catalogComplementInfo.getWhereCondition( cube.getName() );

        // Caveat - It's possible that we have in the where condition a hierarchy that we don't have access
        // permissions; In this case, we'll ditch the where condition at all. Same for any error that
        // we find here
View Full Code Here

TOP

Related Classes of org.pentaho.platform.plugin.action.mondrian.catalog.MondrianCatalogComplementInfo

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.