Package org.pentaho.platform.api.repository2.unified

Examples of org.pentaho.platform.api.repository2.unified.UnifiedRepositoryException


    FileRecord src = idManager.getFileById( fileId );
    FileRecord dest = root.getFileRecord( destAbsPath );
    String newName = src.getFile().getName();
    if ( dest != null ) {
      if ( !dest.getFile().isFolder() ) {
        throw new UnifiedRepositoryException( "file already exists" );
      }
    } else {
      // find parent folder
      String parentPath = StringUtils.substringBeforeLast( destAbsPath, RepositoryFile.SEPARATOR );
      FileRecord parent = root.getFileRecord( parentPath );
      if ( parent == null ) {
        throw new UnifiedRepositoryException( "invalid destination path" );
      }
      dest = parent;
      newName = StringUtils.substringAfterLast( destAbsPath, RepositoryFile.SEPARATOR );
    }
    String newPath =
View Full Code Here


          // Load any I18N bundles
          loadLocaleStrings( domainId, domain );
          logger.debug( "loaded I18N bundles" );
        } else {
          throw new UnifiedRepositoryException( messages.getErrorString(
              "PentahoMetadataDomainRepository.ERROR_0005_ERROR_RETRIEVING_DOMAIN", domainId, "not found" ) );

        }
      }
    } catch ( Exception e ) {
      throw new UnifiedRepositoryException( messages.getErrorString(
          "PentahoMetadataDomainRepository.ERROR_0005_ERROR_RETRIEVING_DOMAIN",
        domainId, e.getLocalizedMessage() ), e );
    }

    // Return
View Full Code Here

      } else {
        logger.warn( "Could not load properties from repository file: " + bundle.getName() );
      }
      return properties;
    } catch ( IOException e ) {
      throw new UnifiedRepositoryException( messages.getErrorString(
          "PentahoMetadataDomainRepository.ERROR_0008_ERROR_IN_REPOSITORY", e.getLocalizedMessage() ), e );
    }
  }
View Full Code Here

        }

      }

      // no converter; throw general exception
      throw new UnifiedRepositoryException( Messages.getInstance().getString(
          "ExceptionLoggingDecorator.generalException", message, refNum ) ); //$NON-NLS-1$

    }
  }
View Full Code Here

    // copy doesn't increase version number
    assertTrue( versionSummaries.size() >= 1 );
    assertEquals( USERNAME_SUZY, versionSummaries.get( 0 ).getAuthor() );

    logger.info( "getVersionSummary" );
    VersionSummary versionSummary = repo.getVersionSummary( file1.getId(), null );
    assertNotNull( versionSummary );
    assertNotNull( versionSummary.getId() );

    logger.info( "getFileAtVersion" );
    RepositoryFile file1AtVersion = repo.getFileAtVersion( file1.getId(), versionSummary.getId() );
    assertNotNull( file1AtVersion );
    assertEquals( versionSummary.getId(), file1AtVersion.getVersionId() );

    logger.info( "getTree" );
    RepositoryFileTree tree = repo.getTree( new RepositoryRequest( ClientRepositoryPaths.getRootFolderPath(), true, -1, null ) );
    assertNotNull( tree.getFile().getId() );
View Full Code Here

        RepositoryFile metadata =
          unifiedRepository.getFile( etcMondrian + RepositoryFile.SEPARATOR + catalogName + RepositoryFile.SEPARATOR
            + "metadata" ); //$NON-NLS-1$

        if ( metadata != null ) {
          DataNode metadataNode =
            unifiedRepository.getDataForRead( metadata.getId(), NodeRepositoryFileData.class ).getNode();
          String datasourceInfo = metadataNode.getProperty( "datasourceInfo" ).getString(); //$NON-NLS-1$
          String definition = metadataNode.getProperty( "definition" ).getString(); //$NON-NLS-1$

          datasourcesXML.append( "<Catalog name=\"" + encoder.encodeForXML( catalogName ) + "\">\n" ); //$NON-NLS-1$ //$NON-NLS-2$
          datasourcesXML
            .append( "<DataSourceInfo>" + encoder.encodeForXML( datasourceInfo ) + "</DataSourceInfo>\n" ); //$NON-NLS-1$ //$NON-NLS-2$
          datasourcesXML.append( "<Definition>" + encoder.encodeForXML( definition ) + "</Definition>\n" ); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

    final TimeZone defaultTimeZone = TimeZone.getDefault();
    final String DATE_PROPERTY = "date"; //$NON-NLS-1$

    NodeRepositoryFileDataAdapter adapter = new NodeRepositoryFileDataAdapter();
    Date date = new Date();
    DataNode node = new DataNode( "" ); //$NON-NLS-1$
    node.setProperty( DATE_PROPERTY, date );
    NodeRepositoryFileData data = new NodeRepositoryFileData( node );
    NodeRepositoryFileData result;

    // Convert using the provided locale
    try {
View Full Code Here

    logger.info( "getReservedChars" );
    assertFalse( repo.getReservedChars().isEmpty() );
  }

  private NodeRepositoryFileData makeNodeRepositoryFileData1() {
    DataNode node = new DataNode( "testNode" );
    node.setProperty( "prop1", "hello world" );
    node.setProperty( "prop2", false );
    node.setProperty( "prop3", 12L );
    return new NodeRepositoryFileData( node );
  }
View Full Code Here

    } finally {
      Locale.setDefault( defaultLocale );
      TimeZone.setDefault( defaultTimeZone );
    }

    DataProperty property = result.getNode().getProperty( DATE_PROPERTY );
    assertNotNull( property );
    assertEquals( date, property.getDate() );
  }
View Full Code Here

    NodeRepositoryFileDataAdapter adapter = new NodeRepositoryFileDataAdapter();
    Date date = new Date();
    DataNode node = new DataNode( "" ); //$NON-NLS-1$
    node.setProperty( DATE_PROPERTY, date );
    NodeRepositoryFileData data = new NodeRepositoryFileData( node );
    NodeRepositoryFileData result;

    // Convert using the provided locale
    try {
      Locale.setDefault( locale );
      TimeZone.setDefault( timeZone );
      NodeRepositoryFileDataDto dto = adapter.marshal( data );
      result = adapter.unmarshal( dto );
    } finally {
      Locale.setDefault( defaultLocale );
      TimeZone.setDefault( defaultTimeZone );
    }

    DataProperty property = result.getNode().getProperty( DATE_PROPERTY );
    assertNotNull( property );
    assertEquals( date, property.getDate() );
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.repository2.unified.UnifiedRepositoryException

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.