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

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


    List<RepositoryFile> mockList = mock( List.class );
    when( unifiedRepository.getChildren( mockSerializable ) ).thenReturn( mockList );

    Iterator<RepositoryFile> mockIterator = mock( Iterator.class );
    RepositoryFile repositoryFile2 = mock( RepositoryFile.class );
    when( mockIterator.hasNext() ).thenReturn( true, false );
    when( mockIterator.next() ).thenReturn( repositoryFile2 );
    when( mockList.iterator() ).thenReturn( mockIterator );

    when( repositoryFile2.isFolder() ).thenReturn( false );

    when( repositoryFile2.getPath() ).thenReturn( REPO_PATH );

    Serializable mockSerializable2 = mock( Serializable.class );
    when( repositoryFile2.getId() ).thenReturn( mockSerializable2 );

    SimpleRepositoryFileData mockRepoFileData = mock( SimpleRepositoryFileData.class );
    when( unifiedRepository.getDataForRead( mockSerializable2, SimpleRepositoryFileData.class ) ).thenReturn(
        mockRepoFileData );
View Full Code Here


    List<RepositoryFile> mockList = mock( List.class );
    when( unifiedRepository.getChildren( mockSerializable ) ).thenReturn( mockList );

    Iterator<RepositoryFile> mockIterator = mock( Iterator.class );
    RepositoryFile repositoryFile2 = mock( RepositoryFile.class );
    when( mockIterator.hasNext() ).thenReturn( true, false );
    when( mockIterator.next() ).thenReturn( repositoryFile2 );
    when( mockList.iterator() ).thenReturn( mockIterator );

    when( repositoryFile2.isFolder() ).thenReturn( false );

    Serializable mockSerializable2 = mock( Serializable.class );
    when( repositoryFile2.getId() ).thenReturn( mockSerializable2 );

    SimpleRepositoryFileData mockRepoFileData = mock( SimpleRepositoryFileData.class );
    when( unifiedRepository.getDataForRead( mockSerializable2, SimpleRepositoryFileData.class ) ).thenReturn(
        mockRepoFileData );

    InputStream mockInputStream = new InputStream() {
      @Override
      public int read() throws IOException {
        return -1; // EOF
      }
    };
    when( mockRepoFileData.getStream() ).thenReturn( mockInputStream );

    String name2 = "name.txt";
    when( repositoryFile2.getName() ).thenReturn( name2 );

    File parentDir = new File( System.getProperty( "java.io.tmpdir" ) );
    File file = new File( parentDir, name );
    // already exists
    if ( file.isDirectory() ) {
View Full Code Here

   *
   * @throws java.io.IOException
   */
  public void doExport() throws IOException {
    exportDir = new File( filePath );
    RepositoryFile exportRepositoryFile = unifiedRepository.getFile( repoPath );

    if ( exportRepositoryFile == null ) {
      throw new FileNotFoundException( Messages.getInstance().getErrorString(
          "Exporter.ERROR_0001_INVALID_SOURCE_DIRECTORY", repoPath ) );
    }

    if ( exportRepositoryFile.isFolder() ) { // Handle recursive export
      exportDirectory( exportRepositoryFile, exportDir );
    } else { // Handle a single file export
      exportFile( exportRepositoryFile, exportDir );
    }
  }
View Full Code Here

   *
   * @return
   * @throws java.io.IOException
   */
  public File doExportAsZip() throws IOException {
    RepositoryFile exportRepositoryFile = unifiedRepository.getFile( repoPath );
    return doExportAsZip( exportRepositoryFile );
  }
View Full Code Here

  public boolean isLocaleFile( IRepositoryFileBundle file, String parentPath, byte[] bytes ) throws IOException {

    boolean isLocale = false;
    String fileName = file.getFile().getName();
    String actualFilePath = file.getPath();
    RepositoryFile localeRepositoryFile = file.getFile();
    if ( ImportSession.getSession().getManifest() != null && ImportSession.getSession().getManifest().getManifestInformation().getManifestVersion() != null ) {
      fileName = ExportFileNameEncoder.decodeZipFileName( fileName );
      actualFilePath = ExportFileNameEncoder.decodeZipFileName( actualFilePath );
      localeRepositoryFile = new RepositoryFile.Builder( localeRepositoryFile ).name(
          ExportFileNameEncoder.decodeZipFileName( localeRepositoryFile.getName() ) ).build();
    }
    int sourceVersion = 0; // 0 = Not a local file, 1 = 4.8 .properties file, 2= Sugar 5.0 .local file
    if ( fileName.endsWith( PROPERTIES_EXT ) ) {
      sourceVersion = 1;
    } else if ( fileName.endsWith( LOCALE_EXT ) ) {
View Full Code Here

    return nodeToFile( session, pentahoJcrConstants, pathConversionHelper, lockHelper, node, false, null );
  }

  private static RepositoryFile getRootFolder( final Session session ) throws RepositoryException {
    Node node = session.getRootNode();
    RepositoryFile file =
        new RepositoryFile.Builder( node.getIdentifier(), "" ).folder( true ).versioned( false ).path( //$NON-NLS-1$
            JcrStringHelper.pathDecode( node.getPath() ) ).build();
    return file;
  }
View Full Code Here

      lockOwner = lockHelper.getLockOwner( session, pentahoJcrConstants, lock );
      lockDate = lockHelper.getLockDate( session, pentahoJcrConstants, lock );
      lockMessage = lockHelper.getLockMessage( session, pentahoJcrConstants, lock );
    }

    RepositoryFile file =
        new RepositoryFile.Builder( id, name ).createdDate( created ).creatorId( creatorId ).lastModificationDate(
            lastModified ).folder( folder ).versioned( versioned ).path( path ).versionId( versionId ).fileSize(
            fileSize ).locked( locked ).lockDate( lockDate ).hidden( hidden ).lockMessage( lockMessage ).lockOwner(
            lockOwner ).title( title ).description( description ).locale( pentahoLocale.toString() )
            .localePropertiesMap( localePropertiesMap ).build();
View Full Code Here

    }

    while ( nodeIterator.hasNext() ) {
      Node node = nodeIterator.nextNode();
      if ( isSupportedNodeType( pentahoJcrConstants, node ) ) {
        RepositoryFile file = nodeToFile( session, pentahoJcrConstants, pathConversionHelper, lockHelper, node );
        if ( !repositoryRequest.isShowHidden() ) {
          if ( !file.isHidden() ) {
            children.add( file );
          }
        } else {
          children.add( file );
        }
View Full Code Here

      final PentahoJcrConstants pentahoJcrConstants, final IPathConversionHelper pathConversionHelper,
      final ILockHelper lockHelper, final Node fileNode, final int depth, final String childNodeFilter,
      final boolean showHidden, IRepositoryAccessVoterManager accessVoterManager,
      RepositoryRequest.FILES_TYPE_FILTER types, MutableBoolean foundFiltered ) throws RepositoryException {

    RepositoryFile rootFile =
        nodeToFile( session, pentahoJcrConstants, pathConversionHelper, lockHelper, fileNode, false, null );
    if ( ( !showHidden && rootFile.isHidden() )
        || ( !accessVoterManager.hasAccess( rootFile, RepositoryFilePermission.READ, JcrRepositoryFileAclUtils.getAcl(
            session, pentahoJcrConstants, rootFile.getId() ), PentahoSessionHolder.getSession() ) ) ) {
      return null;
    }
    List<RepositoryFileTree> children;
    HashSet<Node> childrenFolderSet;
    // if depth is neither negative (indicating unlimited depth) nor positive (indicating at least one more level
View Full Code Here

      final PentahoJcrConstants pentahoJcrConstants, final IPathConversionHelper pathConversionHelper,
      final String childNodeFilter, final ILockHelper lockHelper, final int depth, final boolean showHidden,
      final IRepositoryAccessVoterManager accessVoterManager, RepositoryRequest.FILES_TYPE_FILTER types,
      MutableBoolean foundFiltered, boolean isRootFiltered ) throws RepositoryException {

    RepositoryFile file = nodeToFile( session, pentahoJcrConstants, pathConversionHelper, lockHelper, childNode );
    if ( isSupportedNodeType( pentahoJcrConstants, childNode )
        && ( accessVoterManager.hasAccess( file, RepositoryFilePermission.READ, JcrRepositoryFileAclUtils.getAcl(
            session, pentahoJcrConstants, file.getId() ), PentahoSessionHolder.getSession() ) ) ) {
      MutableBoolean foundFilteredAtomic = new MutableBoolean( !isPentahoFolder( pentahoJcrConstants, childNode ) );
      RepositoryFileTree repositoryFileTree =
          getTreeByNode( session, pentahoJcrConstants, pathConversionHelper, lockHelper, childNode, depth - 1,
              childNodeFilter, showHidden, accessVoterManager, types, foundFilteredAtomic );
      if ( repositoryFileTree != null && ( foundFilteredAtomic.booleanValue() || isRootFiltered ) ) {
View Full Code Here

TOP

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

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.