// fetch identities
@Override
    public CustomProfile extractUserProfile(User user) throws InvalidDefinitionException {
        // fetch custom attributes
        List<UserAttributes> userAttributes = user.getAttributes().stream()
                .filter(ua -> !ua.getIdentifier().startsWith("aac."))
                .collect(Collectors.toList());
        // fetch identities
        Collection<UserIdentity> identities = user.getIdentities();
        if (identities.isEmpty()) {
            return extract(userAttributes);
        }
        // TODO decide how to merge identities into a single profile
        // for now get first identity, should be last logged in
        UserIdentity id = identities.iterator().next();
        CustomProfile profile = extract(mergeAttributes(userAttributes, id.getAttributes()));
        return profile;
    }
.filter(ua -> !ua.getIdentifier().startsWith("aac."))
.collect(Collectors.toList());
// fetch identities
Collection<UserIdentity> identities = user.getIdentities();
if (identities.isEmpty()) {
@Override
public CustomProfile extractUserProfile(User user) throws InvalidDefinitionException {
// fetch custom attributes
List<UserAttributes> userAttributes = user.getAttributes().stream()
.filter(ua -> !ua.getIdentifier().startsWith("aac."))
.collect(Collectors.toList());
// fetch identities
Collection<UserIdentity> identities = user.getIdentities();
if (identities.isEmpty()) {
return extract(userAttributes);
}
// TODO decide how to merge identities into a single profile
// for now get first identity, should be last logged in
UserIdentity id = identities.iterator().next();
CustomProfile profile = extract(mergeAttributes(userAttributes, id.getAttributes()));
return profile;
}
@Override
public CustomProfile extractUserProfile(User user) throws InvalidDefinitionException {
// fetch custom attributes
List<UserAttributes> userAttributes = user.getAttributes().stream()
.filter(ua -> !ua.getIdentifier().startsWith("aac."))
.collect(Collectors.toList());
// fetch identities
Collection<UserIdentity> identities = user.getIdentities();
if (identities.isEmpty()) {
return extract(userAttributes);
}
// TODO decide how to merge identities into a single profile
// for now get first identity, should be last logged in
UserIdentity id = identities.iterator().next();
CustomProfile profile = extract(mergeAttributes(userAttributes, id.getAttributes()));
return profile;
}