/**
   * Select a single page and save the result in the specified directory
   *
   * @param FileName
   * @param format
   * @param pageNumber
   * @param downloadDirectory
   * @return String the first file attachment name
   * @throws RemoteException
   */
  public String selectJavaReportPage(
      String FileName, String format, int pageNumber, String downloadDirectory)
      throws RemoteException {
    // Set file name to view
    com.actuate.schemas.ObjectIdentifier objectIdentifier =
        new com.actuate.schemas.ObjectIdentifier();
    objectIdentifier.setName(FileName);

    // Set the pages to view
    com.actuate.schemas.PageIdentifier pageIdentifier = new com.actuate.schemas.PageIdentifier();
    pageIdentifier.setPageNum(new Long(pageNumber));

    // Set the select page request
    com.actuate.schemas.SelectJavaReportPage selectJavaReportPage =
        new com.actuate.schemas.SelectJavaReportPage();
    selectJavaReportPage.setObject(objectIdentifier);
    // selectJavaReportPage.setViewParameter(viewParameter);
    selectJavaReportPage.setPage(pageIdentifier);
    selectJavaReportPage.setDownloadEmbedded(new Boolean(true));

    // SelectPage
    com.actuate.schemas.SelectJavaReportPageResponse selectJavaReportPageResponse =
        proxy.selectJavaReportPage(selectJavaReportPage);

    // Save the result in download directory
    new File(downloadDirectory).mkdir();

    String firstAttachmentName =
        saveAttachment(selectJavaReportPageResponse.getPageRef(), downloadDirectory);

    return firstAttachmentName;
  }