如何获得用于在IBM Content Manager中下载元数据和图像的代码

时间:2019-06-01 15:50:12

标签: ecm

我正在尝试在与cm IBM一起使用的java API中找到代码。示例代码在这里,但仅用于登录。任何人都可以帮助获取该代码来下载图像和元数据

1 个答案:

答案 0 :(得分:0)

正如您所说的,您具有基本的连接代码,请使用以下功能下载文档。

 public String retrieveDocument(CMBConnection connection, CMBItem item)
          throws CMBException, IOException, Exception 
     {
          // Get an instance of data management bean
          CMBDataManagement dataManagement = connection.getDataManagement();
          // Set the current data item
          dataManagement.setDataObject(item);
          // Retrieve the original file name
          CMBObject object = dataManagement.getContent(0);
          String inputFileName = object.getOriginalFileName();
          // Parse the file name from the full path
          int pos=inputFileName.lastIndexOf("\\");
          inputFileName = inputFileName.substring(pos+1);
          // Write the document content to a new file 
          String fileName = System.getProperty("user.dir") 
               + File.separator + inputFileName;
          System.out.println("Output file name " + fileName); 
          FileOutputStream fileoutstream = new FileOutputStream(fileName);
          fileoutstream.write(dataManagement.getContent(0).getData());
          fileoutstream.close();
          // Return file name
          return fileName;
     }