use of cz.metacentrum.perun.core.api.exceptions.DestinationAlreadyAssignedException in project perun by CESNET.
the class ServicesManagerBlImpl method addDestination.
public Destination addDestination(PerunSession sess, Service service, Facility facility, Destination destination) throws InternalErrorException, DestinationAlreadyAssignedException {
if (!getServicesManagerImpl().destinationExists(sess, destination)) {
try {
//Try to get the destination without id
destination = getServicesManagerImpl().getDestination(sess, destination.getDestination(), destination.getType());
} catch (DestinationNotExistsException ex) {
try {
destination = createDestination(sess, destination);
} catch (DestinationExistsException e) {
throw new ConsistencyErrorException(e);
}
}
}
if (getServicesManagerImpl().destinationExists(sess, service, facility, destination))
throw new DestinationAlreadyAssignedException(destination);
getServicesManagerImpl().addDestination(sess, service, facility, destination);
getPerunBl().getAuditer().log(sess, "{} added to {} and {}.", destination, service, facility);
return destination;
}
Aggregations