use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AllAttributesRemovedForResource in project perun by CESNET.
the class AttributesManagerBlImpl method removeAllAttributes.
@Override
public void removeAllAttributes(PerunSession sess, Resource resource) throws WrongAttributeValueException, WrongReferenceAttributeValueException {
List<Attribute> attributes = getAttributes(sess, resource);
if (getAttributesManagerImpl().removeAllAttributes(sess, resource)) {
getPerunBl().getAuditer().log(sess, new AllAttributesRemovedForResource(resource));
}
log.info("{} removed all attributes from resource {}.", sess.getLogId(), resource.getId());
for (Attribute attribute : attributes) attribute.setValue(null);
try {
checkAttributesSemantics(sess, resource, attributes);
checkAttributesDependencies(sess, resource, attributes);
} catch (WrongAttributeAssignmentException ex) {
throw new ConsistencyErrorException(ex);
}
for (Attribute attribute : attributes) {
try {
getAttributesManagerImpl().changedAttributeHook(sess, resource, new Attribute(attribute));
} catch (WrongReferenceAttributeValueException ex) {
throw new InternalErrorException(ex);
}
}
}
Aggregations