directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
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 GMT
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<MessageDecorator<Message>> ldapMessageContainer
= 
+        LdapMessageContainer<MessageDecorator<Message>> ldapMessageContainer
=
             ( LdapMessageContainer<MessageDecorator<Message>> ) 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<ExprNode> children = ( (BranchNode) exprNode ).getChildren();
+                List<ExprNode> 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()
);



Mime
View raw message