if (isAssociationMapped() && getAssociationMapping().equals(type) && associated) {
hasMembership = true;
}
Role role = null;
try {
role = getIdentitySession().getRoleManager().getRole(type, userName, gid);
} catch (Exception e) {
// TODO:
handleException("Identity operation error: ", e);
}
if (role != null
&& (!isAssociationMapped() || !getAssociationMapping().equals(role.getRoleType()) || !ignoreMappedMembershipType(groupId))) {
hasMembership = true;
}
Membership result = null;