Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 17888 invoked from network); 10 Mar 2011 13:59:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Mar 2011 13:59:09 -0000 Received: (qmail 38523 invoked by uid 500); 10 Mar 2011 13:59:09 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 38486 invoked by uid 500); 10 Mar 2011 13:59:09 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 38479 invoked by uid 99); 10 Mar 2011 13:59:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Mar 2011 13:59:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Mar 2011 13:59:05 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 806882388999; Thu, 10 Mar 2011 13:58:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1080227 - in /directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec: controls/search/pagedSearch/PagedResultsDecorator.java decorators/SearchRequestDecorator.java Date: Thu, 10 Mar 2011 13:58:44 -0000 To: commits@directory.apache.org From: pamarcelot@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110310135844.806882388999@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: pamarcelot Date: Thu Mar 10 13:58:44 2011 New Revision: 1080227 URL: http://svn.apache.org/viewvc?rev=1080227&view=rev Log: Added missing methods. Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/controls/search/pagedSearch/PagedResultsDecorator.java directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/decorators/SearchRequestDecorator.java Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/controls/search/pagedSearch/PagedResultsDecorator.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/controls/search/pagedSearch/PagedResultsDecorator.java?rev=1080227&r1=1080226&r2=1080227&view=diff ============================================================================== --- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/controls/search/pagedSearch/PagedResultsDecorator.java (original) +++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/controls/search/pagedSearch/PagedResultsDecorator.java Thu Mar 10 13:58:44 2011 @@ -31,8 +31,8 @@ import org.apache.directory.shared.asn1. import org.apache.directory.shared.asn1.ber.tlv.UniversalTag; import org.apache.directory.shared.asn1.ber.tlv.Value; import org.apache.directory.shared.i18n.I18n; -import org.apache.directory.shared.ldap.codec.api.LdapCodecService; import org.apache.directory.shared.ldap.codec.api.ControlDecorator; +import org.apache.directory.shared.ldap.codec.api.LdapCodecService; import org.apache.directory.shared.ldap.model.message.controls.PagedResults; import org.apache.directory.shared.ldap.model.message.controls.PagedResultsImpl; import org.apache.directory.shared.util.Strings; @@ -249,6 +249,20 @@ public class PagedResultsDecorator exten /** + * @see Object#hashCode() + */ + @Override + public int hashCode() + { + int hash = super.hashCode(); + + hash = hash * 17 + pscSeqLength; + + return hash; + } + + + /** * @see Object#equals(Object) */ @Override Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/decorators/SearchRequestDecorator.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/decorators/SearchRequestDecorator.java?rev=1080227&r1=1080226&r2=1080227&view=diff ============================================================================== --- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/decorators/SearchRequestDecorator.java (original) +++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/decorators/SearchRequestDecorator.java Thu Mar 10 13:58:44 2011 @@ -32,9 +32,9 @@ import org.apache.directory.shared.asn1. import org.apache.directory.shared.asn1.ber.tlv.UniversalTag; import org.apache.directory.shared.i18n.I18n; import org.apache.directory.shared.ldap.codec.AttributeValueAssertion; -import org.apache.directory.shared.ldap.codec.api.LdapMessageContainer; import org.apache.directory.shared.ldap.codec.api.LdapCodecService; import org.apache.directory.shared.ldap.codec.api.LdapConstants; +import org.apache.directory.shared.ldap.codec.api.LdapMessageContainer; import org.apache.directory.shared.ldap.codec.api.MessageDecorator; import org.apache.directory.shared.ldap.codec.search.AndFilter; import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter; @@ -285,7 +285,7 @@ public class SearchRequestDecorator exte @SuppressWarnings("unchecked") public void unstackFilters( Asn1Container container ) { - LdapMessageContainer> ldapMessageContainer = + LdapMessageContainer> ldapMessageContainer = ( LdapMessageContainer> ) container; TLV tlv = ldapMessageContainer.getCurrentTLV(); @@ -347,25 +347,26 @@ public class SearchRequestDecorator exte * @param filter The filter to be transformed * @return An ExprNode */ - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings( + { "unchecked", "rawtypes" }) private ExprNode transform( Filter filter ) { if ( filter != null ) { // Transform OR, AND or NOT leaves - if ( filter instanceof ConnectorFilter) + if ( filter instanceof ConnectorFilter ) { BranchNode branch = null; - if ( filter instanceof AndFilter) + if ( filter instanceof AndFilter ) { branch = new AndNode(); } - else if ( filter instanceof OrFilter) + else if ( filter instanceof OrFilter ) { branch = new OrNode(); } - else if ( filter instanceof NotFilter) + else if ( filter instanceof NotFilter ) { branch = new NotNode(); } @@ -506,7 +507,7 @@ public class SearchRequestDecorator exte filter = new NotFilter(); } - List children = ( (BranchNode) exprNode ).getChildren(); + List children = ( ( BranchNode ) exprNode ).getChildren(); // Loop on all AND/OR children if ( children != null ) @@ -562,7 +563,7 @@ public class SearchRequestDecorator exte { filter = new AttributeValueAssertionFilter( LdapConstants.APPROX_MATCH_FILTER ); AttributeValueAssertion assertion = new AttributeValueAssertion(); - assertion.setAttributeDesc( ( (ApproximateNode) exprNode ).getAttribute() ); + assertion.setAttributeDesc( ( ( ApproximateNode ) exprNode ).getAttribute() ); assertion.setAssertionValue( ( ( ApproximateNode ) exprNode ).getValue() ); ( ( AttributeValueAssertionFilter ) filter ).setAssertion( assertion ); } @@ -631,7 +632,7 @@ public class SearchRequestDecorator exte /** - * {@inheritDoc} + * @see Object#hashCode() */ @Override public int hashCode() @@ -670,6 +671,63 @@ public class SearchRequestDecorator exte } + /** + * @see Object#equals(Object) + */ + @Override + public boolean equals( Object o ) + { + if ( !super.equals( o ) ) + { + return false; + } + + if ( ( o == null ) || ( o instanceof SearchRequestDecorator ) ) + { + return false; + } + + SearchRequestDecorator otherSearchRequestDecorator = ( SearchRequestDecorator ) o; + + if ( ( getDecorated() != null ) && ( !getDecorated().equals( otherSearchRequestDecorator.getDecorated() ) ) ) + { + return false; + } + + if ( searchRequestLength != otherSearchRequestDecorator.searchRequestLength ) + { + return false; + } + + if ( attributeDescriptionListLength != otherSearchRequestDecorator.attributeDescriptionListLength ) + { + return false; + } + + if ( ( terminalFilter != null ) && ( terminalFilter.equals( otherSearchRequestDecorator.terminalFilter ) ) ) + { + return false; + } + + if ( ( currentFilter != null ) && ( currentFilter.equals( otherSearchRequestDecorator.currentFilter ) ) ) + { + return false; + } + + if ( ( topFilter != null ) && ( topFilter.equals( otherSearchRequestDecorator.topFilter ) ) ) + { + return false; + } + + if ( tlvId != otherSearchRequestDecorator.tlvId ) + { + return false; + } + + return true; + } + + //------------------------------------------------------------------------- // The SearchRequest methods //------------------------------------------------------------------------- @@ -829,8 +887,7 @@ public class SearchRequestDecorator exte //------------------------------------------------------------------------- // The Decorator methods //------------------------------------------------------------------------- - - + /** * Compute the SearchRequest length * @@ -879,7 +936,7 @@ public class SearchRequestDecorator exte // The filter setFilter( getFilter() ); - searchRequestLength += + searchRequestLength += getCodecFilter().computeLength(); // The attributes description list @@ -891,7 +948,7 @@ public class SearchRequestDecorator exte for ( String attribute : getAttributes() ) { // add the attribute length to the attributes length - int idLength = Strings.getBytesUtf8(attribute).length; + int idLength = Strings.getBytesUtf8( attribute ).length; attributeDescriptionListLength += 1 + TLV.getNbBytes( idLength ) + idLength; } } @@ -904,8 +961,8 @@ public class SearchRequestDecorator exte // Return the result. return 1 + TLV.getNbBytes( searchRequestLength ) + searchRequestLength; } - - + + /** * Encode the SearchRequest message to a PDU. * @@ -936,7 +993,7 @@ public class SearchRequestDecorator exte buffer.put( TLV.getBytes( getSearchRequestLength() ) ); // The baseObject - org.apache.directory.shared.asn1.ber.tlv.Value.encode( buffer, Dn.getBytes( getBase()) ); + org.apache.directory.shared.asn1.ber.tlv.Value.encode( buffer, Dn.getBytes( getBase() ) ); // The scope org.apache.directory.shared.asn1.ber.tlv.Value.encodeEnumerated( buffer, getScope().getScope() );