Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

JazzPlainJavaClient: how to use Identifier in query?

I am using JazzPlainJavaClient to make a query program. I has met a problem in my coding: I want to query work items with the condition of severity. This is My code:

1.String severity_normal = "severity.literal.l3";

2.Identifier sIdentifier = Identifier.create (classType, severity_normal);

3.IQueryableAttribute severityAttribute = findAttribute (projectArea, auditableClient, IWorkItem.SEVERITY_PROPERTY, null);

4.AttributeExpression severityExpression = new AttributeExpression (severityAttribute, AttributeOperation.EQUALS, sIdentifier);

Is it a correct way to create AttributeExpression of severity? And what value should be set to the param "classType" in the row #2

0 votes


Accepted answer

Permanent link
I am using JazzPlainJavaClient to make a query program. I has met a
problem in my coding: I want to query work items with the condition
of severity. This is My code:

1.String severity_normal = "severity.literal.l3";

2.Identifier sIdentifier = Identifier.create (classType,
severity_normal);

3.IQueryableAttribute severityAttribute = findAttribute (projectArea,
auditableClient, IWorkItem.SEVERITY_PROPERTY, null);

4.AttributeExpression severityExpression = new AttributeExpression
(severityAttribute, AttributeOperation.EQUALS, sIdentifier);

Is it a correct way to create AttributeExpression of severity? And
what value should be set to the param "classType" in the
row #2

Yes, this looks correct. I think passing in the string instead of the
identifier is possible, too. The classType argument for the Identifier
would be ISeverity.class in your example above.

Regards,
Patrick
Jazz Work Item Team
Ralph Schoon selected this answer as the correct answer

0 votes


3 other answers

Permanent link
I am using JazzPlainJavaClient to make a query program. I has met a
problem in my coding: I want to query work items with the condition
of severity. This is My code:

1.String severity_normal = "severity.literal.l3";

2.Identifier sIdentifier = Identifier.create (classType,
severity_normal);

3.IQueryableAttribute severityAttribute = findAttribute (projectArea,
auditableClient, IWorkItem.SEVERITY_PROPERTY, null);

4.AttributeExpression severityExpression = new AttributeExpression
(severityAttribute, AttributeOperation.EQUALS, sIdentifier);

Is it a correct way to create AttributeExpression of severity? And
what value should be set to the param "classType" in the
row #2

Yes, this looks correct. I think passing in the string instead of the
identifier is possible, too. The classType argument for the Identifier
would be ISeverity.class in your example above.

Regards,
Patrick
Jazz Work Item Team


My problem has benn resolved. Thank you for your reply. Now two new puzzles appears.
(1) When a IWorkItem instance is got,how to get its "phase found" and "find in" property(IWorkItem.FOUND_IN_PROPERTY)? I can not find any method to get them.
(2) About the "phase found". I want to create AttributeExpression for it; but I can not find its
PROPERTY value defined(like PROPERTY value defined as IWorkItem.FOUND_IN_PROPERTY) in class IWorkItem .Does it have a alias or is there any other way to get it?

0 votes


Permanent link
My problem has benn resolved. Thank you for your reply. Now two new
puzzles appears.
(1) When a IWorkItem instance is got,how to get its "phase
found" and "find in"
property(IWorkItem.FOUND_IN_PROPERTY)? I can not find any method to
get them.
(2) About the "phase found". I want to create
AttributeExpression for it; but I can not find its
PROPERTY value defined(like PROPERTY value defined as
IWorkItem.FOUND_IN_PROPERTY) in class IWorkItem .Does it have a alias
or is there any other way to get it?

You read all attribute values of a work item using

Object value= IWorkItem#getValue(IAttribute attribute);

where

IAttribute attribute= workItemClient.findAttribute(projectArea,
attributeId, monitor)

Patrick
Jazz Work Item Team

0 votes

Comments

If for enum custom attribute, how to create the identifier? In you example, you can use ISeverity.class, for custom attribute, which class should I use?

Identifier sIdentifier2 = Identifier.create(com.ibm.team.workitem.common.model.ISeverity.class,severity_2);

1 vote


Permanent link
For Enumeration/Enumeration List customization attribute, you should use com.ibm.team.workitem.common.model.ILiteral

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Nov 19 '08, 4:27 a.m.

Question was seen: 7,008 times

Last updated: Jan 22 '15, 4:18 a.m.

Confirmation Cancel Confirm