| | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * |
| | | */ |
| | | public final class CompositeAttributeMapper implements AttributeMapper { |
| | | private final Set<String> allLDAPAttributes = new LinkedHashSet<String>(); |
| | | private final List<AttributeMapper> attributeMappers = new LinkedList<AttributeMapper>(); |
| | | |
| | | /** |
| | |
| | | |
| | | public CompositeAttributeMapper addMapper(AttributeMapper mapper) { |
| | | attributeMappers.add(mapper); |
| | | mapper.getLDAPAttributes(allLDAPAttributes); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void getLDAPAttributes(Set<String> ldapAttributes) { |
| | | ldapAttributes.addAll(allLDAPAttributes); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void getLDAPAttributes(Set<String> ldapAttributes, JsonPointer resourceAttribute) { |
| | | public void getLDAPAttributes(JsonPointer jsonAttribute, Set<String> ldapAttributes) { |
| | | for (AttributeMapper attribute : attributeMappers) { |
| | | attribute.getLDAPAttributes(ldapAttributes, resourceAttribute); |
| | | attribute.getLDAPAttributes(jsonAttribute, ldapAttributes); |
| | | } |
| | | } |
| | | |