Search in sources :

Example 1 with AllAttributesRemovedForHost

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

the class AttributesManagerBlImpl method removeAllAttributes.

@Override
public void removeAllAttributes(PerunSession sess, Host host) throws WrongAttributeValueException {
    List<Attribute> attributes = getAttributes(sess, host);
    if (getAttributesManagerImpl().removeAllAttributes(sess, host)) {
        getPerunBl().getAuditer().log(sess, new AllAttributesRemovedForHost(host));
    }
    log.info("{} removed all attributes from host {}.", sess.getLogId(), host.getId());
    for (Attribute attribute : attributes) attribute.setValue(null);
    try {
        checkAttributesSemantics(sess, host, attributes);
        checkAttributesDependencies(sess, host, attributes);
    } catch (WrongAttributeAssignmentException ex) {
        throw new ConsistencyErrorException(ex);
    } catch (WrongReferenceAttributeValueException ex) {
        throw new WrongAttributeValueException(ex);
    }
    for (Attribute attribute : attributes) {
        getAttributesManagerImpl().changedAttributeHook(sess, host, 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) WrongAttributeAssignmentException(cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException) WrongReferenceAttributeValueException(cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException) AllAttributesRemovedForHost(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForHost) WrongAttributeValueException(cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException)

Aggregations

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