Search in sources :

Example 1 with DestinationAlreadyRemovedException

use of cz.metacentrum.perun.core.api.exceptions.DestinationAlreadyRemovedException in project perun by CESNET.

the class ServicesManagerBlImpl method removeAllDestinations.

@Override
public void removeAllDestinations(PerunSession sess, Service service, Facility facility) {
    List<Destination> destinations = getDestinations(sess, service, facility);
    getServicesManagerImpl().removeAllDestinations(sess, service, facility);
    // remove destinations from destination table if they are not used anymore
    for (Destination destination : destinations) {
        try {
            this.deleteDestination(sess, destination);
        } catch (RelationExistsException | DestinationAlreadyRemovedException ex) {
        // destination is used by some services and facilities or it is already removed, skip the destination
        }
    }
    getPerunBl().getAuditer().log(sess, new DestinationsRemovedFromService(service, facility));
}
Also used : FreeDenialServiceOnDestination(cz.metacentrum.perun.audit.events.GeneralServiceManagerEvents.FreeDenialServiceOnDestination) BanServiceOnDestination(cz.metacentrum.perun.audit.events.GeneralServiceManagerEvents.BanServiceOnDestination) RichDestination(cz.metacentrum.perun.core.api.RichDestination) Destination(cz.metacentrum.perun.core.api.Destination) FreeAllDenialsOnDestination(cz.metacentrum.perun.audit.events.GeneralServiceManagerEvents.FreeAllDenialsOnDestination) RelationExistsException(cz.metacentrum.perun.core.api.exceptions.RelationExistsException) DestinationAlreadyRemovedException(cz.metacentrum.perun.core.api.exceptions.DestinationAlreadyRemovedException) DestinationsRemovedFromService(cz.metacentrum.perun.audit.events.ServicesManagerEvents.DestinationsRemovedFromService)

Example 2 with DestinationAlreadyRemovedException

use of cz.metacentrum.perun.core.api.exceptions.DestinationAlreadyRemovedException in project perun by CESNET.

the class ServicesManagerBlImpl method removeAllDestinations.

@Override
public void removeAllDestinations(PerunSession perunSession, Facility facility) {
    List<Destination> destinations = getDestinations(perunSession, facility);
    getServicesManagerImpl().removeAllDestinations(perunSession, facility);
    // remove destinations from destination table if they are not used anymore
    for (Destination destination : destinations) {
        try {
            this.deleteDestination(perunSession, destination);
        } catch (RelationExistsException | DestinationAlreadyRemovedException ex) {
        // destination is used by some services and facilities or it is already removed, skip the destination
        }
    }
    getPerunBl().getAuditer().log(perunSession, new DestinationsRemovedFromAllServices(facility));
}
Also used : FreeDenialServiceOnDestination(cz.metacentrum.perun.audit.events.GeneralServiceManagerEvents.FreeDenialServiceOnDestination) BanServiceOnDestination(cz.metacentrum.perun.audit.events.GeneralServiceManagerEvents.BanServiceOnDestination) RichDestination(cz.metacentrum.perun.core.api.RichDestination) Destination(cz.metacentrum.perun.core.api.Destination) FreeAllDenialsOnDestination(cz.metacentrum.perun.audit.events.GeneralServiceManagerEvents.FreeAllDenialsOnDestination) DestinationsRemovedFromAllServices(cz.metacentrum.perun.audit.events.ServicesManagerEvents.DestinationsRemovedFromAllServices) RelationExistsException(cz.metacentrum.perun.core.api.exceptions.RelationExistsException) DestinationAlreadyRemovedException(cz.metacentrum.perun.core.api.exceptions.DestinationAlreadyRemovedException)

Example 3 with DestinationAlreadyRemovedException

use of cz.metacentrum.perun.core.api.exceptions.DestinationAlreadyRemovedException 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

DestinationAlreadyRemovedException (cz.metacentrum.perun.core.api.exceptions.DestinationAlreadyRemovedException)3 RelationExistsException (cz.metacentrum.perun.core.api.exceptions.RelationExistsException)3 BanServiceOnDestination (cz.metacentrum.perun.audit.events.GeneralServiceManagerEvents.BanServiceOnDestination)2 FreeAllDenialsOnDestination (cz.metacentrum.perun.audit.events.GeneralServiceManagerEvents.FreeAllDenialsOnDestination)2 FreeDenialServiceOnDestination (cz.metacentrum.perun.audit.events.GeneralServiceManagerEvents.FreeDenialServiceOnDestination)2 Destination (cz.metacentrum.perun.core.api.Destination)2 RichDestination (cz.metacentrum.perun.core.api.RichDestination)2 DestinationRemovedFromService (cz.metacentrum.perun.audit.events.ServicesManagerEvents.DestinationRemovedFromService)1 DestinationsRemovedFromAllServices (cz.metacentrum.perun.audit.events.ServicesManagerEvents.DestinationsRemovedFromAllServices)1 DestinationsRemovedFromService (cz.metacentrum.perun.audit.events.ServicesManagerEvents.DestinationsRemovedFromService)1 DestinationNotExistsException (cz.metacentrum.perun.core.api.exceptions.DestinationNotExistsException)1