[SOLVED] AssertionFailedException when try getvalue of enum
![]()
Hi,
Any one knows how to get combobox (as a enum type) selected value? So, I have a work item that has a enum attribute and one advisor to get this enum value, but when I try to get it, I take a Assert failed like below:
The interesting thing is that I can get the attribute but can not the selected value.. below my code:
IAttribute attribute = workItemService.findAttribute(wi.getProjectArea(), "tipoFuncaoComboBox", monitor);
Object test1 = ((IWorkItem) wi.getWorkingCopy()).getValue(attribute); //fail
Object test2 = wi.getValue(attribute); //fail
Object test3 = attribute.getValue(auditableCommon, wi, monitor); //fail
The process template is: http://www.heypasteit.com/clip/0YIC
|
Accepted answer
![]()
Ralph Schoon (61.8k●3●36●43)
| answered Sep 10 '13, 1:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
This post should provide you with some examples, I believe: http://rsjazz.wordpress.com/2012/08/20/manipulationg-work-item-enumeration-values/
Joao Bosco Jares A. Chaves selected this answer as the correct answer
Comments I was read this, but when ever I try the start point of this post that is: workItem.getValue(iAttribute); I get the org.eclipse.core.runtime.AssertionFailedException: assertion failed.
Why?
So I am using server side code, then I had to translate some code to the server side api, as below. However the same exception persists on the line that has this comment: //AssertionFailedException: assertion failed.
Is this possible that is caused by some bad process configuration, related with the enumeration?
Best Regards,
My Code:
// this will throw exception if not enumeration IEnumeration<ILiteral> enumeration = (IEnumeration<ILiteral>) workItemService.resolveEnumeration(attribute, monitor);
} 1
I can't debug your code. Here is some code I wrote on the server. It is basically the same as on the client, except the services IWorkitemServer and IWorkItemCommon used instead of Client Libraries.
// Get the references for the trigger work item, we need it to add new // links IWorkItemReferences triggerItemReferences = iWorkItemServer .resolveWorkItemReferences(resolvedTriggerItem, monitor); I would suggest to look into the links provided in the answers and debug your code on Jetty as suggested in https://jazz.net/library/article/1000 to understand where your code is wrong. |
4 other answers
![]()
Below my code:
|
![]()
Sam, thanks very much again =)
|
![]()
Hi friends,
So, I discovered that enum resolver is to simple as explained by @Ralph Schoon and @sam detweiler. However, my case is a bit different, because I need the enum value of a work item child (second level), and when I try to get the enum value on the on save action of the parent of parent work item, I can not access the enum value of the second level child, as described below:
WI_A (parent);
WI_B (child first level);
WI_C (child scond level);
OR
WI_C is child of WI_B that is child of WI_A.
So, I have to obtain all the values from WIB_B and WI_C, at the on save (precondition advisor) of the WI_A. But, as mentioned above, I can not do it, or I can not know how to do it, and I am so glad if any one can help. But, I will close this thread as solved, and open another one more specific for this situation, that I think is different for this one.
Comments 1
![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Joao,
|
![]()
This thing is simple a lot, the sercret is how to obtain the children as my source code fragment below.. Look for this comment //SECRET :)
|
Comments
enum's don't have 'values', you have to 'resolve' them
see my sample in
https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes
see the code following this line
" // this will throw exception if not enumeration"