Examples of SimpleRepositoryFileData


Examples of org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData

    if ( data instanceof NodeRepositoryFileData ) {
      return repositoryFileAdapter.unmarshal( repoWebService.createFile( parentFolderId != null ? parentFolderId
          .toString() : null, repositoryFileAdapter.marshal( file ), nodeRepositoryFileDataAdapter
          .marshal( (NodeRepositoryFileData) data ), versionMessage ) );
    } else if ( data instanceof SimpleRepositoryFileData ) {
      SimpleRepositoryFileData simpleData = (SimpleRepositoryFileData) data;
      return repositoryFileAdapter.unmarshal( repoWebService.createBinaryFile( parentFolderId != null ? parentFolderId
          .toString() : null, repositoryFileAdapter.marshal( file ), SimpleRepositoryFileDataDto.convert( simpleData ),
          versionMessage ) );
    } else {
      throw new IllegalArgumentException();
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData

  public RepositoryFile updateFile( RepositoryFile file, IRepositoryFileData data, String versionMessage ) {
    if ( data instanceof NodeRepositoryFileData ) {
      return repositoryFileAdapter.unmarshal( repoWebService.updateFile( repositoryFileAdapter.marshal( file ),
          nodeRepositoryFileDataAdapter.marshal( (NodeRepositoryFileData) data ), versionMessage ) );
    } else if ( data instanceof SimpleRepositoryFileData ) {
      SimpleRepositoryFileData simpleData = (SimpleRepositoryFileData) data;
      return repositoryFileAdapter.unmarshal( repoWebService.updateBinaryFile( repositoryFileAdapter.marshal( file ),
          SimpleRepositoryFileDataDto.convert( simpleData ), versionMessage ) );
    } else {
      throw new IllegalArgumentException();
    }
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData

    if ( data instanceof NodeRepositoryFileData ) {
      return repositoryFileAdapter.unmarshal( repoWebService.createFileWithAcl( parentFolderId != null ? parentFolderId
          .toString() : null, repositoryFileAdapter.marshal( file ), nodeRepositoryFileDataAdapter
          .marshal( (NodeRepositoryFileData) data ), repositoryFileAclAdapter.marshal( acl ), versionMessage ) );
    } else if ( data instanceof SimpleRepositoryFileData ) {
      SimpleRepositoryFileData simpleData = (SimpleRepositoryFileData) data;
      return repositoryFileAdapter.unmarshal( repoWebService.createBinaryFileWithAcl( parentFolderId != null
          ? parentFolderId.toString() : null, repositoryFileAdapter.marshal( file ), SimpleRepositoryFileDataDto
          .convert( simpleData ), repositoryFileAclAdapter.marshal( acl ), versionMessage ) );
    } else {
      throw new IllegalArgumentException();
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData

    return repositoryFileAdapter.marshal( repo.createFile( parentFolderId, repositoryFileAdapter.unmarshal( file ),
        SimpleRepositoryFileDataDto.convert( simpleJaxWsData ), versionMessage ) );
  }

  public SimpleRepositoryFileDataDto getDataAsBinaryForRead( final String fileId ) {
    SimpleRepositoryFileData simpleData = repo.getDataForRead( fileId, SimpleRepositoryFileData.class );
    return SimpleRepositoryFileDataDto.convert( simpleData );
  }
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData

    SimpleRepositoryFileData simpleData = repo.getDataForRead( fileId, SimpleRepositoryFileData.class );
    return SimpleRepositoryFileDataDto.convert( simpleData );
  }

  public SimpleRepositoryFileDataDto getDataAsBinaryForReadAtVersion( final String fileId, final String versionId ) {
    SimpleRepositoryFileData simpleData =
        repo.getDataAtVersionForRead( fileId, versionId, SimpleRepositoryFileData.class );
    return SimpleRepositoryFileDataDto.convert( simpleData );
  }
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData

    byte[] data = dataString.getBytes( encoding );
    ByteArrayInputStream dataStream = new ByteArrayInputStream( data );
    final String mimeType = "text/plain";
    final String fileName = "helloworld.xaction";

    final SimpleRepositoryFileData content = new SimpleRepositoryFileData( dataStream, encoding, mimeType );
    RepositoryFile newFile =
        repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( fileName ).versioned( true ).build(),
            content, null );
    assertTrue( newFile.isVersioned() );
    assertNotNull( newFile.getVersionId() );
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData

    final String expectedMimeType = "text/plain";
    final String expectedName = "helloworld.xaction";
    final String expectedAbsolutePath =
        ClientRepositoryPaths.getUserHomeFolderPath( USERNAME_SUZY ) + "/helloworld.xaction";

    final SimpleRepositoryFileData content =
        new SimpleRepositoryFileData( dataStream, expectedEncoding, expectedMimeType );
    RepositoryFile newFile =
        repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( expectedName ).versioned( true ).build(),
            content, null );

    // Make sure the file was created
    RepositoryFile foundFile = repo.getFile( expectedAbsolutePath );
    assertNotNull( foundFile );

    // Modify file
    final SimpleRepositoryFileData modContent =
        new SimpleRepositoryFileData( modDataStream, expectedEncoding, expectedMimeType );
    repo.updateFile( foundFile, modContent, null );

    // Verify versions
    List<VersionSummary> origVerList = repo.getVersionSummaries( foundFile.getId() );
    assertEquals( 2, origVerList.size() );

    SimpleRepositoryFileData result =
        repo.getDataAtVersionForRead( foundFile.getId(), origVerList.get( 0 ).getId(), SimpleRepositoryFileData.class );
    SimpleRepositoryFileData modResult =
        repo.getDataAtVersionForRead( foundFile.getId(), origVerList.get( 1 ).getId(), SimpleRepositoryFileData.class );

    assertEquals( expectedDataString, IOUtils.toString( result.getInputStream(), expectedEncoding ) );
    assertEquals( expectedModDataString, IOUtils.toString( modResult.getInputStream(), expectedEncoding ) );

    // Remove first version
    repo.deleteFileAtVersion( foundFile.getId(), origVerList.get( 0 ).getId() );

    // Verify version removal
    List<VersionSummary> newVerList = repo.getVersionSummaries( foundFile.getId() );
    assertEquals( 1, newVerList.size() );

    SimpleRepositoryFileData newModResult =
        repo.getDataAtVersionForRead( foundFile.getId(), newVerList.get( 0 ).getId(), SimpleRepositoryFileData.class );

    assertEquals( expectedModDataString, IOUtils.toString( newModResult.getInputStream(), expectedEncoding ) );
  }
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData

    final String expectedMimeType = "text/plain";
    final String expectedName = "helloworld.xaction";
    final String expectedAbsolutePath =
        ClientRepositoryPaths.getUserHomeFolderPath( USERNAME_SUZY ) + "/helloworld.xaction";

    final SimpleRepositoryFileData content =
        new SimpleRepositoryFileData( dataStream, expectedEncoding, expectedMimeType );
    RepositoryFile newFile =
        repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( expectedName ).versioned( true ).build(),
            content, null );

    // Make sure the file was created
    RepositoryFile foundFile = repo.getFile( expectedAbsolutePath );
    assertNotNull( foundFile );

    // Modify file
    final SimpleRepositoryFileData modContent =
        new SimpleRepositoryFileData( modDataStream, expectedEncoding, expectedMimeType );
    repo.updateFile( foundFile, modContent, null );

    // Verify versions
    List<VersionSummary> origVerList = repo.getVersionSummaries( foundFile.getId() );
    assertEquals( 2, origVerList.size() );

    SimpleRepositoryFileData result =
        repo.getDataAtVersionForRead( foundFile.getId(), origVerList.get( 0 ).getId(), SimpleRepositoryFileData.class );
    SimpleRepositoryFileData modResult =
        repo.getDataAtVersionForRead( foundFile.getId(), origVerList.get( 1 ).getId(), SimpleRepositoryFileData.class );

    assertEquals( expectedDataString, IOUtils.toString( result.getInputStream(), expectedEncoding ) );
    assertEquals( expectedModDataString, IOUtils.toString( modResult.getInputStream(), expectedEncoding ) );

    // Restore first version
    repo.restoreFileAtVersion( foundFile.getId(), origVerList.get( 0 ).getId(), "restore version" );

    // Verify version restoration
    List<VersionSummary> newVerList = repo.getVersionSummaries( foundFile.getId() );
    assertEquals( 3, newVerList.size() );

    SimpleRepositoryFileData newOrigResult = repo.getDataForRead( foundFile.getId(), SimpleRepositoryFileData.class );

    assertEquals( expectedDataString, IOUtils.toString( newOrigResult.getInputStream(), expectedEncoding ) );
  }
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData

    final String encoding = "UTF-8";
    byte[] data = dataString.getBytes( encoding );
    ByteArrayInputStream dataStream = new ByteArrayInputStream( data );
    final String mimeType = "text/plain";
    final String fileName = "helloworld.xaction";
    final SimpleRepositoryFileData content = new SimpleRepositoryFileData( dataStream, encoding, mimeType );
    RepositoryFile newFile =
        repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( fileName ).versioned( true ).build(),
            content, "created helloworld.xaction" );
    repo.updateFile( newFile, content, "update 1" );
    newFile = repo.getFileById( newFile.getId() );
View Full Code Here

Examples of org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData

    byte[] data = dataString.getBytes( encoding );
    ByteArrayInputStream dataStream = new ByteArrayInputStream( data );
    final String mimeType = "text/plain";
    final String fileName1 = "helloworld1.xaction";
    final String fileName2 = "helloworld2.xaction";
    final SimpleRepositoryFileData content = new SimpleRepositoryFileData( dataStream, encoding, mimeType );
    RepositoryFile newFile1 =
        repo.createFile( parentFolder.getId(), new RepositoryFile.Builder( fileName1 ).versioned( true ).build(),
            content, "created helloworld.xaction" );
    final String createMsg = "created helloworld2.xaction";
    RepositoryFile newFile2 =
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.