org.apache.directory.api.ldap.model.filter.BranchNode Java Examples
The following examples show how to use
org.apache.directory.api.ldap.model.filter.BranchNode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchRequestFactory.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Encode a BranchNode. * <br> * BranchFilter : * <pre> * 0xA1/0xA2/0xA3 LL * filter.encode() ... filter.encode() * </pre> * * @param buffer The buffer where to put the PDU * @param node The Branch filter to encode * @param tag the ASN.1 type */ private void encodeFilter( Asn1Buffer buffer, BranchNode node, byte tag ) { int start = buffer.getPos(); // encode each filter List<ExprNode> children = node.getChildren(); if ( ( children != null ) && ( !children.isEmpty() ) ) { encodeFilters( buffer, children.iterator() ); } // The BranchNode sequence BerValue.encodeSequence( buffer, tag, start ); }
Example #2
Source File: NormalizationInterceptor.java From syncope with Apache License 2.0 | 6 votes |
/** * Remove the (ObjectClass=*) node from an OrNode, if we have one. */ private ExprNode handleOrNode( ExprNode node ) { OrNode newOrNode = new OrNode(); for ( ExprNode child : ( ( BranchNode ) node ).getChildren() ) { ExprNode modifiedNode = removeObjectClass( child ); if ( modifiedNode instanceof ObjectClassNode ) { // We can return immediately with an ObjectClass node return ObjectClassNode.OBJECT_CLASS_NODE; } newOrNode.addNode( modifiedNode ); } return newOrNode; }
Example #3
Source File: NormalizationInterceptor.java From syncope with Apache License 2.0 | 5 votes |
/** * Remove the (ObjectClass=*) node from an AndNode, if we have one. */ private ExprNode handleAndNode( ExprNode node ) { int nbNodes = 0; AndNode newAndNode = new AndNode(); for ( ExprNode child : ( ( BranchNode ) node ).getChildren() ) { ExprNode modifiedNode = removeObjectClass( child ); if ( !( modifiedNode instanceof ObjectClassNode ) ) { newAndNode.addNode( modifiedNode ); nbNodes++; } if ( modifiedNode instanceof UndefinedNode ) { // We can just return an Undefined node as nothing will get selected return UndefinedNode.UNDEFINED_NODE; } } switch ( nbNodes ) { case 0: // Unlikely... But (&(ObjectClass=*)) or (|(ObjectClass=*)) are still an option return ObjectClassNode.OBJECT_CLASS_NODE; case 1: // We can safely remove the AND/OR node and replace it with its first child return newAndNode.getFirstChild(); default: return newAndNode; } }
Example #4
Source File: NormalizationInterceptor.java From syncope with Apache License 2.0 | 5 votes |
/** * Remove the (ObjectClass=*) node from a NotNode, if we have one. */ private ExprNode handleNotNode( ExprNode node ) { NotNode newNotNode = new NotNode(); for ( ExprNode child : ( ( BranchNode ) node ).getChildren() ) { ExprNode modifiedNode = removeObjectClass( child ); if ( modifiedNode instanceof ObjectClassNode ) { // We don't want any entry which has an ObjectClass, return an undefined node return UndefinedNode.UNDEFINED_NODE; } if ( modifiedNode instanceof UndefinedNode ) { // Here, we will select everything return ObjectClassNode.OBJECT_CLASS_NODE; } newNotNode.addNode( modifiedNode ); } return newNotNode; }