Another function that i use in Extending Rational Team Concert :
private void addApprover(ISaveParameter saveParameter, String superior1, String superior2, String approvalType, String approverListName)
throws TeamRepositoryException
{
IWorkItem newState = (IWorkItem)saveParameter.getNewState();
IContributorHandle owner = newState.getOwner();
if (owner != null)
{
IContributorHandle superiorHandle = getSuperiorHandle(superior1);
if (superiorHandle == null) {
System.out.println("----internal user not found----");
}
IApprovals approvals = newState.getApprovals();
IApprovalDescriptor descriptor = approvals.createDescriptor(approvalType, approverListName);
IApproval approval = approvals.createApproval(descriptor, superiorHandle);
approvals.add(approval);
}
}
private IContributorHandle getSuperiorHandle(String superiorID)
throws TeamRepositoryException
{
IContributorService contributorService = (IContributorService)getService(IContributorService.class);
return contributorService.fetchContributorByUserId(superiorID);
}
and this one is to add the subscriber
IContributorHandle ownerToSubscribe = blockingWorkItem.getOwner();
if (ownerToSubscribe != null) {
ISubscriptions subscriptions = thisWorkItem.getSubscriptions();
subscriptions.add(ownerToSubscribe);
}






0 comments:
Post a Comment