Search in sources :

Example 1 with ExecutionManagerConfigurationException

use of ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerConfigurationException in project irida by phac-nml.

the class ExecutionManagerConfig method getGalaxyEmail.

/**
 * Gets and validates a GalaxyAccountEmail from the given property.
 * @param emailProperty  The property to find the email address.
 * @return  A valid GalaxyAccountEmail.
 * @throws ExecutionManagerConfigurationException  If the properties value was invalid.
 */
private GalaxyAccountEmail getGalaxyEmail(String emailProperty) throws ExecutionManagerConfigurationException {
    String galaxyEmailString = environment.getProperty(emailProperty);
    GalaxyAccountEmail galaxyEmail = new GalaxyAccountEmail(galaxyEmailString);
    Set<ConstraintViolation<GalaxyAccountEmail>> violations = validator.validate(galaxyEmail);
    if (!violations.isEmpty()) {
        throw new ExecutionManagerConfigurationException("Invalid email address", emailProperty, new ConstraintViolationException(violations));
    }
    return galaxyEmail;
}
Also used : GalaxyAccountEmail(ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyAccountEmail) ExecutionManagerConfigurationException(ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerConfigurationException) ConstraintViolation(javax.validation.ConstraintViolation) ConstraintViolationException(javax.validation.ConstraintViolationException)

Aggregations

ExecutionManagerConfigurationException (ca.corefacility.bioinformatics.irida.exceptions.ExecutionManagerConfigurationException)1 GalaxyAccountEmail (ca.corefacility.bioinformatics.irida.model.upload.galaxy.GalaxyAccountEmail)1 ConstraintViolation (javax.validation.ConstraintViolation)1 ConstraintViolationException (javax.validation.ConstraintViolationException)1