@Override public final Set<IPersonAttributes> getPeopleWithMultivaluedAttributes( Map<String, List<Object>> query) { Validate.notNull(query, "query may not be null."); // Generate the query to pass to the subclass final LocalAccountQuery queryBuilder = this.generateQuery(query); if (queryBuilder == null) { this.logger.debug( "No queryBuilder was generated for query " + query + ", null will be returned"); return null; } // Get the username from the query, if specified final IUsernameAttributeProvider usernameAttributeProvider = this.getUsernameAttributeProvider(); // Execute the query in the subclass final List<ILocalAccountPerson> unmappedPeople = localAccountDao.getPeople(queryBuilder); if (unmappedPeople == null) { return null; } // Map the attributes of the found people according to resultAttributeMapping if it is set final Set<IPersonAttributes> mappedPeople = new LinkedHashSet<IPersonAttributes>(); for (final ILocalAccountPerson unmappedPerson : unmappedPeople) { final IPersonAttributes mappedPerson = this.mapPersonAttributes(unmappedPerson); mappedPeople.add(mappedPerson); } return Collections.unmodifiableSet(mappedPeople); }
this.getUsernameAttributeProvider().getUsernameAttribute(), Collections.<Object>singletonList(person.getName())); this.getResultAttributeMapping().entrySet()) { final String dataKey = resultAttrEntry.getKey(); newPerson = new NamedPersonImpl(name, mappedAttributes); } else { final String userNameAttribute = this.getConfiguredUserNameAttribute(); newPerson = new AttributeNamedPersonImpl(userNameAttribute, mappedAttributes);
/** * @return The appropriate attribute to user for the user name. Since {@link * #getDefaultAttributeName()} should never return null this method should never return null * either. */ protected String getConfiguredUserNameAttribute() { // If configured explicitly use it if (this.unmappedUsernameAttribute != null) { return this.unmappedUsernameAttribute; } final IUsernameAttributeProvider usernameAttributeProvider = this.getUsernameAttributeProvider(); return usernameAttributeProvider.getUsernameAttribute(); } }
protected LocalAccountQuery generateQuery(Map<String, List<Object>> query) { LocalAccountQuery queryBuilder = new LocalAccountQuery(); String userNameAttribute = this.getConfiguredUserNameAttribute(); for (final Map.Entry<String, List<Object>> queryEntry : query.entrySet()) { String attrName = queryEntry.getKey(); if (userNameAttribute.equals(attrName)) { String value = queryEntry.getValue().get(0).toString(); queryBuilder.setUserName(value); } else { List<String> values = new ArrayList<String>(); for (Object o : queryEntry.getValue()) { values.add(o.toString()); } queryBuilder.setAttribute(attrName, values); } } if (this.logger.isDebugEnabled()) { this.logger.debug( "Generated query builder '" + queryBuilder + "' from query Map " + query + "."); } return queryBuilder; }
this.getUsernameAttributeProvider().getUsernameAttribute(), Collections.<Object>singletonList(person.getName())); this.getResultAttributeMapping().entrySet()) { final String dataKey = resultAttrEntry.getKey(); newPerson = new NamedPersonImpl(name, mappedAttributes); } else { final String userNameAttribute = this.getConfiguredUserNameAttribute(); newPerson = new AttributeNamedPersonImpl(userNameAttribute, mappedAttributes);
/** * @return The appropriate attribute to user for the user name. Since {@link * #getDefaultAttributeName()} should never return null this method should never return null * either. */ protected String getConfiguredUserNameAttribute() { // If configured explicitly use it if (this.unmappedUsernameAttribute != null) { return this.unmappedUsernameAttribute; } final IUsernameAttributeProvider usernameAttributeProvider = this.getUsernameAttributeProvider(); return usernameAttributeProvider.getUsernameAttribute(); } }
protected LocalAccountQuery generateQuery(Map<String, List<Object>> query) { LocalAccountQuery queryBuilder = new LocalAccountQuery(); String userNameAttribute = this.getConfiguredUserNameAttribute(); for (final Map.Entry<String, List<Object>> queryEntry : query.entrySet()) { String attrName = queryEntry.getKey(); if (userNameAttribute.equals(attrName)) { String value = queryEntry.getValue().get(0).toString(); queryBuilder.setUserName(value); } else { List<String> values = new ArrayList<String>(); for (Object o : queryEntry.getValue()) { values.add(o.toString()); } queryBuilder.setAttribute(attrName, values); } } if (this.logger.isDebugEnabled()) { this.logger.debug( "Generated query builder '" + queryBuilder + "' from query Map " + query + "."); } return queryBuilder; }
@Override public final Set<IPersonAttributes> getPeopleWithMultivaluedAttributes( Map<String, List<Object>> query) { Validate.notNull(query, "query may not be null."); // Generate the query to pass to the subclass final LocalAccountQuery queryBuilder = this.generateQuery(query); if (queryBuilder == null) { this.logger.debug( "No queryBuilder was generated for query " + query + ", null will be returned"); return null; } // Get the username from the query, if specified final IUsernameAttributeProvider usernameAttributeProvider = this.getUsernameAttributeProvider(); // Execute the query in the subclass final List<ILocalAccountPerson> unmappedPeople = localAccountDao.getPeople(queryBuilder); if (unmappedPeople == null) { return null; } // Map the attributes of the found people according to resultAttributeMapping if it is set final Set<IPersonAttributes> mappedPeople = new LinkedHashSet<IPersonAttributes>(); for (final ILocalAccountPerson unmappedPerson : unmappedPeople) { final IPersonAttributes mappedPerson = this.mapPersonAttributes(unmappedPerson); mappedPeople.add(mappedPerson); } return Collections.unmodifiableSet(mappedPeople); }