Search in sources :

Example 1 with ResourceCreated

use of cz.metacentrum.perun.audit.events.ResourceManagerEvents.ResourceCreated in project perun by CESNET.

the class urn_perun_facility_attribute_def_virt_voShortNames method resolveVirtualAttributeValueChange.

@Override
public List<AuditEvent> resolveVirtualAttributeValueChange(PerunSessionImpl sess, AuditEvent message) throws AttributeNotExistsException, WrongAttributeAssignmentException {
    List<AuditEvent> resolvingMessages = new ArrayList<>();
    if (message == null)
        return resolvingMessages;
    if (message instanceof ResourceCreated) {
        try {
            Facility facility = sess.getPerunBl().getFacilitiesManagerBl().getFacilityById(sess, ((ResourceCreated) message).getResource().getFacilityId());
            resolvingMessages.addAll(resolveEvent(sess, facility));
        } catch (FacilityNotExistsException e) {
            throw new ConsistencyErrorException("Facility for created Resource doesn't exists when resolving messages.", e);
        }
    } else if (message instanceof ResourceDeleted) {
        resolvingMessages.addAll(resolveEvent(sess, ((ResourceDeleted) message).getFacility()));
    }
    return resolvingMessages;
}
Also used : ConsistencyErrorException(cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException) ResourceCreated(cz.metacentrum.perun.audit.events.ResourceManagerEvents.ResourceCreated) ArrayList(java.util.ArrayList) AuditEvent(cz.metacentrum.perun.audit.events.AuditEvent) FacilityNotExistsException(cz.metacentrum.perun.core.api.exceptions.FacilityNotExistsException) AttributeChangedForFacility(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeChangedForFacility) AttributeSetForFacility(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForFacility) AttributeRemovedForFacility(cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForFacility) Facility(cz.metacentrum.perun.core.api.Facility) ResourceDeleted(cz.metacentrum.perun.audit.events.ResourceManagerEvents.ResourceDeleted)

Aggregations

AttributeChangedForFacility (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeChangedForFacility)1 AttributeRemovedForFacility (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeRemovedForFacility)1 AttributeSetForFacility (cz.metacentrum.perun.audit.events.AttributesManagerEvents.AttributeSetForFacility)1 AuditEvent (cz.metacentrum.perun.audit.events.AuditEvent)1 ResourceCreated (cz.metacentrum.perun.audit.events.ResourceManagerEvents.ResourceCreated)1 ResourceDeleted (cz.metacentrum.perun.audit.events.ResourceManagerEvents.ResourceDeleted)1 Facility (cz.metacentrum.perun.core.api.Facility)1 ConsistencyErrorException (cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException)1 FacilityNotExistsException (cz.metacentrum.perun.core.api.exceptions.FacilityNotExistsException)1 ArrayList (java.util.ArrayList)1