how to download attachments from clear quest using java

399 Views Asked by At

I have clear quest 7.1.2 installed.

There is a field named "attachments" of type ATTACHMENT_LIST in the form

I tried to get attachments using java.
...
CQEntity entity=_cqsession.GetEntity("id",rs.GetColumnValue(0));
System.out.println(entity.GetFieldValue("attachments"));
...

result shows as below
45462489
A.docx
7517688

44348818
B.doc
1076224

anyone can help to give some java examples to get the location of these attachments and then download them?

1

There are 1 best solutions below

0
On

I have found resolution trough search web. https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014162725
it is wrote in 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);  
}