Package org.pentaho.platform.repository2.unified.webservices

Examples of org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto


   
    if (fileInfo == null) {
      throw new FileSystemException(FILE_NOT_FOUND, name);
    }
   
    final RepositoryFileDto file = fileInfo.getFile();
   
    if ( file == null ) {
      throw new FileSystemException(BI_SERVER_NULL_OBJECT);
    }   
    return file;
View Full Code Here


    final RepositoryFileTreeDto fileInfo = lookupNode(fileName);
    if (fileInfo == null)
    {
      throw new FileSystemException(FILE_NOT_FOUND, file);
    }
    final RepositoryFileDto fileDto = fileInfo.getFile();
    if (fileDto == null)
    {
      throw new FileSystemException(BI_SERVER_NULL_OBJECT);
    }
    return fileDto.isFolder();
  }
View Full Code Here

    final String[] childrenArray = new String[ children.size() ];
    for ( int i = 0; i < children.size(); i++ ) {
      final RepositoryFileTreeDto treeNode = children.get( i );
      if ( treeNode != null ) {
        final RepositoryFileDto file = treeNode.getFile();
        if ( file != null ) {
          logger.debug( "file " + file.getName() );
          childrenArray[ i ] = file.getName();
        } else {
          throw new FileSystemException( NULL_OBJECT );
        }
      }
    }
View Full Code Here

  }

  public static RepositoryFileTreeDto convertFromRepositoryFileTree( RepositoryFileTree tree ) {
    RepositoryFileTreeDto fileTreeDto = new RepositoryFileTreeDto();
    List<RepositoryFileTreeDto> fileList = new ArrayList<RepositoryFileTreeDto>();
    RepositoryFileDto file = convertFromRepositoryFile( tree.getFile() );
    fileTreeDto.setFile( file );
    for ( RepositoryFileTree treeItem : tree.getChildren() ) {
      fileList.add( convertFromRepositoryFileTree( treeItem ) );
    }
    fileTreeDto.setChildren( fileList );
View Full Code Here

    fileTreeDto.setChildren( fileList );
    return fileTreeDto;
  }

  public static RepositoryFileDto convertFromRepositoryFile( RepositoryFile file ) {
    RepositoryFileDto repositoryFile = new RepositoryFileDto();
    repositoryFile.setCreatedDate( file.getCreatedDate() );
    repositoryFile.setDeletedDate( file.getDeletedDate() );
    repositoryFile.setDescription( file.getDescription() );
    repositoryFile.setFolder( file.isFolder() );
    repositoryFile.setHidden( file.isHidden() );
    repositoryFile.setId( file.getId() );
    repositoryFile.setLastModifiedDate( file.getLastModifiedDate() );
    repositoryFile.setLocale( file.getLocale() );
    repositoryFile.setLockDate( file.getLockDate() );
    repositoryFile.setLocked( file.isLocked() );
    repositoryFile.setLockMessage( file.getLockMessage() );
    repositoryFile.setLockOwner( file.getLockOwner() );
    repositoryFile.setName( file.getName() );
    repositoryFile.setOriginalParentFolderPath( file.getOriginalParentFolderPath() );
    repositoryFile.setOriginalParentFolderPath( file.getOriginalParentFolderPath() );
    repositoryFile.setOwner( file.getOwner() );
    repositoryFile.setPath( file.getPath() );
    repositoryFile.setTitle( file.getTitle() );
    repositoryFile.setVersionId( file.getVersionId() );
    return repositoryFile;
  }
View Full Code Here

   * @param locale The locale to be deleted
   * @throws Exception containing the string, "SystemResource.GENERAL_ERROR"
   */
  public void doDeleteLocale( String pathId, String locale ) throws Exception {
    try {
      RepositoryFileDto file = getRepoWs().getFile( idToPath( pathId ) );
      if ( file != null ) {
        getRepoWs().deleteLocalePropertiesForFile( file.getId(), locale );
      }
    } catch ( Exception e ) {
      logger.error( Messages.getInstance().getString( "SystemResource.GENERAL_ERROR" ), e );
      throw e;
    }
View Full Code Here

  }

  @Test
  public void testSetContentCreator() throws Exception {
    String pathId = "pathId";
    RepositoryFileDto mockRepositoryFileDto = mock( RepositoryFileDto.class );

    doNothing().when( fileResource.fileService ).doSetContentCreator( pathId, mockRepositoryFileDto );

    Response mockOkResponse = mock( Response.class );
    doReturn( mockOkResponse ).when( fileResource ).buildOkResponse();
View Full Code Here

  }

  @Test
  public void testSetContentCreatorError() throws Exception {
    String pathId = "pathId";
    RepositoryFileDto mockRepositoryFileDto = mock( RepositoryFileDto.class );

    Response mockNotFoundResponse = mock( Response.class );
    doReturn( mockNotFoundResponse ).when( fileResource ).buildStatusResponse( NOT_FOUND );

    Response mockInternalServerErrorResponse = mock( Response.class );
View Full Code Here

   * not available
   * @throws FileNotFoundException
   */
  public void doMoveFiles( String destPathId, String params ) throws FileNotFoundException {
    String idToPath = idToPath( destPathId );
    RepositoryFileDto repositoryFileDto = getRepoWs().getFile( idToPath );
    if ( repositoryFileDto == null ) {
      throw new FileNotFoundException( idToPath );
    }
    String[] sourceFileIds = params.split( "[,]" );
    int i = 0;
    try {
      for ( ; i < sourceFileIds.length; i++ ) {
        getRepoWs().moveFile( sourceFileIds[ i ], repositoryFileDto.getPath(), null );
      }
    } catch ( IllegalArgumentException e ) {
      throw e;
    } catch ( Exception e ) {
      throw new InternalError();
View Full Code Here

    verify( fileResource, times( 1 ) ).buildServerErrorResponse( mockThrowable );
  }

  @Test
  public void testDoGetRootProperties() {
    RepositoryFileDto mockRepositoryFileDto = mock( RepositoryFileDto.class );
    doReturn( mockRepositoryFileDto ).when( fileResource.fileService ).doGetRootProperties();

    RepositoryFileDto testRepositoryFileDto = fileResource.doGetRootProperties();
    assertEquals( mockRepositoryFileDto, testRepositoryFileDto );

    verify( fileResource.fileService, times( 1 ) ).doGetRootProperties();
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto

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.