Here is more less how you would count number of item requested. This should be put in a step right at the beginning of LM Provisioning:
int count = 0;
for (ProvisioningPlan.AccountRequest accountRequest: plan.getAccountRequests()) {
if (ProvisioningPlan.APP_IIQ.equals(accountRequest.getApplication())) {
for (ProvisioningPlan.AttributeRequest attributeRequest: accountRequest.getAttributeRequests(ATT_ASSIGNED_ROLES)) {
// count ++ attributeRequest.getValue(), this can be list or single value
}
} else {
for (ProvisioningPlan.AttributeRequest attributeRequest: accountRequest.getAttributeRequests()) { // in this case these should only be attributes related to managedAttributes
// count ++ attributeRequest.getValue(), this can be list or single value
}
}
}