use of cz.metacentrum.perun.audit.events.MembersManagerEvents.MemberExpired in project perun by CESNET.
the class urn_perun_member_attribute_def_def_suspensionInfo method resolveVirtualAttributeValueChange.
@Override
public List<AuditEvent> resolveVirtualAttributeValueChange(PerunSessionImpl session, AuditEvent message) throws WrongReferenceAttributeValueException, WrongAttributeAssignmentException {
Member member = null;
if (message instanceof MemberValidated) {
member = ((MemberValidated) message).getMember();
} else if (message instanceof MemberDisabled) {
member = ((MemberDisabled) message).getMember();
} else if (message instanceof MemberExpired) {
member = ((MemberExpired) message).getMember();
}
clearSuspensionInfo(session, member);
return new ArrayList<>();
}
use of cz.metacentrum.perun.audit.events.MembersManagerEvents.MemberExpired in project perun by CESNET.
the class MembersManagerBlImpl method expireMember.
@Override
public Member expireMember(PerunSession sess, Member member) throws WrongReferenceAttributeValueException, WrongAttributeValueException {
// this method run in nested transaction
if (this.haveStatus(sess, member, Status.EXPIRED)) {
log.debug("Trying to set member expired but he's already expired. " + member);
return member;
}
Status oldStatus = member.getStatus();
getMembersManagerImpl().setStatus(sess, member, Status.EXPIRED);
member.setStatus(Status.EXPIRED);
getPerunBl().getAuditer().log(sess, new MemberExpired(member));
// We need to check validity of attributes first (expired member has to have valid attributes)
if (oldStatus.equals(Status.INVALID) || oldStatus.equals(Status.DISABLED)) {
try {
getPerunBl().getAttributesManagerBl().doTheMagic(sess, member);
} catch (Exception ex) {
// return old status to object to prevent incorrect result in higher methods
member.setStatus(oldStatus);
throw ex;
}
}
return member;
}
Aggregations