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

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

 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

0 votes


Accepted answer

Permanent link
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

0 votes

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

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

0 votes

Comments
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 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

Question asked: Aug 01 '12, 10:08 a.m.

Question was seen: 7,229 times

Last updated: Aug 02 '12, 4:00 a.m.

Confirmation Cancel Confirm