It's all about the answers!

Ask a question

Getting IAttributeHandle from IAttribute


Marcelo Bilezker (46112) | asked Nov 22 '21, 7:25 a.m.

I need to set a value to an enumeration field

I know the IAttribute of the field, and in:
  

it says that i must call function: 

Identifier ident = getLiteralEqualsString (String s, IAttributeHandle ah)

to get the Identifier value.

How I do get the IAttributeHandle from the IAttribute ?

Accepted answer


permanent link
Ralph Schoon (63.3k33646) | answered Nov 22 '21, 8:59 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 In your development environment set up based on the RTC Extensions workshop, you use Navigate>Open Type


You enter com.ibm.team.workitem.common.model.IAttribute and open the type. 
Check the interfaces that com.ibm.team.workitem.common.model.IAttribute extends and answer your question.

The getLiteralEqualsString  is a utility that needs to be written. I think it is shown in the post. 

Marcelo Bilezker selected this answer as the correct answer

Comments
Marcelo Bilezker commented Nov 22 '21, 6:28 p.m.

I resolved it looking at:
https://github.com/jazz-community/rtc-command-line/blob/master/src/com/cli/ccm/WorkItemManager.java


What is confused is that function getLiteralEqualString as shown in the help link
receives as parameter IAttributeHandle, but when it is called, in WorkItemManager.java  it is called with IAttribute

So there is not need to convert IAttribute to IAttributeHandle. It works the same sending IAttribute as parameter, even when getLiteralEqualString receives as parameter IAttributeHandle



Ralph Schoon commented Nov 23 '21, 2:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

My coding is not flawless, so fix the code for getLiteralEqualString. 


Ralph Schoon commented Nov 23 '21, 6:16 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I just checked the WCL https://github.com/jazz-community/work-item-command-line and there I also use the IAttributeHandle, but I resolve the handle to the IAttribute every time. This simplifies it for me but is less effective.

 


Marcelo Bilezker commented Nov 23 '21, 9:22 a.m.

 

Yes, I did that and works. I had seen this function before, but my problem was that parameter , 
Thanks for the orientation


Ralph Schoon commented Nov 23 '21, 9:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The APIs in Jazz products/EWM are all about handles and you need to resolve the handle to get at the full object. 

Your answer


Register or 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.