Search in sources :

Example 1 with AllAttributesRemovedForResourceAndMember

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

the class AttributesManagerBlImpl method removeAllAttributes.

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

Aggregations

AllAttributesRemovedForResourceAndMember (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForResourceAndMember)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 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)1