Examples of NodeRepositoryFileData


Examples of org.pentaho.platform.api.repository2.unified.data.node.NodeRepositoryFileData

    newChild1.setProperty( "tttss4", "843skdfj33ksaljdfj" );
    newChild1.setProperty( "urei2", new DataNodeRef( sampleFile.getId() ) );
    DataNode newChild2 = node.addNode( JcrStringHelper.fileNameEncode( "pppq/qqs2" ) );
    newChild2.setProperty( JcrStringHelper.fileNameEncode( "ttt*ss4" ), "843skdfj33ksaljdfj" );

    NodeRepositoryFileData data = new NodeRepositoryFileData( node );
    RepositoryFile newFile =
        repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( expectedName ).build(), data, null );

    assertNotNull( newFile.getId() );
    RepositoryFile foundFile = repo.getFile( expectedPath );
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.node.NodeRepositoryFileData

  }

  private void testSymbol( char symbol, boolean isGood ) {
    DataNode goodNode = new DataNode( "node" );
    goodNode.setProperty( "property", "whatever" );
    NodeRepositoryFileData goodNodeData = new NodeRepositoryFileData( goodNode );

    DataNode badNode = new DataNode( "node" + symbol );
    badNode.setProperty( "property", "whatever" );
    NodeRepositoryFileData badNodeData = new NodeRepositoryFileData( badNode );

    DataNode goodNodeBadProp = new DataNode( "node" );
    goodNodeBadProp.setProperty( "property" + symbol, "whatever" );
    NodeRepositoryFileData goodNodeBadPropData = new NodeRepositoryFileData( goodNodeBadProp );

    final String parentFolderPath =
        ClientRepositoryPaths.getUserHomeFolderPath( PentahoSessionHolder.getSession().getName() );
    RepositoryFile parentFolder = repo.getFile( parentFolderPath );
    try {
      final String name = "folder" + symbol;
      final RepositoryFile folder =
          repo.createFolder( parentFolder.getId(), new RepositoryFile.Builder( name ).folder( true ).build(), null );
      failIfTrue( !isGood, symbol );
      assertEquals( name, folder.getName() );
    } catch ( UnifiedRepositoryMalformedNameException e ) {
      failIfTrue( isGood, symbol );
    }
    try {
      final String name = "file" + symbol;
      final RepositoryFile file =
          repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( name ).build(), goodNodeData, null );
      failIfTrue( !isGood, symbol );
      assertEquals( name, file.getName() );
    } catch ( UnifiedRepositoryMalformedNameException e ) {
      failIfTrue( isGood, symbol );
    }
    try {
      final RepositoryFile file = repo.getFile( parentFolder.getPath() + RepositoryFile.SEPARATOR + "file" );
      if ( file != null ) {
        repo.deleteFile( file.getId(), null );
      }
      final RepositoryFile file1 =
          repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( "file" ).build(), badNodeData, null );
      failIfTrue( !isGood, symbol );
      assertEquals( badNodeData.getNode().getName(), repo.getDataForRead( file1.getId(), NodeRepositoryFileData.class )
          .getNode().getName() );
    } catch ( UnifiedRepositoryMalformedNameException e ) {
      failIfTrue( isGood, symbol );
    }
    try {
      final RepositoryFile file = repo.getFile( parentFolder.getPath() + RepositoryFile.SEPARATOR + "file" );
      if ( file != null ) {
        repo.deleteFile( file.getId(), null );
      }
      final RepositoryFile file1 =
          repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( "file" ).build(), goodNodeBadPropData,
              null );
      failIfTrue( !isGood, symbol );
      assertEquals( goodNodeBadPropData.getNode().getProperties().iterator().next().getName(), repo.getDataForRead(
          file1.getId(), NodeRepositoryFileData.class ).getNode().getProperties().iterator().next().getName() );
    } catch ( UnifiedRepositoryMalformedNameException e ) {
      failIfTrue( isGood, symbol );
    }
  }
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.node.NodeRepositoryFileData

      RepositoryFile file =
          new RepositoryFile.Builder( RepositoryFilenameUtils.escape( databaseConnection.getName()
              + RepositoryObjectType.DATABASE.getExtension(), cachedReservedChars ) ).title(
              RepositoryFile.DEFAULT_LOCALE, databaseConnection.getName() ).versioned( true ).build();
      file =
          repository.createFile( getDatabaseParentFolderId(), file, new NodeRepositoryFileData( databaseHelper
              .databaseConnectionToDataNode( databaseConnection ) ), null );
      if ( file != null && file.getId() != null ) {
        return file.getId().toString();
      } else {
        return null;
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.node.NodeRepositoryFileData

  }

  private IDatabaseConnection getDatasource( RepositoryFile file ) throws DatasourceMgmtServiceException {
    try {
      if ( file != null ) {
        NodeRepositoryFileData data = repository.getDataForRead( file.getId(), NodeRepositoryFileData.class );
        IDatabaseConnection databaseConnection =
            databaseHelper.dataNodeToDatabaseConnection( file.getId(), file.getTitle(), data.getNode() );
        // IPasswordService passwordService = PentahoSystem.get(IPasswordService.class,
        // PentahoSessionHolder.getSession());
        // databaseMeta.setPassword(passwordService.decrypt(databaseMeta.getPassword()));
        return databaseConnection;
      } else {
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.node.NodeRepositoryFileData

    try {
      List<IDatabaseConnection> datasourceList = new ArrayList<IDatabaseConnection>();
      List<RepositoryFile> repositoryFiles = getRepositoryFiles();
      if ( repositoryFiles != null ) {
        for ( RepositoryFile file : repositoryFiles ) {
          NodeRepositoryFileData data = repository.getDataForRead( file.getId(), NodeRepositoryFileData.class );
          IDatabaseConnection databaseConnection =
              databaseHelper.dataNodeToDatabaseConnection( file.getId(), file.getTitle(), data.getNode() );
          // IPasswordService passwordService = PentahoSystem.get(IPasswordService.class,
          // PentahoSessionHolder.getSession());
          // databaseMeta.setPassword(passwordService.decrypt(databaseMeta.getPassword()));
          datasourceList.add( databaseConnection );
        }
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.node.NodeRepositoryFileData

      if ( file != null ) {
        file =
            new RepositoryFile.Builder( file ).versionId( file.getVersionId() ).id( file.getId() ).title(
                RepositoryFile.DEFAULT_LOCALE, databaseConnection.getName() ).build();
        file =
            repository.updateFile( file, new NodeRepositoryFileData( databaseHelper
                .databaseConnectionToDataNode( databaseConnection ) ), null );
        renameIfNecessary( databaseConnection, file );
        return file.getId().toString();
      } else {
        throw new NonExistingDatasourceException( Messages.getInstance().getErrorString(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.