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

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


      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

              sourcePath =
              sourceFile.getPath().substring( 0, sourceFile.getPath().lastIndexOf( FileUtils.PATH_SEPARATOR ) );
          if ( !sourcePath.equals( destDir.getPath() ) ) { // We're saving to a different folder than we're copying
            // from
            IRepositoryFileData data = getData( sourceFile );
            RepositoryFileAcl acl = getRepository().getAcl( sourceFileId );
            RepositoryFile
                destFile =
                getRepository().getFile( destDir.getPath() + FileUtils.PATH_SEPARATOR + fileName );
            if ( destFile == null ) { // destFile doesn't exist so we'll create it.
              RepositoryFile duplicateFile =
                  new RepositoryFile.Builder( fileName ).hidden( sourceFile.isHidden() ).versioned(
                      sourceFile.isVersioned() ).build();
              final RepositoryFile repositoryFile =
                  getRepository().createFile( destDir.getId(), duplicateFile, data, acl, null );
              getRepository()
                  .setFileMetadata( repositoryFile.getId(), getRepository().getFileMetadata( sourceFileId ) );
            } else if ( mode == MODE_OVERWRITE ) { // destFile exists so check to see if we want to overwrite it.
              RepositoryFileDto destFileDto = toFileDto( destFile, null, false );
              destFileDto.setHidden( sourceFile.isHidden() );
              destFile = toFile( destFileDto );
              final RepositoryFile repositoryFile = getRepository().updateFile( destFile, data, null );
              getRepository().updateAcl( acl );
              getRepository()
                  .setFileMetadata( repositoryFile.getId(), getRepository().getFileMetadata( sourceFileId ) );
            }
          }
        }
      }
    } else {
      for ( String sourceFileId : sourceFileIds ) {
        RepositoryFile sourceFile = getRepository().getFileById( sourceFileId );
        if ( destDir != null && destDir.isFolder() && sourceFile != null && !sourceFile.isFolder() ) {

          // First try to see if regular name is available
          String fileName = sourceFile.getName();
          String copyText = "";
          String rootCopyText = "";
          String nameNoExtension = fileName;
          String extension = "";
          int indexOfDot = fileName.lastIndexOf( '.' );
          if ( !( indexOfDot == -1 ) ) {
            nameNoExtension = fileName.substring( 0, indexOfDot );
            extension = fileName.substring( indexOfDot );
          }

          RepositoryFileDto
              testFile =
              getRepoWs().getFile( path + FileUtils.PATH_SEPARATOR + nameNoExtension + extension ); //$NON-NLS-1$
          if ( testFile != null ) {
            // Second try COPY_PREFIX, If the name already ends with a COPY_PREFIX don't append twice
            if ( !nameNoExtension
                .endsWith( Messages.getInstance().getString( "FileResource.COPY_PREFIX" ) ) ) { //$NON-NLS-1$
              copyText = rootCopyText = Messages.getInstance().getString( "FileResource.COPY_PREFIX" );
              fileName = nameNoExtension + copyText + extension;
              testFile = getRepoWs().getFile( path + FileUtils.PATH_SEPARATOR + fileName );
            }
          }

          // Third try COPY_PREFIX + DUPLICATE_INDICATOR
          Integer nameCount = 1;
          while ( testFile != null ) {
            nameCount++;
            copyText =
                rootCopyText + Messages.getInstance().getString( "FileResource.DUPLICATE_INDICATOR", nameCount );
            fileName = nameNoExtension + copyText + extension;
            testFile = getRepoWs().getFile( path + FileUtils.PATH_SEPARATOR + fileName );
          }
          IRepositoryFileData data = getData( sourceFile );
          RepositoryFileAcl acl = getRepository().getAcl( sourceFileId );
          RepositoryFile duplicateFile = null;

          // If the title is different than the source file, copy it separately
          if ( !sourceFile.getName().equals( sourceFile.getTitle() ) ) {
            duplicateFile =
View Full Code Here

        destFileDto.setHidden( isHidden );

        RepositoryFile destFile = toFile( destFileDto );

        // add the existing acls and file data
        RepositoryFileAcl acl = getRepository().getAcl( sourceFile.getId() );
        if ( !file.isFolder() ) {
          IRepositoryFileData data = getData( sourceFile );

          getRepository().updateFile( destFile, data, null );
          getRepository().updateAcl( acl );
View Full Code Here

    logger.info( "getEffectiveAces" );
    List<RepositoryFileAce> folder1EffectiveAces = repo.getEffectiveAces( folder1.getId() );
    assertEquals( 1, folder1EffectiveAces.size() );

    logger.info( "getAcl" );
    RepositoryFileAcl folder1Acl = repo.getAcl( folder1.getId() );
    assertEquals( USERNAME_SUZY, folder1Acl.getOwner().getName() );

    logger.info( "updateAcl" );
    userRoleDao.createUser( tenantAcme, USERNAME_TIFFANY, PASSWORD, "", null );
    RepositoryFileAcl updatedFolder1Acl =
        repo.updateAcl( new RepositoryFileAcl.Builder( folder1Acl ).entriesInheriting( false ).ace(
            userNameUtils.getPrincipleId( tenantAcme, USERNAME_TIFFANY ), RepositoryFileSid.Type.USER,
            RepositoryFilePermission.ALL ).build() );
    assertNotNull( updatedFolder1Acl );
    assertEquals( 1, updatedFolder1Acl.getAces().size() );

    logger.info( "lockFile" );
    assertFalse( file1.isLocked() );
    repo.lockFile( file1.getId(), "I locked this file" );
    logger.info( "canUnlockFile" );
View Full Code Here

  public RepositoryFileAcl processAclForFile( String filePath ) {
    // If we are not overwriting ACL's or owners then return null.
    // If we are writing ACL's we'll have to check later in RepositoryFileImportHandler whether to overwrite
    // based on the isOverwriteAcl setting and whether we are creating or updating the RepositoryFile.
    RepositoryFileAcl acl = null;
    if ( applyAclSettings || retainOwnership ) {
      try {
        if ( manifest != null ) {
          ExportManifestEntity entity = manifest.getExportManifestEntity( filePath );
          if ( entity != null ) {
View Full Code Here

   * @throws ExportException
   */
  private void addToManifest( RepositoryFile repositoryFile ) throws ExportException {
    if ( this.withManifest ) {
      // add this entity to the manifest
      RepositoryFileAcl fileAcl = unifiedRepository.getAcl( repositoryFile.getId() );
      try {
        exportManifest.add( repositoryFile, fileAcl );
      } catch ( ExportManifestFormatException e ) {
        throw new ExportException( e.getMessage() );
      }
View Full Code Here

   *
   * @see org.pentaho.platform.api.action.IAction#execute()
   */
  public void execute() throws Exception {
    // scan the repository for all files with a RESERVEDMAPKEY_LINEAGE_ID
    RepositoryFileTree tree = repository.getTree( ClientRepositoryPaths.getRootFolderPath(), -1, null, false );
    ArrayList<RepositoryFile> generatedContentList = new ArrayList<RepositoryFile>();
    findGeneratedContent( generatedContentList, tree );
    for ( RepositoryFile deleteMe : generatedContentList ) {
      repository.deleteFile( deleteMe.getId(), true, GeneratedContentCleaner.class.getName() );
      logger.info( "GeneratedContentCleaner deleting: " + deleteMe.getPath() );
View Full Code Here

TOP

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

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.