/** * Handle attribute presence check (eg: <tt>(attr1=*)</tt>) */ private boolean presenceMatch(Attributes attributes, PresenceNode presenceElement) { return attributes.get(presenceElement.getAttribute()) != null; }
public MaxImmSubFilter() { childrenFilter = new PresenceNode( "objectClass" ); childrenSearchControls = new SearchControls(); childrenSearchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE ); }
pnode.setAttribute( registry.getOid( pnode.getAttribute() ) ); log.error( "Failed to normalize filter node attribute: " + pnode.getAttribute(), e ); RuntimeException rte = new RuntimeException( e.getMessage() ); rte.initCause( e );
/** * @see java.lang.Object#toString() * @return A string representing the AndNode */ public String toString() { StringBuilder buf = new StringBuilder(); buf.append( '(' ).append( getAttribute() ).append( "=*" ); buf.append( super.toString() ); buf.append( ')' ); return buf.toString(); } }
public void addNamingListener( Name name, int scope, NamingListener namingListener ) throws NamingException { ExprNode filter = new PresenceNode( "objectClass" ); SearchControls controls = new SearchControls(); controls.setSearchScope( scope ); ( ( PartitionNexusProxy ) this.nexusProxy ).addNamingListener( this, buildTarget( name ), filter, controls, namingListener ); listeners.add( namingListener ); }
/** * Gets the number of entries that would be returned by a presence node * assertion. Leverages the existance system index for scan counts. * * @param node the presence node * @return the number of entries matched for the presence of an attribute * @throws NamingException if errors result */ private BigInteger getPresenceScan( PresenceNode node ) throws NamingException { if ( db.hasUserIndexOn( node.getAttribute() ) ) { Index idx = db.getExistanceIndex(); int count = idx.count( node.getAttribute() ); return BigInteger.valueOf( count ); } return MAX; }
/** * @see javax.naming.Context#listBindings(javax.naming.Name) */ public NamingEnumeration listBindings( Name name ) throws NamingException { // Conduct a special one level search at base for all objects LdapDN base = buildTarget( name ); PresenceNode filter = new PresenceNode( "objectClass" ); SearchControls ctls = new SearchControls(); ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE ); return nexusProxy.search( base, getEnvironment(), filter, ctls ); }
/** * Returns an enumeration over candidates that satisfy a presence attribute * value assertion. * * @param node the presence AVA node * @return an enumeration over the index records matching the AVA * @throws NamingException if there is a failure while accessing the db */ private NamingEnumeration enumPresence( final PresenceNode node ) throws NamingException { if ( db.hasUserIndexOn( node.getAttribute() ) ) { Index idx = db.getExistanceIndex(); return idx.listIndices( node.getAttribute() ); } return nonIndexedScan( node ); }
@Override public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception { EntryFilteringCursor cursor = nextInterceptor.search( new SearchOperationContext( opContext.getSession(), opContext.getDn(), opContext.getAliasDerefMode(), new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ), new SearchControls() ) ); cursor.addEntryFilter( Constants.DELETED_ENTRIES_FILTER ); return cursor; }
private static FilterExpression buildExpression(ExprNode node) { if (node instanceof AndNode) { return new AndExpression(buildExpressions(((AndNode)node).getChildren())); } else if (node instanceof OrNode) { return new OrExpression(buildExpressions(((OrNode)node).getChildren())); } else if (node instanceof NotNode) { return new NotExpression(buildExpression(((NotNode)node).getFirstChild())); } else if (node instanceof EqualityNode) { EqualityNode equalityNode = (EqualityNode)node; return new EqualityExpression(equalityNode.getAttribute(), equalityNode.getValue().toString()); } else if (node instanceof PresenceNode) { return new PresenceExpression(((PresenceNode)node).getAttribute()); } else { throw new UnsupportedOperationException("Node type " + node.getClass().getSimpleName() + " not supported"); } }
/** * Checks to see if an entry being renamed has a descendant that is an * administrative point. * * @param name the name of the entry which is used as the search base * @return true if name is an administrative point or one of its descendants * are, false otherwise * @throws NamingException if there are errors while searching the directory */ private boolean hasAdministrativeDescendant( LdapDN name ) throws NamingException { ExprNode filter = new PresenceNode( "administrativeRole" ); SearchControls controls = new SearchControls(); controls.setSearchScope( SearchControls.SUBTREE_SCOPE ); NamingEnumeration aps = nexus.search( name, factoryCfg.getEnvironment(), filter, controls ); if ( aps.hasMore() ) { aps.close(); return true; } return false; }
private static FilterExpression buildExpression(ExprNode node) { if (node instanceof AndNode) { return new AndExpression(buildExpressions(((AndNode)node).getChildren())); } else if (node instanceof OrNode) { return new OrExpression(buildExpressions(((OrNode)node).getChildren())); } else if (node instanceof NotNode) { return new NotExpression(buildExpression(((NotNode)node).getFirstChild())); } else if (node instanceof EqualityNode) { EqualityNode equalityNode = (EqualityNode)node; return new EqualityExpression(equalityNode.getAttribute(), equalityNode.getValue().toString()); } else if (node instanceof PresenceNode) { return new PresenceExpression(((PresenceNode)node).getAttribute()); } else { throw new UnsupportedOperationException("Node type " + node.getClass().getSimpleName() + " not supported"); } }
PresenceNode filter = new PresenceNode( "objectClass" ); return getNexusProxy().search( target, getEnvironment(), filter, ctls ); filter.addNode( new PresenceNode( attr.getID() ) ); continue;
private static FilterExpression buildExpression(ExprNode node) { if (node instanceof AndNode) { return new AndExpression(buildExpressions(((AndNode)node).getChildren())); } else if (node instanceof OrNode) { return new OrExpression(buildExpressions(((OrNode)node).getChildren())); } else if (node instanceof NotNode) { return new NotExpression(buildExpression(((NotNode)node).getFirstChild())); } else if (node instanceof EqualityNode) { EqualityNode equalityNode = (EqualityNode)node; return new EqualityExpression(equalityNode.getAttribute(), equalityNode.getValue().toString()); } else if (node instanceof PresenceNode) { return new PresenceExpression(((PresenceNode)node).getAttribute()); } else { throw new UnsupportedOperationException("Node type " + node.getClass().getSimpleName() + " not supported"); } }
baseDn.addAll( ss.getBase() ); ExprNode filter = new PresenceNode( oidRegistry.getOid( "objectclass" ) ); SearchControls controls = new SearchControls(); controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
/** * @see Evaluator#evaluate(ExprNode, String, Attributes) */ public boolean evaluate( ExprNode node, String dn, Attributes entry ) throws NamingException { if ( node instanceof ScopeNode ) { return scopeEvaluator.evaluate( node, dn, entry ); } switch ( ( ( LeafNode ) node ).getAssertionType() ) { case ( LeafNode.APPROXIMATE ): return evalEquality( ( SimpleNode ) node, entry ); case ( LeafNode.EQUALITY ): return evalEquality( ( SimpleNode ) node, entry ); case ( LeafNode.EXTENSIBLE ): throw new NotImplementedException(); case ( LeafNode.GREATEREQ ): return evalGreater( ( SimpleNode ) node, entry, true ); case ( LeafNode.LESSEQ ): return evalGreater( ( SimpleNode ) node, entry, false ); case ( LeafNode.PRESENCE ): String attrId = ( ( PresenceNode ) node ).getAttribute(); return evalPresence( attrId, entry ); case ( LeafNode.SUBSTRING ): return substringEvaluator.evaluate( node, dn, entry ); default: throw new NamingException( "Unrecognized leaf node type: " + ( ( LeafNode ) node ).getAssertionType() ); } }
break; case( LeafNode.PRESENCE ): newLeaf = new PresenceNode( descendant.getOid() ); break; case( LeafNode.SUBSTRING ):
/** * @see org.apache.directory.server.core.partition.impl.btree.Evaluator#evaluate(ExprNode, IndexRecord) */ public boolean evaluate( ExprNode node, IndexRecord record ) throws NamingException { if ( node instanceof ScopeNode ) { return scopeEvaluator.evaluate( node, record ); } switch ( ( ( LeafNode ) node ).getAssertionType() ) { case ( LeafNode.APPROXIMATE ): return evalEquality( ( SimpleNode ) node, record ); case ( LeafNode.EQUALITY ): return evalEquality( ( SimpleNode ) node, record ); case ( LeafNode.EXTENSIBLE ): throw new NotImplementedException(); case ( LeafNode.GREATEREQ ): return evalGreater( ( SimpleNode ) node, record, true ); case ( LeafNode.LESSEQ ): return evalGreater( ( SimpleNode ) node, record, false ); case ( LeafNode.PRESENCE ): String attrId = ( ( PresenceNode ) node ).getAttribute(); return evalPresence( attrId, record ); case ( LeafNode.SUBSTRING ): return substringEvaluator.evaluate( node, record ); default: throw new NamingException( "Unrecognized leaf node type: " + ( ( LeafNode ) node ).getAssertionType() ); } }
break; case( LeafNode.PRESENCE ): newLeaf = new PresenceNode( descendant.getOid() ); break; case( LeafNode.SUBSTRING ):
boolean isSearchAll = ( ( PresenceNode ) filter ).getAttribute().equalsIgnoreCase( "2.5.4.0" );