Examples of UnifiedRepositoryException


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

    }

    public void deleteVersion( final Serializable fileId, final Serializable versionId ) {
      List<FrozenFileRecord> history = versionMap.get( fileId );
      if ( history == null ) {
        throw new UnifiedRepositoryException( String.format( "version history for [%s] does not exist", fileId ) );
      }
      Integer versionNumber = versionNumber( versionId );
      if ( versionNumber >= 0 && versionNumber < history.size() ) {
        FrozenFileRecord r = history.get( versionNumber );
        if ( r == null ) {
          throw new UnifiedRepositoryException( String.format( "version [%s] does not exist", versionId ) );
        }
        history.set( versionNumber, null );
      } else {
        throw new UnifiedRepositoryException( String.format( "unknown version [%s]", fileId ) );
      }
    }
View Full Code Here

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

    public FrozenFileRecord restoreVersion( final Serializable fileId, final Serializable versionId,
        final String author, final String versionMessage, final Date date ) {
      List<FrozenFileRecord> history = versionMap.get( fileId );
      if ( history == null ) {
        throw new UnifiedRepositoryException( String.format( "version history for [%s] does not exist", fileId ) );
      }
      Integer versionNumber = versionNumber( versionId );
      if ( versionNumber >= 0 && versionNumber < history.size() ) {
        FrozenFileRecord r = history.get( versionNumber );
        if ( r == null ) {
          throw new UnifiedRepositoryException( String.format( "version [%s] does not exist", versionId ) );
        }
        history.add( new FrozenFileRecord( history.size(), new RepositoryFile.Builder( r.getFile() ).versionId(
            history.size() ).build(), r.getData(), r.getMetadata(), author, versionMessage, date ) );
        return history.get( history.size() - 1 );
      }

      throw new UnifiedRepositoryException( String.format( "unknown version [%s]", fileId ) );
    }
View Full Code Here

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

    }

    public List<FrozenFileRecord> getVersions( final Serializable fileId ) {
      List<FrozenFileRecord> history = versionMap.get( fileId );
      if ( history == null ) {
        throw new UnifiedRepositoryException( String.format( "version history for [%s] does not exist", fileId ) );
      }
      List<FrozenFileRecord> cleanedHistory = new ArrayList<FrozenFileRecord>( history );
      for ( Iterator<FrozenFileRecord> iter = cleanedHistory.iterator(); iter.hasNext(); ) {
        FrozenFileRecord r = iter.next();
        if ( r == null ) {
View Full Code Here

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

    }

    public FrozenFileRecord getFileAtVersion( final Serializable fileId, final Serializable versionId ) {
      List<FrozenFileRecord> history = versionMap.get( fileId );
      if ( history == null ) {
        throw new UnifiedRepositoryException( String.format( "version history for [%s] does not exist", fileId ) );
      }
      Integer versionNumber = versionNumber( versionId );
      FrozenFileRecord r = history.get( versionNumber );
      if ( r == null ) {
        throw new UnifiedRepositoryException( String.format( "version [%s] does not exist", versionId ) );
      }
      return r;
    }
View Full Code Here

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

    }

    public void restore( final Serializable fileId ) {
      Trash trash = userToTrashMap.get( currentUserProvider.getUser() );
      if ( trash == null ) {
        throw new UnifiedRepositoryException( "no trash found for user" );
      }

      String origPath = trash.getIdToOrigPathMap().get( fileId );
      List<FileRecord> dels = trash.getOrigPathToFilesMap().get( origPath );
      FileRecord found = null;
View Full Code Here

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

      return hasAccess( fileId, EnumSet.of( WRITE ) );
    }

    public void lockFile( final Serializable fileId, final String message ) {
      if ( !hasAccess( fileId, EnumSet.of( WRITE ) ) ) {
        throw new UnifiedRepositoryException( "access denied" );
      }
      FileRecord r = idManager.getFileById( fileId );
      if ( r.getFile().getLockOwner() != null ) {
        throw new IllegalStateException( "file is already locked" );
      }
View Full Code Here

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

          new Date() ).lockMessage( message ).locked( true ).build() );
    }

    public void unlockFile( final Serializable fileId ) {
      if ( !hasAccess( fileId, EnumSet.of( WRITE ) ) ) {
        throw new UnifiedRepositoryException( "access denied" );
      }
      FileRecord r = idManager.getFileById( fileId );
      if ( r.getFile().getLockOwner() == null ) {
        throw new IllegalStateException( "file is not locked" );
      }
View Full Code Here

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

            session.getWorkspace().copy( finalEncodedSrcAbsPath, JcrStringHelper.pathEncode( finalDestAbsPath ) );
          } else {
            session.getWorkspace().move( finalEncodedSrcAbsPath, JcrStringHelper.pathEncode( finalDestAbsPath ) );
          }
        } catch ( ItemExistsException iae ) {
          throw new UnifiedRepositoryException( ( file.isFolder() ? "Folder " : "File " ) + "with path ["
              + cleanDestAbsPath + "] already exists in the repository" );
        }

        JcrRepositoryFileUtils.checkinNearestVersionableNodeIfNecessary( session, pentahoJcrConstants,
            destParentFolderNode, versionMessage );
View Full Code Here

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

    FileRecord src = idManager.getFileById( fileId );
    FileRecord dest = root.getFileRecord( destAbsPath );
    String newName = src.getFile().getName();
    if ( dest != null ) {
      if ( !dest.getFile().isFolder() ) {
        throw new UnifiedRepositoryException( "file already exists" );
      }
    } else {
      // find parent folder
      String parentPath = StringUtils.substringBeforeLast( destAbsPath, RepositoryFile.SEPARATOR );
      FileRecord parent = root.getFileRecord( parentPath );
      if ( parent == null ) {
        throw new UnifiedRepositoryException( "invalid destination path" );
      }
      dest = parent;
      newName = StringUtils.substringAfterLast( destAbsPath, RepositoryFile.SEPARATOR );
    }
    String newPath =
View Full Code Here

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

          // Load any I18N bundles
          loadLocaleStrings( domainId, domain );
          logger.debug( "loaded I18N bundles" );
        } else {
          throw new UnifiedRepositoryException( messages.getErrorString(
              "PentahoMetadataDomainRepository.ERROR_0005_ERROR_RETRIEVING_DOMAIN", domainId, "not found" ) );

        }
      }
    } catch ( Exception e ) {
      throw new UnifiedRepositoryException( messages.getErrorString(
          "PentahoMetadataDomainRepository.ERROR_0005_ERROR_RETRIEVING_DOMAIN",
        domainId, e.getLocalizedMessage() ), e );
    }

    // Return
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.