| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.config.server.ConfigurationAddListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationDeleteListener; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.SortKey; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.util.Pair; |
| | | import org.opends.messages.CoreMessages; |
| | | import org.forgerock.opendj.config.server.ConfigurationAddListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationDeleteListener; |
| | | import org.forgerock.opendj.server.config.server.BackendIndexCfg; |
| | | import org.forgerock.opendj.server.config.server.BackendVLVIndexCfg; |
| | | import org.forgerock.opendj.server.config.server.PluggableBackendCfg; |
| | | import org.forgerock.util.Pair; |
| | | import org.opends.messages.CoreMessages; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.EntryCache; |
| | | import org.opends.server.api.VirtualAttributeProvider; |
| | |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.crypto.CryptoSuite; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.CanceledOperationException; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.crypto.CryptoSuite; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Modification; |
| | |
| | | // Process in index configuration order. |
| | | for (AttributeIndex index : attrIndexMap.values()) |
| | | { |
| | | // Check whether any modifications apply to this indexed attribute. |
| | | if (isAttributeModified(index, mods)) |
| | | if (isAttributeModified(index.getAttributeType(), mods)) |
| | | { |
| | | index.modifyEntry(buffer, entryID, oldEntry, newEntry); |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * Checks if any modifications apply to this indexed attribute. |
| | | * @param index the indexed attributes. |
| | | * @param mods the modifications to check for. |
| | | * @return true if any apply, false otherwise. |
| | | */ |
| | | private static boolean isAttributeModified(AttributeIndex index, List<Modification> mods) |
| | | { |
| | | AttributeType indexAttributeType = index.getAttributeType(); |
| | | List<AttributeType> subTypes = |
| | | DirectoryServer.getSchema().getSubTypes(indexAttributeType); |
| | | |
| | | for (Modification mod : mods) |
| | | { |
| | | Attribute modAttr = mod.getAttribute(); |
| | | AttributeType modAttrType = modAttr.getAttributeDescription().getAttributeType(); |
| | | if (modAttrType.equals(indexAttributeType) |
| | | || subTypes.contains(modAttrType)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | boolean isConfidentialityEnabled() |
| | | { |
| | | return config.isConfidentialityEnabled(); |
| | |
| | | public String toString() { |
| | | return treePrefix; |
| | | } |
| | | |
| | | static boolean isAttributeModified(AttributeType attrType, List<Modification> mods) |
| | | { |
| | | for (Modification mod : mods) |
| | | { |
| | | if (attrType.isSuperTypeOf(mod.getAttribute().getAttributeDescription().getAttributeType())) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |