Search in sources :

Example 1 with AttributeAlreadyAssignedException

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

the class ServicesManagerBlImpl method addRequiredAttribute.

@Override
public void addRequiredAttribute(PerunSession sess, Service service, AttributeDefinition attribute) throws AttributeAlreadyAssignedException {
    // check if attribute isn't already added
    List<AttributeDefinition> requiredAttributes = getPerunBl().getAttributesManagerBl().getRequiredAttributesDefinition(sess, service);
    if (requiredAttributes.contains(attribute))
        throw new AttributeAlreadyAssignedException(attribute);
    getServicesManagerImpl().addRequiredAttribute(sess, service, attribute);
    getPerunBl().getAuditer().log(sess, new AttributeAddedAsRequiredToService(attribute, service));
}
Also used : AttributeAlreadyAssignedException(cz.metacentrum.perun.core.api.exceptions.AttributeAlreadyAssignedException) AttributeAddedAsRequiredToService(cz.metacentrum.perun.audit.events.ServicesManagerEvents.AttributeAddedAsRequiredToService) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition)

Aggregations

AttributeAddedAsRequiredToService (cz.metacentrum.perun.audit.events.ServicesManagerEvents.AttributeAddedAsRequiredToService)1 AttributeDefinition (cz.metacentrum.perun.core.api.AttributeDefinition)1 AttributeAlreadyAssignedException (cz.metacentrum.perun.core.api.exceptions.AttributeAlreadyAssignedException)1