How to check if an approval Object already exists in a workitem before saving it (using java api)?
I have created an approval Object.I need check if the workitem already has the approval Object and not save it.
Therefore , when i create an approval Object and without saving it if i get the descriptor name as :
|
One answer
Hi, You need to write operation advisor, below is my working code to check review type approval: IApprovals approvals = workItem.getApprovals(); final String reviewType="com.ibm.team.workitem.approvalType.review"; final List<IApproval> approvalList = approvals.getContents(); for(IApproval approval :approvalList){
IApprovalDescriptor appDesc = approval.getDescriptor();
String approvalTypeNew = appDesc.getTypeIdentifier();
if(approvalTypeNew.equalsIgnoreCase(reviewType)){ return; }else{ IAdvisorInfo info = collector
.createProblemInfo(
"Required Approval of type 'Review' is not present",
"Please add Approval of type 'Review'",
"error");
collector.addInfo(info); }
} You may check all the information of approval i.e. Approval title, state of approval. Please refer below link on jazz.net: https://jazz.net/library/article/1118
|
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.