| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.std.server.EntryUUIDVirtualAttributeCfg; |
| | | import org.opends.server.api.MatchingRule; |
| | | import org.opends.server.api.VirtualAttributeProvider; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.AttributeValue; |
| | | import org.opends.server.types.AttributeValues; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.VirtualAttributeRule; |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule, |
| | | AttributeValue value) |
| | | { |
| | | MatchingRule matchingRule = |
| | | rule.getAttributeType().getEqualityMatchingRule(); |
| | | try |
| | | { |
| | | String normalizedDN = entry.getName().toNormalizedString(); |
| | | String uuidString = |
| | | UUID.nameUUIDFromBytes(getBytes(normalizedDN)).toString(); |
| | | |
| | | String normalizedValue = value.getNormalizedValue().toString(); |
| | | return uuidString.equals(normalizedValue); |
| | | ByteString normValue = matchingRule.normalizeAttributeValue(value.getValue()); |
| | | return uuidString.equals(normValue.toString()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | return false; |
| | | } |
| | | } |