Search in sources :

Example 1 with SponsoredMemberUnset

use of cz.metacentrum.perun.audit.events.MembersManagerEvents.SponsoredMemberUnset in project perun by CESNET.

the class MembersManagerBlImpl method unsetSponsorshipForMember.

@Override
public Member unsetSponsorshipForMember(PerunSession session, Member sponsoredMember) throws MemberNotSponsoredException {
    if (!sponsoredMember.isSponsored()) {
        throw new MemberNotSponsoredException(sponsoredMember + " is not sponsored member!");
    }
    // set member to be sponsored
    List<User> sponsors = getPerunBl().getUsersManagerBl().getSponsors(session, sponsoredMember);
    sponsoredMember = getMembersManagerImpl().unsetSponsorshipForMember(session, sponsoredMember);
    getPerunBl().getAuditer().log(session, new SponsoredMemberUnset(sponsoredMember));
    for (User sponsor : sponsors) {
        getPerunBl().getAuditer().log(session, new SponsorshipRemoved(sponsoredMember, sponsor));
    }
    return sponsoredMember;
}
Also used : User(cz.metacentrum.perun.core.api.User) RichUser(cz.metacentrum.perun.core.api.RichUser) SponsoredMemberUnset(cz.metacentrum.perun.audit.events.MembersManagerEvents.SponsoredMemberUnset) MemberNotSponsoredException(cz.metacentrum.perun.core.api.exceptions.MemberNotSponsoredException) SponsorshipRemoved(cz.metacentrum.perun.audit.events.MembersManagerEvents.SponsorshipRemoved)

Aggregations

SponsoredMemberUnset (cz.metacentrum.perun.audit.events.MembersManagerEvents.SponsoredMemberUnset)1 SponsorshipRemoved (cz.metacentrum.perun.audit.events.MembersManagerEvents.SponsorshipRemoved)1 RichUser (cz.metacentrum.perun.core.api.RichUser)1 User (cz.metacentrum.perun.core.api.User)1 MemberNotSponsoredException (cz.metacentrum.perun.core.api.exceptions.MemberNotSponsoredException)1