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

How use work item API to add approvals?

Any one can provide some code sample for adding work item approval ?

Thanks very much!

0 votes



3 answers

Permanent link
Hi Jia,

clients can use this code:


private void createApproval(IWorkItem newState,
IAdvisorInfoCollector collector) throws TeamRepositoryException {
IContributorHandle owner = newState.getOwner();
IContributorHandle approver = null;
approver = getApproverExternalByOwner(owner);
// getApproverFromTeamHierarchy(owner,newState);

if (null == approver) {
IAdvisorInfo info = collector.createProblemInfo(
"Unable to create the Approval",
"Unable to find an approver for the work item", ID);
collector.addInfo(info);
return;
}
IApprovals approvals = newState.getApprovals();
IApprovalDescriptor descriptor = approvals.createDescriptor(
WorkItemApprovals.REVIEW_TYPE.getIdentifier(), APPROVAL_NAME);
IApproval approval = approvals.createApproval(descriptor, approver);
approvals.add(approval);
}



Please note the type of the approval is controlled using the REVIEW_TYPE.

0 votes


Permanent link
Thanks very much! I will have a try for that.

0 votes


Permanent link
 I am very new to this.  Where/How does one use this?

0 votes

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
× 10,952

Question asked: Apr 24 '12, 9:54 a.m.

Question was seen: 5,451 times

Last updated: Jul 25 '12, 9:51 a.m.

Confirmation Cancel Confirm