Uploaded image for project: 'FUSE Mediation Router'
  1. FUSE Mediation Router
  2. MR-928

Box component - unable to get tags or version number for files or folders

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • 2.14.0.redhat-62-xx
    • 2.14.0.redhat-62-xx
    • None
    • None

      If I update or create file/folder with tags using the box component, everythings works as it should. Checking the file on website I can see that created tag is there.
      But if when I get the file afterwards using getFile and calling method getTags() on the BoxFile object , I get null. Not sure if this is bug in Box Api or in component itself.

      The same problem is with method getVersionNumber when uploading new version of file. On the verbsite is the file marked as V2 but this method returns null.

      Here is sample code I am using for updating and geting the file

      final Map<String, Object> headers = new HashMap<String, Object>();
      headers.put("CamelBox.fileId", file.getId());
      headers.put("operation", "updateFileInfo");
      final BoxFileRequestObject requestObject = BoxFileRequestObject.getRequestObject();
      requestObject.setTags(new String[]{"camelTestTag"});
      headers.put("CamelBox.fileRequest", requestObject);
      
      BoxFile result = template.requestBodyAndHeaders("direct://files", null, headers, BoxFile.class);
      assertNotNull("updateFileInfo result", result);
      System.out.println(result.getName());
      // calling returns null
      System.out.println(result.getTags());
      
       // Trying get the file if for some reason returned object didn't have the update tags
      headers.clear();
      headers.put("CamelBox.fileId", result.getId());
      headers.put("operation", "getFile");
      BoxFile result2 = template.requestBodyAndHeaders("direct://files", null, headers, BoxFile.class);
      assertNotNull(result2);
      System.out.println(result2.getName());   
      // Still null
      System.out.println(result2.getTags());
      

      And here is my camel route

          <route>
                  <from uri="direct:files"/>            
                  <choice>
                      <when>
                          <simple>${in.headers.operation} == 'getFile'</simple>
                          <to uri="box://files/getFile"/>
                      </when>
                      <when>
                          <simple>${in.headers.operation} == 'updateFileInfo'</simple>
                          <to uri="box://files/updateFileInfo"/>
                      </when>
                  </choice>
              </route>
      

            dbokde Dhiraj Bokde
            rjakubco Roman Jakubco (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: