Search in sources :

Example 1 with ServicesPackageExistsException

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

the class ServicesManagerBlImpl method createServicesPackage.

public ServicesPackage createServicesPackage(PerunSession sess, ServicesPackage servicesPackage) throws InternalErrorException, ServicesPackageExistsException {
    Utils.notNull(servicesPackage.getDescription(), "servicesPackage.getDescription()");
    Utils.notNull(servicesPackage.getName(), "servicesPackage.getName()");
    //check if servicesPackage with same name exists in perun
    try {
        ServicesPackage s = getServicesManagerImpl().getServicesPackageByName(sess, servicesPackage.getName());
        throw new ServicesPackageExistsException(s);
    } catch (ServicesPackageNotExistsException ex) {
    /* OK */
    }
    getPerunBl().getAuditer().log(sess, "{} created.", servicesPackage);
    return getServicesManagerImpl().createServicesPackage(sess, servicesPackage);
}
Also used : ServicesPackageExistsException(cz.metacentrum.perun.core.api.exceptions.ServicesPackageExistsException) ServicesPackage(cz.metacentrum.perun.core.api.ServicesPackage) ServicesPackageNotExistsException(cz.metacentrum.perun.core.api.exceptions.ServicesPackageNotExistsException)

Aggregations

ServicesPackage (cz.metacentrum.perun.core.api.ServicesPackage)1 ServicesPackageExistsException (cz.metacentrum.perun.core.api.exceptions.ServicesPackageExistsException)1 ServicesPackageNotExistsException (cz.metacentrum.perun.core.api.exceptions.ServicesPackageNotExistsException)1