/** * Retrieve an implementation of {@code IPersonAttributesGroupDefinition} with the given {@code * name} from the JPA DAO. There are two assumptions. First, that the DAO handles caching, so * caching is not implemented here. Second, that group names are unique. A warning will be logged * if more than one group is found with the same name. * * @param name group name used to search for group definition * @return {@code IPersonAttributesGroupDefinition} of named group or null * @see IPersonAttributesGroupDefinitionDao#getPersonAttributesGroupDefinitionByName(String) * @see IPersonAttributesGroupDefinition */ private IPersonAttributesGroupDefinition getPagsGroupDefByName(String name) { Set<IPersonAttributesGroupDefinition> pagsGroups = personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitionByName(name); if (pagsGroups.size() > 1) { logger.error("More than one PAGS group with name {} found.", name); } final IPersonAttributesGroupDefinition rslt = pagsGroups.isEmpty() ? null : pagsGroups.iterator().next(); return rslt; }
@Override public IEntityGroup find(String name) throws GroupsException { Set<IPersonAttributesGroupDefinition> groups = personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitionByName(name); if (groups.size() == 0) { logger.error( "No PAGS group with name {} found. Check your PAGS group definitions for possible error" + " in member group name", name); return null; } IPersonAttributesGroupDefinition pagsGroup = groups.iterator().next(); return convertPagsGroupToEntity(pagsGroup); }