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

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


    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 ) );
    RepositoryFileAcl.Builder newAclBuilder =
        new RepositoryFileAcl.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


  }

  @Override
  public NodeRepositoryFileData unmarshal( final NodeRepositoryFileDataDto v ) {
    DataNode node = toDataNode( v.node );
    NodeRepositoryFileData data = new NodeRepositoryFileData( node );
    return data;
  }
View Full Code Here

    final String EXP_HOST_NAME = "hello";
    DataNode rootNode = new DataNode( "databaseMeta" );
    rootNode.setProperty( "TYPE", "Hypersonic" ); // required
    rootNode.setProperty( "HOST_NAME", EXP_HOST_NAME );
    rootNode.addNode( "attributes" ); // required
    doReturn( new NodeRepositoryFileData( rootNode ) ).when( repo ).getDataForRead( eq( fileId ),
        eq( NodeRepositoryFileData.class ) );

    IDatasourceMgmtService datasourceMgmtService =
        new JcrBackedDatasourceMgmtService( repo, new DatabaseDialectService() );
    IDatabaseConnection conn = datasourceMgmtService.getDatasourceByName( EXP_DBMETA_NAME );
View Full Code Here

    getChildrenWithFilterAndHidden( String folderId, String filter, Boolean showHiddenFiles ) {
    return marshalFiles( repo.getChildren( new RepositoryRequest( folderId, showHiddenFiles, 0, filter ) ) );
  }

  public NodeRepositoryFileDataDto getDataAsNodeForRead( final String fileId ) {
    NodeRepositoryFileData fileData = repo.getDataForRead( fileId, NodeRepositoryFileData.class );
    return fileData != null ? nodeRepositoryFileDataAdapter.marshal( fileData ) : null;
  }
View Full Code Here

      final Node fileNode ) throws RepositoryException {
    Node unstructuredNode = fileNode.getNode( pentahoJcrConstants.getJCR_CONTENT() );
    final String pattern = session.getNamespacePrefix( PentahoJcrConstants.PHO_NS ) + ":" + "*"; //$NON-NLS-1$ //$NON-NLS-2$
    Assert.isTrue( unstructuredNode.getNodes( pattern ).getSize() == 1 );
    Node jcrNode = unstructuredNode.getNodes( pattern ).nextNode();
    return new NodeRepositoryFileData( internalRead( session, pentahoJcrConstants, jcrNode, null ) );
  }
View Full Code Here

      }
    }
    // Assert.notNull(content);
    DataNode emptyDataNode = new DataNode( file.getName() );
    emptyDataNode.setProperty( " ", "content" ); //$NON-NLS-1$ //$NON-NLS-2$
    final IRepositoryFileData emptyContent = new NodeRepositoryFileData( emptyDataNode );

    return (RepositoryFile) jcrTemplate.execute( new JcrCallback() {
      @Override
      public Object doInJcr( final Session session ) throws RepositoryException, IOException {
        PentahoJcrConstants pentahoJcrConstants = new PentahoJcrConstants( session );
        JcrRepositoryFileUtils.checkoutNearestVersionableFileIfNecessary( session, pentahoJcrConstants, parentFolderId );
        Node fileNode =
            JcrRepositoryFileUtils.createFileNode( session, pentahoJcrConstants, parentFolderId, file, content == null
                ? emptyContent : content, findTransformerForWrite( content == null ? emptyContent.getClass() : content
                .getClass() ) );
        // create a tmp file with correct path for default acl creation purposes.
        String path = JcrRepositoryFileUtils.getAbsolutePath( session, pentahoJcrConstants, fileNode );
        RepositoryFile tmpFile = new RepositoryFile.Builder( file ).path( path ).build();
        // we must create the acl during checkout
View Full Code Here

      r.setData( new ReusableSimpleRepositoryFileData( (SimpleRepositoryFileData) data ) );
    } else if ( data instanceof NodeRepositoryFileData ) {
      DataNode node = ( (NodeRepositoryFileData) data ).getNode();
      referralManager.process( r.getFile().getId(), oldData != null ? ( (NodeRepositoryFileData) oldData ).getNode()
          : null, node );
      r.setData( new NodeRepositoryFileData( idManager.process( node ) ) );
    }
  }
View Full Code Here

    node.setProperty( "className", className );
    node.setProperty( "URL", URL );
    node.setProperty( "user", user );
    node.setProperty( "password", password );
    node.setProperty( "properties", xmlProperties );
    NodeRepositoryFileData data = new NodeRepositoryFileData( node );

    final RepositoryFile metadata = repository.getFile( path );

    if ( metadata == null ) {
      repository.createFile(
View Full Code Here

    String definition = "mondrian:/" + catalog.getName();
    DataNode node = new DataNode( "catalog" );
    node.setProperty( "definition", encodeUrl( definition ) );
    node.setProperty( "datasourceInfo", datasourceInfo );
    NodeRepositoryFileData data = new NodeRepositoryFileData( node );

    if ( metadata == null ) {
      repository.createFile( catalog.getId(), new RepositoryFile.Builder( "metadata" ).build(), data, null );
    } else {
      repository.updateFile( metadata, data, null );
View Full Code Here

    public final String definition;

    public HostedCatalogInfo(
        String name,
        RepositoryFile source ) {
      final NodeRepositoryFileData data =
          repository.getDataForRead(
              source.getId(),
              NodeRepositoryFileData.class );
      this.name = name;
      this.dataSourceInfo =
          data.getNode().getProperty( "datasourceInfo" ).getString();
      this.definition =
          data.getNode().getProperty( "definition" ).getString();
    }
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.