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

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


    public final String password;
    public final Properties properties;

    private Olap4jServerInfo( RepositoryFile source ) {

      final NodeRepositoryFileData data =
          repository.getDataForRead(
              source.getId(),
              NodeRepositoryFileData.class );

      this.name = data.getNode().getProperty( "name" ).getString();
      this.className = data.getNode().getProperty( "className" ).getString();
      this.URL = data.getNode().getProperty( "URL" ).getString();

      final DataProperty userProp = data.getNode().getProperty( "user" );
      this.user = userProp == null ? null : userProp.getString();

      final DataProperty passwordProp = data.getNode().getProperty( "password" );
      this.password = passwordProp == null ? null : passwordProp.getString();

      this.properties = new Properties();

      final String propertiesXml =
          data.getNode().getProperty( "properties" ).getString();
      try {
        properties.loadFromXML(
            new ByteArrayInputStream(
                propertiesXml.getBytes( "UTF-8" ) )
        );
View Full Code Here


        throw new IllegalArgumentException( "all paths must have a common prefix" );
      }
      String[] pathSegments = pair.getPath().substring( prefix.length() + 1 ).split( "/" );
      addChild( rootNode, pair.getProperty(), pathSegments, 0 );
    }
    doReturn( new NodeRepositoryFileData( rootNode ) ).when( repo ).getDataForRead( makeIdObject( path ),
        NodeRepositoryFileData.class );
  }
View Full Code Here

    DataNode node = new DataNode( "kdjd" );
    node.setProperty( "ddf", "ljsdfkjsdkf" );
    DataNode newChild1 = node.addNode( "herfkmdx" );
    newChild1.setProperty( "urei2", new DataNodeRef( refereeFile.getId() ) );

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

    List<RepositoryFile> referrers = repo.getReferrers( refereeFile.getId() );

    assertNotNull( referrers );
View Full Code Here

    newChild1.setProperty( "tttss4", "843skdfj33ksaljdfj" );
    newChild1.setProperty( "urei2", new DataNodeRef( sampleFile.getId() ) );
    DataNode newChild2 = node.addNode( RepositoryFilenameUtils.escape( "pppq/qqs2", repo.getReservedChars() ) );
    newChild2.setProperty( RepositoryFilenameUtils.escape( "ttt:ss4", repo.getReservedChars() ), "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

    DataNode node = new DataNode( "kdjd" );
    node.setProperty( "ddf", "ljsdfkjsdkf" );
    DataNode newChild1 = node.addNode( "herfkmdx" );

    NodeRepositoryFileData data = new NodeRepositoryFileData( node );
    RepositoryFile repoFile =
        repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( "test" ).build(), data, null );
    RepositoryFileAcl acl = repo.getAcl( repoFile.getId() );

    RepositoryFileSid suzySid = new RepositoryFileSid( userNameUtils.getPrincipleId( tenantAcme, USERNAME_SUZY ) );
    Builder newAclBuilder =
        new Builder( acl ).ace( suzySid, EnumSet.of( RepositoryFilePermission.READ,
            RepositoryFilePermission.WRITE ) );

    repo.updateAcl( newAclBuilder.build() );

    login( USERNAME_SUZY, tenantAcme, new String[] { tenantAuthenticatedRoleName } );
    repoFile = repo.getFile( repoFile.getPath() );

    node = new DataNode( "kdjd" );
    node.setProperty( "foo", "bar" );
    newChild1 = node.addNode( "sdfsdf" );

    data = new NodeRepositoryFileData( node );
    repo.updateFile( repoFile, data, "testUpdate" );

  }
View Full Code Here

    DataNode node = new DataNode( "kdjd" );
    node.setProperty( "ddf", "ljsdfkjsdkf" );
    DataNode newChild1 = node.addNode( "herfkmdx" );
    newChild1.setProperty( "urei2", new DataNodeRef( refereeFile.getId() ) );

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

    List<RepositoryFile> referrers = repo.getReferrers( refereeFile.getId() );

    assertNotNull( referrers );
View Full Code Here

    final String parentFolderPath = ClientRepositoryPaths.getPublicFolderPath();
    final String expectedName = "helloworld.doesnotmatter";
    RepositoryFile parentFolder = repo.getFile( parentFolderPath );
    assertNotNull( parentFolder );
    final String expectedPath = parentFolderPath + RepositoryFile.SEPARATOR + expectedName;
    NodeRepositoryFileData data = new NodeRepositoryFileData( node );
    RepositoryFile newFile =
        repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( expectedName ).build(), data, null );
    assertNotNull( newFile.getId() );

    // now check that the ref is missing
View Full Code Here

    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

  }

  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

      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

TOP

Related Classes of org.pentaho.platform.api.repository2.unified.data.node.NodeRepositoryFileData

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.