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

Issues programatically creating approval records

Here is the code snippet:
            IApprovals approvals= workItem.getApprovals();
            approvals.createDescriptor(WorkItemApprovals.VERIFICATION_TYPE.getIdentifier(), "Verification Record");
            IApproval approval= approvals.createApproval(descriptor, reviewer);
            approvals.add(approval);

I am getting the following error on the createDescriptor line.
com.ibm.team.repository.common.internal.ImmutablePropertyException

From my research so far, that exception usually can be fixed by using the workItemCopy.  However, approvals and Iapprovals doesn't like workitemcopy.

Any ideas on how to resolve this issue?
Thx

0 votes


Accepted answer

Permanent link
Cindy, approvals do like working copies, as far as I can tell. The example code here should work for you: http://rsjazz.wordpress.com/2012/10/01/adding-approvals-to-work-items-using-the-plain-java-client-libraries/

You can use the active piece with a WorkItemOperation as well with your own workingcopy code.


Cindy Luk selected this answer as the correct answer

1 vote


One other answer

Permanent link
Thanks for the information.  I now have working code.
It turns out my issue was having an incorrect import statement.  The correct imports are as follows:
import com.ibm.team.workitem.common.model.IApproval;
import com.ibm.team.workitem.common.model.IApprovalDescriptor;

The incorrect import is this:
import com.ibm.team.workitem.common.template.IWorkItemDescriptor.IApproval;

0 votes

Comments

Cindy, please accept the answer then. (The check mark underneath the vote down).

FYI , I ran into an issue recently, where I had an incorrect issue too. It appears that agile planning .apt. has classes with conflicting names too. Thanks for the information.

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: Sep 28 '12, 3:10 p.m.

Question was seen: 4,604 times

Last updated: Oct 02 '12, 3:49 p.m.

Confirmation Cancel Confirm