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

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


   * @param pathId (colon separated path for the repository file)
   * @return <code> RepositoryFileAclDto </code>
   */
  public RepositoryFileAclDto doGetFileAcl( String pathId ) {
    RepositoryFileDto file = getRepoWs().getFile( FileUtils.idToPath( pathId ) );
    RepositoryFileAclDto fileAcl = getRepoWs().getAcl( file.getId() );
    if ( fileAcl.isEntriesInheriting() ) {
      List<RepositoryFileAclAceDto> aces =
        getRepoWs().getEffectiveAcesWithForceFlag( file.getId(), fileAcl.isEntriesInheriting() );
      fileAcl.setAces( aces, fileAcl.isEntriesInheriting() );
    }
    addAdminRole( fileAcl );
    return fileAcl;
  }
View Full Code Here


  }

  @Test
  public void testSetFileAcls() throws Exception {
    String pathId = "pathId";
    RepositoryFileAclDto mockRepositoryFileAclDto = mock( RepositoryFileAclDto.class );

    doNothing().when( fileResource.fileService ).setFileAcls( pathId, mockRepositoryFileAclDto );

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

  }

  @Test
  public void testSetFileAclsError() throws Exception {
    String pathId = "pathId";
    RepositoryFileAclDto mockRepositoryFileAclDto = mock( RepositoryFileAclDto.class );

    Messages mockMessages = mock( Messages.class );
    doReturn( mockMessages ).when( fileResource ).getMessagesInstance();

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

  @Test
  public void testDoGetFileAcl() {
    String pathId = "pathId";

    RepositoryFileAclDto mockRepositoryFileAclDto = mock( RepositoryFileAclDto.class );
    doReturn( mockRepositoryFileAclDto ).when( fileResource.fileService ).doGetFileAcl( pathId );

    RepositoryFileAclDto testResult = fileResource.doGetFileAcl( pathId );
    assertEquals( mockRepositoryFileAclDto, testResult );
  }
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.isHidden();
  }
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);
    }
    fileDto.setDescription(description);
  }
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.getDescription();
  }
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);
    }
    final Date lastModifiedDate = fileDto.getLastModifiedDate();
    if (lastModifiedDate == null)
    {
      logger.error("Repository returned <null> for last-modified-date on file: " + file);
      return -1;
    }
View Full Code Here

        return null;
      }

      for (final RepositoryFileTreeDto child : children)
      {
        final RepositoryFileDto file = child.getFile();
        if (file == null)
        {
          throw new FileSystemException(BI_SERVER_NULL_OBJECT);
        }
        if (pathSegment.equals(file.getName()))
        {
          name = child;
          break;
        }
      }
View Full Code Here

    if (fileInfo == null)
    {
      throw new FileSystemException(FILE_NOT_FOUND, file);
    }

    final RepositoryFileDto fileDto = fileInfo.getFile();
    if (fileDto == null)
    {
      throw new IllegalStateException(BI_SERVER_NULL_OBJECT);
    }
    final String path = normalizePath(fileDto.getPath());
    String urlPath = path;
    try{urlPath = URLEncoder.encodeUTF8(path).replaceAll("\\!", "%21").replaceAll("\\+", "%2B");}catch(Exception ex){}//tcb
    final String service = MessageFormat.format(DOWNLOAD_SERVICE, urlPath);

    return client.resource(url + service).accept(MediaType.APPLICATION_XML_TYPE).get(byte[].class);
View Full Code Here

TOP

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

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.