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

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


    return newFile != null ? repositoryFileAdapter.marshal( newFile ) : null;
  }

  public RepositoryFileDto createFolderWithAcl( String parentFolderId, RepositoryFileDto file,
      RepositoryFileAclDto acl, String versionMessage ) {
    RepositoryFile newFile =
        repo.createFolder( parentFolderId, repositoryFileAdapter.unmarshal( file ), repositoryFileAclAdapter
            .unmarshal( acl ), versionMessage );
    return newFile != null ? repositoryFileAdapter.marshal( newFile ) : null;
  }
View Full Code Here


  public List<Character> getReservedChars() {
    return repo.getReservedChars();
  }

  protected void validateEtcWriteAccess( String parentFolderId ) {
    RepositoryFile etcFolder = repo.getFile( "/etc" );
    if ( etcFolder != null ) {
      String etcFolderId = etcFolder.getId().toString();
      if ( etcFolderId.equals( parentFolderId ) ) {
        throw new RuntimeException( "This service is not allowed to access the ETC folder in JCR." );
      }
    }
  }
View Full Code Here

        adminJcrTemplate.execute( new JcrCallback() {
          @Override
          public Object doInJcr( Session session ) throws IOException, RepositoryException {
            new PentahoJcrConstants( session );
            String absPath = ServerRepositoryPaths.getPentahoRootFolderPath();
            RepositoryFile rootFolder =
                JcrRepositoryFileUtils
                    .getFileByAbsolutePath( session, absPath, pathConversionHelper, null, false, null );
            if ( rootFolder != null ) {
              Map<String, Serializable> metadataMap =
                  JcrRepositoryFileUtils.getFileMetadata( session, rootFolder.getId() );
              if ( metadataMap == null ) {
                metadataMap = new HashMap<String, Serializable>();
              }
              metadataMap.put( metadataProperty, Boolean.TRUE );
              JcrRepositoryFileUtils.setFileMetadata( session, rootFolder.getId(), metadataMap );
            } else {
              throw new IllegalStateException( "Repository has not been initialized properly" );
            }
            session.save();
            return null;
View Full Code Here

          return adminJcrTemplate.execute( new JcrCallback() {
            @Override
            public Object doInJcr( Session session ) throws IOException, RepositoryException {
              PentahoJcrConstants pentahoJcrConstants = new PentahoJcrConstants( session );
              String absPath = ServerRepositoryPaths.getPentahoRootFolderPath();
              RepositoryFile rootFolder =
                  JcrRepositoryFileUtils.getFileByAbsolutePath( session, absPath, pathConversionHelper, null, false,
                      null );
              if ( rootFolder != null ) {
                Map<String, Serializable> metadataMap =
                    JcrRepositoryFileUtils.getFileMetadata( session, rootFolder.getId() );
                for ( Entry<String, Serializable> metadataEntry : metadataMap.entrySet() ) {
                  if ( metadataEntry.getKey().equals( metadataProperty ) ) {
                    return (Boolean) metadataEntry.getValue();
                  }
                }
View Full Code Here

      String versionMessage ) {
    try {
      String folderNameWithPath = parentFolderId + "/" + file.getName();
      File newFolder = new File( folderNameWithPath );
      newFolder.mkdir();
      final RepositoryFile repositoryFolder = internalGetFile( newFolder );
      return repositoryFolder;
    } catch ( Throwable th ) {
      throw new UnifiedRepositoryException();
    }
  }
View Full Code Here

    throw new UnsupportedOperationException( "This operation is not support by this repository" );
  }

  public RepositoryFile internalGetFile( File f ) {

    RepositoryFile file = null;
    if ( f.exists() ) {
      String jcrPath = f.getAbsolutePath().substring( rootDir.getAbsolutePath().length() );
      if ( jcrPath.length() == 0 ) {
        jcrPath = "/";
      }
View Full Code Here

  }
 
  private RepositoryFileTree getTree( final File file, final int depth, final String childNodeFilter,
      RepositoryRequest.FILES_TYPE_FILTER types ) {

    RepositoryFile rootFile = internalGetFile( file );
  
    List<RepositoryFileTree> children;

    if ( depth != 0 ) {
      children = new ArrayList<RepositoryFileTree>();
View Full Code Here

  public List<VersionSummary> getVersionSummaries( Serializable fileId ) {
    throw new UnsupportedOperationException( "This operation is not support by this repository" );
  }

  public VersionSummary getVersionSummary( Serializable fileId, Serializable versionId ) {
    RepositoryFile file = getFile( fileId, versionId );
    List<String> labels = new ArrayList<String>();
    return new VersionSummary(fileId, ( versionId != null ? versionId : fileId ) ,
        false, file.getCreatedDate(), file.getCreatorId(), StringUtils.EMPTY,  labels );
  }
View Full Code Here

  public void lockFile( Serializable fileId, String message ) {
    throw new UnsupportedOperationException( "This operation is not support by this repository" );
  }

  public void moveFile( Serializable fileId, String destRelPath, String versionMessage ) {
    RepositoryFile file = getFileById( fileId );
    SimpleRepositoryFileData data = getData( fileId, null, SimpleRepositoryFileData.class );
    deleteFile( fileId, versionMessage );
    createFile( null, file, data, null, versionMessage );
  }
View Full Code Here

    login( USERNAME_SUZY, tenantAcme, new String[] { tenantAuthenticatedRoleName } );

    final String parentFolderPath =
        ClientRepositoryPaths.getUserHomeFolderPath( PentahoSessionHolder.getSession().getName() );
    RepositoryFile parentFolder = repo.getFile( parentFolderPath );
    final String dataString = "Hello World!";
    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 ).build(), content, null );
    final String filePath = parentFolderPath + RepositoryFile.SEPARATOR + fileName;

    login( USERNAME_ADMIN, tenantAcme, new String[] { tenantAdminRoleName, tenantAuthenticatedRoleName } );
    try {
View Full Code Here

TOP

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

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.