001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020package org.apache.directory.shared.ldap.model.message; 021 022 023/** 024 * SearchResponseDone implementation 025 * 026 * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a> 027 */ 028public class SearchResultDoneImpl extends AbstractResultResponse implements SearchResultDone 029{ 030 static final long serialVersionUID = 8698484213877460215L; 031 032 033 /** 034 * Creates a SearchResponseDone as a reply to an SearchRequest to 035 * indicate the end of a search operation. 036 */ 037 public SearchResultDoneImpl() 038 { 039 super( -1, TYPE ); 040 } 041 042 043 /** 044 * Creates a SearchResponseDone as a reply to an SearchRequest to 045 * indicate the end of a search operation. 046 * 047 * @param id the session unique message id 048 */ 049 public SearchResultDoneImpl( final int id ) 050 { 051 super( id, TYPE ); 052 } 053 054 055 /** 056 * {@inheritDoc} 057 */ 058 @Override 059 public int hashCode() 060 { 061 int hash = 37; 062 hash = hash * 17 + getLdapResult().hashCode(); 063 hash = hash * 17 + super.hashCode(); 064 065 return hash; 066 } 067 068 069 /** 070 * Checks for equality by using the underlying LdapResult objects of this 071 * SearchResponseDone stub. 072 * 073 * @param obj 074 * the object to be tested for equality 075 * @return true if obj is equivalent to this SearchResponseDone impl 076 */ 077 public boolean equals( Object obj ) 078 { 079 // quickly return if the obj is this object 080 if ( obj == this ) 081 { 082 return true; 083 } 084 085 if ( !super.equals( obj ) ) 086 { 087 return false; 088 } 089 090 LdapResult result = ( ( SearchResultDone ) obj ).getLdapResult(); 091 092 return getLdapResult().equals( result ); 093 } 094 095 096 /** 097 * Get a String representation of a SearchResultDone 098 * 099 * @return A SearchResultDone String 100 */ 101 public String toString() 102 { 103 StringBuilder sb = new StringBuilder(); 104 105 sb.append( " Search Result Done\n" ); 106 sb.append( super.toString() ); 107 108 return super.toString( sb.toString() ); 109 } 110}