如何使用java从clear quest下载附件

时间:2015-01-04 13:38:29

标签: java attachment clearquest

我已经安装了明确的任务7.1.2。

有一个名为“附件”的字段,类型为ATTACHMENT_LIST,格式为

我尝试使用java获取附件    ...
   CQEntity entity = _cqsession.GetEntity(“id”,rs.GetColumnValue(0));
   的System.out.println(entity.GetFieldValue( “附件”));
   ......

结果如下所示 45462489个
A.docx
7517688

44348818
B.doc
1076224

任何人都可以帮助提供一些java示例来获取这些附件的位置然后下载它们吗?

1 个答案:

答案 0 :(得分:0)

我通过搜索网找到了解决方案。 https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014162725
它是用perl写的

use CQPerlExt;  
my $u_session = CQSession::Build();
$u_session->UserLogon("username", "password", "CQ_DBNAME", "CQ_DBSET");  
$entity = $u_session->GetEntity("CQ_DBNAME", "00000344");  
$attachfields = $entity->GetAttachmentFields(); 
$attachfield1 = $attachfields->Item(0);  
$attachments = $attachfield1->GetAttachments(); 
$numattachments = $attachments->Count();  
for ($x = 0 ; $x < $numattachments ; $x++)   
{  
   $attachment = $attachments->Item($x);  
   $filename = $attachment->GetFileName();  
   $status = $attachment->Load("C:\\".$filename);  
}