Ho to fetch workitem type attribute value?
6 answers
Please see:
https://jazz.net/forums/viewtopic.php?t=3680
https://jazz.net/forums/viewtopic.php?t=4957
https://jazz.net/forums/viewtopic.php?t=14318
https://jazz.net/forums/viewtopic.php?t=17467
https://jazz.net/forums/viewtopic.php?t=24184
https://jazz.net/forums/viewtopic.php?t=1588
In a nutshell
Find the attribute
Or iterate the exiting ones:
You get the value as an object and need to cast it. Enumerations return ILiteral or something like that. I have no code snippet lying around for that case.
https://jazz.net/forums/viewtopic.php?t=3680
https://jazz.net/forums/viewtopic.php?t=4957
https://jazz.net/forums/viewtopic.php?t=14318
https://jazz.net/forums/viewtopic.php?t=17467
https://jazz.net/forums/viewtopic.php?t=24184
https://jazz.net/forums/viewtopic.php?t=1588
In a nutshell
Find the attribute
IAttribute customString = workItemClient.findAttribute(fProjectArea,
fCustomStringAttributeID, null);
Or iterate the exiting ones:
// List Custom Attributes
List<IAttributeHandle> custAttribs = workItem.getCustomAttributes();
for (Iterator<IAttributeHandle> iterator = custAttribs.iterator(); iterator.hasNext();) {
IAttributeHandle iAttributeHandle = (IAttributeHandle) iterator
.next();
IAttribute iAttribute = (IAttribute)fTeamRepository.itemManager().fetchCompleteItem(iAttributeHandle, 0, null);
System.out.print("Custom: " +iAttribute.getIdentifier()+" \t" +iAttribute.getDisplayName()+" \t"+iAttribute.getAttributeType());
Object value = workItem.getValue(iAttribute);
if(value!=null && value instanceof String) {
String sValue = (String) value;
System.out.print("\tValue: " + sValue);
}
System.out.println();
}
You get the value as an object and need to cast it. Enumerations return ILiteral or something like that. I have no code snippet lying around for that case.
Hi Sam,
Thank you very much.
Based on your post (
https://jazz.net/forums/viewtopic.php?t=24762) .
i have found the solution for retrieving priority and other values like enumeration , string type values.
But i am unable to retrieve Status (interanalState) attribute and work item type attributes values.
Thank you very much.
Based on your post (
https://jazz.net/forums/viewtopic.php?t=24762) .
i have found the solution for retrieving priority and other values like enumeration , string type values.
Hi Ralph Schoon,
Thank you for your response.
i have followed your post.
check my output below for this line,
System.out.print("Custom: " +customString.getIdentifier()+" \t" +customString.getDisplayName()+" \t"+customString.getAttributeType());
output:
Custom: customerid Customer ID workItem
And it doesn't return any value for work item type of attribute.
Thank you for your response.
i have followed your post.
check my output below for this line,
System.out.print("Custom: " +customString.getIdentifier()+" \t" +customString.getDisplayName()+" \t"+customString.getAttributeType());
output:
Custom: customerid Customer ID workItem
And it doesn't return any value for work item type of attribute.
Hi,
If I read your output correctly it says that the attribute Type identifier returned by IAttribute.getAttributeType() is "workItem".
So I would assume that it was configured to contain work items. Is that not correct?
If you are talking about the state of a work item, the work item has getters and setters for the built in attributes that you can use too.
If I read your output correctly it says that the attribute Type identifier returned by IAttribute.getAttributeType() is "workItem".
So I would assume that it was configured to contain work items. Is that not correct?
If you are talking about the state of a work item, the work item has getters and setters for the built in attributes that you can use too.
Hi Ralph Schoon,
its correct one of my attribute type is work item.
Please suggest me how to get the value of that attribute(work item type).
And also i am unable to fetch the value of State attribute.
Sorry for my inappropriate post.
I want to read the values of two attributes.
1. work item type attribute
2. State type attribute.
its correct one of my attribute type is work item.
Please suggest me how to get the value of that attribute(work item type).
And also i am unable to fetch the value of State attribute.
Sorry for my inappropriate post.
I want to read the values of two attributes.
1. work item type attribute
2. State type attribute.