use of cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForResource in project perun by CESNET.
the class AttributesManagerBlImpl method removeAttributeWithoutCheck.
@Override
public boolean removeAttributeWithoutCheck(PerunSession sess, Resource resource, AttributeDefinition attribute) throws WrongAttributeAssignmentException {
getAttributesManagerImpl().checkNamespace(sess, attribute, NS_RESOURCE_ATTR);
if (getAttributesManagerImpl().isCoreAttribute(sess, attribute))
throw new WrongAttributeAssignmentException(attribute);
boolean changed;
try {
if (this.isVirtAttribute(sess, attribute)) {
changed = getAttributesManagerImpl().removeVirtualAttribute(sess, resource, attribute);
} else {
changed = getAttributesManagerImpl().removeAttribute(sess, resource, attribute);
}
if (changed)
getAttributesManagerImpl().changedAttributeHook(sess, resource, new Attribute(attribute));
} catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) {
throw new InternalErrorException(ex);
}
if (changed)
log.info("{} removed attribute {} from resource {}.", sess.getLogId(), attribute.getName(), resource.getId());
getPerunBl().getAuditer().log(sess, new AttributeRemovedForResource(new AttributeDefinition(attribute), resource));
return changed;
}
Aggregations