Question about how to get custom attributes
Accepted answer
I always give my workitem attributes IDs I can figure out
com.xx.workitem.attribute.name
here is a link to my utility which prints out values of workitem attributes (workitems returned from query but not any different once u have the workitem)
see the accepted answer here
https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes
watch out, the forum changes text case for anything near a < or > character, so when u cut/paste this into an eclipse project java file, you will get some errors
2 other answers
Comments
my sample does ALL attributes, custom or not.. you can make it JUST custom
with a tiny little change near the top of routine
static void printAttributes(IWorkItem workItem,
IAuditableClient auditableClient, IProjectArea projectArea,
org.eclipse.core.runtime.IProgressMonitor monitor, ITeamRepository repository, String XML)
change this
for (IAttribute ia : workItemCommon.findAttributes(projectArea,
monitor))
to this
for (IAttribute ia : workItem.getCustomAttributes())
and u SAY you are not using the NAME, but then the pseudo code you show says
"attributeName"
so I was confused.
and for the specific question you asked
this is the access method provided..
for ALL attributes, you can get the IAttribute objects in a list from the Project Area.
then you have to check to see if THIS workitem HAS each attribute.
if (workItem.hasAttribute(ia) && !ia.isInternal())
for JUST custom attributes, you can get the IAttribute objects in a list from the Workitem.
then that test will always be true.
just the way the API works.
Any workitems created BEFORE you added the configuration info will not jg ave those new attributes until you do a synchronize operation on them.
Comments
if(ia.getIdentifier().equals("com.ibm.team.workitem.attribute.id")){
Solved, thanks a lot...
Can u tell us what u ended up doing?
Thank you. Others who are beginners can learn from your experience.