Search in sources :

Example 1 with DestinationRemovedFromService

use of cz.metacentrum.perun.audit.events.ServicesManagerEvents.DestinationRemovedFromService in project perun by CESNET.

the class ServicesManagerBlImpl method removeDestination.

@Override
public void removeDestination(PerunSession sess, Service service, Facility facility, Destination destination) throws DestinationAlreadyRemovedException {
    if (!getServicesManagerImpl().destinationExists(sess, destination)) {
        try {
            // Try to get the destination without id
            destination = getServicesManagerImpl().getDestination(sess, destination.getDestination(), destination.getType());
        } catch (DestinationNotExistsException ex) {
            throw new DestinationAlreadyRemovedException(destination);
        }
    }
    getServicesManagerImpl().removeDestination(sess, service, facility, destination);
    // remove destination from destination table if it is not used anymore
    try {
        this.deleteDestination(sess, destination);
    } catch (RelationExistsException ex) {
    // destination is used by some services and facilities, dont delete it
    }
    getPerunBl().getAuditer().log(sess, new DestinationRemovedFromService(destination, service, facility));
}
Also used : RelationExistsException(cz.metacentrum.perun.core.api.exceptions.RelationExistsException) DestinationNotExistsException(cz.metacentrum.perun.core.api.exceptions.DestinationNotExistsException) DestinationAlreadyRemovedException(cz.metacentrum.perun.core.api.exceptions.DestinationAlreadyRemovedException) DestinationRemovedFromService(cz.metacentrum.perun.audit.events.ServicesManagerEvents.DestinationRemovedFromService)

Aggregations

DestinationRemovedFromService (cz.metacentrum.perun.audit.events.ServicesManagerEvents.DestinationRemovedFromService)1 DestinationAlreadyRemovedException (cz.metacentrum.perun.core.api.exceptions.DestinationAlreadyRemovedException)1 DestinationNotExistsException (cz.metacentrum.perun.core.api.exceptions.DestinationNotExistsException)1 RelationExistsException (cz.metacentrum.perun.core.api.exceptions.RelationExistsException)1