// loop over the principals
for (Principal principal : principals) {
// if the principal is a org.jbpm.identity.Entity
if (Entity.class.isAssignableFrom(principal.getClass())) {
// add all the identity's permissions to the set of permissions.
Entity entity = (Entity) principal;
for (Permission permission : entity.getPermissions()) {
permissionCollection.add(permission);
}
}
}
}