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
Accepted answer
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);
}
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);
}
Comments
One other answer
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.
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.