*/
@Override()
public Entry getEntryForID(String id)
throws DirectoryException
{
RegularExpressionIdentityMapperCfg config = currentConfig;
AttributeType[] attributeTypes = this.attributeTypes;
// Run the provided identifier string through the regular expression pattern
// matcher and make the appropriate replacement.
Matcher matcher = matchPattern.matcher(id);
String processedID = matcher.replaceAll(replacePattern);
// Construct the search filter to use to make the determination.
SearchFilter filter;
if (attributeTypes.length == 1)
{
AttributeValue value =
AttributeValues.create(attributeTypes[0], processedID);
filter = SearchFilter.createEqualityFilter(attributeTypes[0], value);
}
else
{
ArrayList<SearchFilter> filterComps =
new ArrayList<SearchFilter>(attributeTypes.length);
for (AttributeType t : attributeTypes)
{
AttributeValue value = AttributeValues.create(t, processedID);
filterComps.add(SearchFilter.createEqualityFilter(t, value));
}
filter = SearchFilter.createORFilter(filterComps);
}
// Iterate through the set of search bases and process an internal search
// to find any matching entries. Since we'll only allow a single match,
// then use size and time limits to constrain costly searches resulting from
// non-unique or inefficient criteria.
Collection<DN> baseDNs = config.getMatchBaseDN();
if ((baseDNs == null) || baseDNs.isEmpty())
{
baseDNs = DirectoryServer.getPublicNamingContexts().keySet();
}