如何获取用于在 IBM 内容管理器中下载元数据和图像的代码
How-to get the code for downloading metadata along with images in IBM content manager
我正在尝试在 java API 中找到与 cm IBM 一起使用的代码。示例代码在那里,但它仅用于登录。任何人都可以帮助获得下载图像和元数据的代码
正如您所说的,您有基本的连接代码,请使用以下功能下载文档..
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;
}
我正在尝试在 java API 中找到与 cm IBM 一起使用的代码。示例代码在那里,但它仅用于登录。任何人都可以帮助获得下载图像和元数据的代码
正如您所说的,您有基本的连接代码,请使用以下功能下载文档..
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;
}