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

How to get all the data values that are inside a custom attribute?

Hi,
I have a custom Attribute that has n number of data that can be selected from RTC front hand.
What I am trying to do is get all the data that are included in the attribute

    IAttribute custom = workItemClient.findAttribute(projectArea,"affected_environments", progressMonitor);
    System.out.println(    "Value "+workItem.getValue(custom));

This above code only gives me default value .
Is there any way i can get the list of all the data that are associated with that attribute?


Thanks

0 votes


Accepted answer

Permanent link
Please have a look at http://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ and for enumerations here: http://rsjazz.wordpress.com/2012/08/20/manipulationg-work-item-enumeration-values/
kishan adhi selected this answer as the correct answer

0 votes

Comments

You need to get the client library workitemCommon. The code below shows it for the workitemClient, but the pattern is the same.

IWorkItemClient workItemClient = (IWorkItemClient) teamRepository().getClientLibrary(IWorkItemClient.class);

WorkitemCommon would look like:


IWorkItemCommon workItemCommon = (IWorkItemCommon) teamRepository().getClientLibrary(IWorkItemCommon.class);


2 other answers

Permanent link
Thank you guys for your time and suggestion.
For other reader this link also might be helpful

https://jazz.net/forum/questions/52722/getset-the-displayed-name-of-an-enumeration-type-attribute


Thanks

1 vote


Permanent link
do you mean this is a variable that holds one selection of an enumeration, and you would like to get all the values of the enumeration?

<code>
List<ILiteral> enumerationLiterals = (List<ILiteral>) workItemCommon
                   .resolveEnumeration(ia, monitor).getEnumerationLiterals();
System.out.println("\t\t\t\thave an enumeration list (V4 and up)");
List<Identifier> ial = (List<Identifier>)ia.getValue(auditableClient, workItem, monitor);
System.out.println("\t\t\t\t there are " + ial.size() + " entries selected");
for(int r=0;r<ial.size();r++)
{                               
   for (ILiteral literal : enumerationLiterals)
   {
        if (literal.getIdentifier2().getStringIdentifier()
          .equalsIgnoreCase(ial.get(r).getStringIdentifier()))
        {
            System.out.println("\t\t\t\t entry "+  (r+1) + " -->
                   + " literal="
                   + literal.getIdentifier2().getStringIdentifier()
                   + " literal value="
                   + literal.getName());
            break;
         }
    }                                                               
}
</code>

0 votes

Comments

I dont know how to initialize variable
Object ia;
 IWorkItemCommon workItemCommon;


Can you explain little bit or provide the code
Thanks for your time

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,937
× 234
× 89
× 1

Question asked: Apr 09 '13, 1:35 p.m.

Question was seen: 6,761 times

Last updated: Apr 10 '13, 12:45 p.m.

Confirmation Cancel Confirm