Search in sources :

Example 6 with InvalidQueryException

use of io.hops.hopsworks.exceptions.InvalidQueryException in project hopsworks by logicalclocks.

the class UserFacade method getGroups.

private List<BbcGroup> getGroups(String field, String values) {
    String[] groups = values.split(",");
    BbcGroup role;
    List<BbcGroup> roles = new ArrayList<>();
    for (String group : groups) {
        role = groupFacade.findByGroupName(group.trim());
        if (role != null) {
            roles.add(role);
        }
    }
    if (roles.isEmpty()) {
        throw new InvalidQueryException("Filter value for " + field + " needs to set valid roles, but found: " + values);
    }
    return roles;
}
Also used : BbcGroup(io.hops.hopsworks.persistence.entity.user.BbcGroup) ArrayList(java.util.ArrayList) InvalidQueryException(io.hops.hopsworks.exceptions.InvalidQueryException)

Aggregations

InvalidQueryException (io.hops.hopsworks.exceptions.InvalidQueryException)6 HashSet (java.util.HashSet)2 JobType (io.hops.hopsworks.persistence.entity.jobs.configuration.JobType)1 JobState (io.hops.hopsworks.persistence.entity.jobs.configuration.history.JobState)1 BbcGroup (io.hops.hopsworks.persistence.entity.user.BbcGroup)1 UserAccountStatus (io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus)1 UserAccountType (io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountType)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1