How to create the workItem Query for attachment file size more then 1MB by JAZZ API ?
![]()
I am trying to create a query that filters on work item attachment file size .
For example I want to return all work items that have files(Attachment) which more then 1024KB by Java API |
Accepted answer
![]() I got the result by JAVA API using the below logic:
IQueryableAttribute attachmentAttribute = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(projectAreaObject, "link:com.ibm.team.workitem.linktype.attachment:target",auditableCommonObject, monitor);
Expression exAttachmentSize = new AttributeExpression(attachmentAttribute , AttributeOperation.GREATER_OR_EQUALS, 1048576); term.add(exAttachmentSize); Ralph Schoon selected this answer as the correct answer
|
3 other answers
![]()
Ralph Schoon (61.8k●3●36●43)
| answered Dec 16 '16, 3:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Since this is not supported in the UI Query Editor, I would assume there is no way to query for this. You would likely have to go through all work items, their attachments and you might even have do get all the content to get at the length.
com.ibm.team.repository.common.IContent.getRawLength() e.g. com.ibm.team.workitem.common.model.IAttachment.getContent().getRawLength() Comments No . I able to see in UI Query editor (Attachments>Content>Content Length) . it is working fine also . I want same login should we implement in Java API ? |
![]()
Ralph Schoon (61.8k●3●36●43)
| answered Dec 16 '16, 4:32 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Then see these API examples:
https://rsjazz.wordpress.com/2012/10/29/using-work-item-queris-for-automation/ https://rsjazz.wordpress.com/2012/11/19/using-an-expression-to-synchronize-attributes-for-work-items-of-a-specific-type/ Comments I still don't see it in the work item query editor at least in 6.0.
I could not see related to attachment expression . ![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
For some reason, the Attachments -> Content -> Content_Length query term is only available in the Eclipse UI (not in the Web UI). And if you view a query in the Web UI with that query term, you see there is a term, but no information about that term.
thanks for your response. |
![]() IQueryableAttribute attachmentAttribute = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(projectAreaObject, "link:com.ibm.team.workitem.linktype.attachment:target",auditableCommonObject, monitor);
You could use com.ibm.team.workitem.common.internal.expression.QueryableLinkAttribute#createIdentifier to get the value for parameter attributeIdentifier of com.ibm.team.workitem.common.expression.IQueryableAttributeFactory#findAttribute.
Cheers.
|