How do I update a custom attribute of type contributor list from the java API so that I can bypass the voting restrictions?
We're trying to figure out how to use the voting functionality but we also need to figure out how to translate some manually cast votes onto a work item on behalf of somebody else. The voting functionality prevents being able to cast a vote for somebody else. But I'm hoping that this could be bypassed by an admin by going through the java API.
Following Ralph's blog about getting work item attributes I have no problem getting the Object from IWorkItem.getValue(). But I'm not sure what type of Object I'm getting back, it appears to be a "com.ibm.team.workitem.common.internal.util.DelegatingItemList", but how can I modify this object and then update the value?
I'm in the process of downloading the SDK in the meantime hoping there'll be some examples in there, but was hoping somebody could lead us in the right direction.
One answer
You create a List of IContributors or IContributorHandles and pass that in the set. Or you get the value, cast the object to a List and read the entries.
This pattern is used for all multi-value attribute types.
See the code in A RTC WorkItem Command Line Version 2.2 for how to do that.
If you try that on Jazz.net, it is cheating!
This pattern is used for all multi-value attribute types.
See the code in A RTC WorkItem Command Line Version 2.2 for how to do that.
If you try that on Jazz.net, it is cheating!
Comments
I was able to get the code working so that it attempts the update, but I get the same error that the web ui throws. Any other ideas how we might be able to do a vote for somebody else? Is there a way to do impersonation through the java API?
CRRTC0303E: You can cast one vote only. Adding or removing another contributor from the voters list is not allowed.
From what I can tell this is being done by VotesParticipant extends WorkItemSaveParticipant. I guess this particular work item save participant always runs and can't be configured in a process configuration? It seems that disabling the voting feature doesn't disable it (even with a server reset & bounce).