It's all about the answers!

Ask a question

Get the list of possible values for "Found in " and "Planned for" fields


ioana lazar (9910) | asked Aug 01 '12, 10:08 a.m.
edited Aug 01 '12, 10:08 a.m.
 Hey,
I want to create a defect from java code using the java plain client libraries, but I have problems on getting the possible values for the "Found in " field and the "Planned for" field.
The solution with 
IEnumeration<? extends ILiteral> foundIn= 

workItemClient.resolveEnumeration((IAttributeHandle) foundInAttribtute.getItemHandle(), null);
gives me org.eclipse.core.runtime.AssertionFailedException.
Thanks

Accepted answer


permanent link
Ralph Schoon (63.4k33646) | answered Aug 01 '12, 11:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Ioana,

please see https://rsjazz.wordpress.com/2012/08/01/uploading-attachments-to-work-items/ for how an operation to modify a work item would look like. Inside this operation you would use:

            IAttribute attribute = workItemClient.findAttribute(workItem.getProjectArea(), "foundIn" , monitor);
            if(null!=attribute){
                if(workItem.hasAttribute(attribute))
                    workItem.setValue(attribute, fValue);
            }

The same for custom attributes:

           IAttribute attribute = workItemClient.findAttribute(workItem.getProjectArea(), "foundIn" , monitor);
            if(null!=attribute){
                if(workItem.hasCustomAttribute(attribute))
                    workItem.setValue(attribute, fValue);
            }

ioana lazar selected this answer as the correct answer

Comments
ioana lazar commented Aug 02 '12, 3:22 a.m. | edited Aug 02 '12, 4:00 a.m.

Hey. I have already done this part and it works for founIn. I still have to resolve this for planned for. Thanks.


Ralph Schoon commented Aug 02 '12, 3:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Ioana, we are all on a journey into the unknown here. I am doing that quite some time now and I still have large gaps. Using the ID has worked for me. The confusing part for the built in attributes the ID displayed in the Project configuration editor does not match the real ID.

One other answer



permanent link
Ralph Schoon (63.4k33646) | answered Aug 01 '12, 10:36 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Aug 01 '12, 10:38 a.m.
Ioana,

that error is probably due to the fact that "Found in" is of type deliverable, which is easy to spot if you look at the Workitem Types and Attributes in the process configuration, or use the Eclipse debugger to debug you code and inspect the elements. It is also a good practice to always put an

if( whatever instanceof MeThinksItIs) {
MeThinksItIs newthing = (MeThinksItIs) whatever;
}

around the cast just to be sure.

https://jazz.net/library/article/807 contains some code around deliverables. Not sure it is the code you are looking for.

Comments
ioana lazar commented Aug 01 '12, 10:53 a.m. | edited Aug 01 '12, 11:04 a.m.

hey, I got to the IDeliverable part after editing the question, and I got the name of every release, but now I don;t know how to use a deliverable to set the value for the target attribute.

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.