Search in sources :

Example 1 with AllAttributesRemovedForMember

use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForMember in project perun by CESNET.

the class AttributesManagerBlImpl method removeAllAttributes.

@Override
public void removeAllAttributes(PerunSession sess, Member member) throws WrongAttributeValueException, WrongReferenceAttributeValueException {
    List<Attribute> attributes = getAttributes(sess, member);
    if (getAttributesManagerImpl().removeAllAttributes(sess, member)) {
        getPerunBl().getAuditer().log(sess, new AllAttributesRemovedForMember(member));
    }
    log.info("{} removed all attributes from member {}.", sess.getLogId(), member.getId());
    for (Attribute attribute : attributes) attribute.setValue(null);
    try {
        checkAttributesSemantics(sess, member, attributes);
        checkAttributesDependencies(sess, member, attributes);
    } catch (WrongAttributeAssignmentException ex) {
        throw new ConsistencyErrorException(ex);
    }
    for (Attribute attribute : attributes) {
        try {
            getAttributesManagerImpl().changedAttributeHook(sess, member, new Attribute(attribute));
        } catch (WrongReferenceAttributeValueException ex) {
            throw new InternalErrorException(ex);
        }
    }
}
Also used : ConsistencyErrorException(cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException) Attribute(cz.metacentrum.perun.core.api.Attribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) WrongAttributeAssignmentException(cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException) WrongReferenceAttributeValueException(cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException) AllAttributesRemovedForMember(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForMember) InternalErrorException(cz.metacentrum.perun.core.api.exceptions.InternalErrorException)

Aggregations

AllAttributesRemovedForMember (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForMember)1 Attribute (cz.metacentrum.perun.core.api.Attribute)1 RichAttribute (cz.metacentrum.perun.core.api.RichAttribute)1 ConsistencyErrorException (cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException)1 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)1 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)1 WrongReferenceAttributeValueException (cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException)1