1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.ldap.codec.decorators;
21
22
23 import java.nio.BufferOverflowException;
24 import java.nio.ByteBuffer;
25 import java.util.ArrayList;
26 import java.util.List;
27
28 import org.apache.directory.api.asn1.DecoderException;
29 import org.apache.directory.api.asn1.EncoderException;
30 import org.apache.directory.api.asn1.ber.Asn1Container;
31 import org.apache.directory.api.asn1.ber.tlv.BerValue;
32 import org.apache.directory.api.asn1.ber.tlv.TLV;
33 import org.apache.directory.api.asn1.ber.tlv.UniversalTag;
34 import org.apache.directory.api.i18n.I18n;
35 import org.apache.directory.api.ldap.codec.AttributeValueAssertion;
36 import org.apache.directory.api.ldap.codec.api.LdapApiService;
37 import org.apache.directory.api.ldap.codec.api.LdapConstants;
38 import org.apache.directory.api.ldap.codec.api.LdapMessageContainer;
39 import org.apache.directory.api.ldap.codec.api.MessageDecorator;
40 import org.apache.directory.api.ldap.codec.search.AndFilter;
41 import org.apache.directory.api.ldap.codec.search.AttributeValueAssertionFilter;
42 import org.apache.directory.api.ldap.codec.search.ConnectorFilter;
43 import org.apache.directory.api.ldap.codec.search.ExtensibleMatchFilter;
44 import org.apache.directory.api.ldap.codec.search.Filter;
45 import org.apache.directory.api.ldap.codec.search.NotFilter;
46 import org.apache.directory.api.ldap.codec.search.OrFilter;
47 import org.apache.directory.api.ldap.codec.search.PresentFilter;
48 import org.apache.directory.api.ldap.codec.search.SubstringFilter;
49 import org.apache.directory.api.ldap.model.entry.Value;
50 import org.apache.directory.api.ldap.model.exception.LdapException;
51 import org.apache.directory.api.ldap.model.filter.AndNode;
52 import org.apache.directory.api.ldap.model.filter.ApproximateNode;
53 import org.apache.directory.api.ldap.model.filter.BranchNode;
54 import org.apache.directory.api.ldap.model.filter.BranchNormalizedVisitor;
55 import org.apache.directory.api.ldap.model.filter.EqualityNode;
56 import org.apache.directory.api.ldap.model.filter.ExprNode;
57 import org.apache.directory.api.ldap.model.filter.ExtensibleNode;
58 import org.apache.directory.api.ldap.model.filter.GreaterEqNode;
59 import org.apache.directory.api.ldap.model.filter.LeafNode;
60 import org.apache.directory.api.ldap.model.filter.LessEqNode;
61 import org.apache.directory.api.ldap.model.filter.NotNode;
62 import org.apache.directory.api.ldap.model.filter.OrNode;
63 import org.apache.directory.api.ldap.model.filter.PresenceNode;
64 import org.apache.directory.api.ldap.model.filter.SimpleNode;
65 import org.apache.directory.api.ldap.model.filter.SubstringNode;
66 import org.apache.directory.api.ldap.model.message.AbandonListener;
67 import org.apache.directory.api.ldap.model.message.AliasDerefMode;
68 import org.apache.directory.api.ldap.model.message.Control;
69 import org.apache.directory.api.ldap.model.message.Message;
70 import org.apache.directory.api.ldap.model.message.MessageTypeEnum;
71 import org.apache.directory.api.ldap.model.message.SearchRequest;
72 import org.apache.directory.api.ldap.model.message.SearchResultDone;
73 import org.apache.directory.api.ldap.model.message.SearchScope;
74 import org.apache.directory.api.ldap.model.name.Dn;
75 import org.apache.directory.api.util.Strings;
76
77
78
79
80
81
82
83 public class SearchRequestDecorator extends MessageDecorator<SearchRequest> implements SearchRequest
84 {
85
86 private int searchRequestLength;
87
88
89 private int attributeDescriptionListLength;
90
91
92 private Filter terminalFilter;
93
94
95 private Filter currentFilter;
96
97
98 private Filter topFilter;
99
100
101 private int tlvId;
102
103
104 private byte[] dnBytes;
105
106
107
108
109
110
111
112 public SearchRequestDecorator( LdapApiService codec, SearchRequest decoratedMessage )
113 {
114 super( codec, decoratedMessage );
115 }
116
117
118
119
120
121
122 public void setSearchRequestLength( int searchRequestLength )
123 {
124 this.searchRequestLength = searchRequestLength;
125 }
126
127
128
129
130
131 public int getSearchRequestLength()
132 {
133 return searchRequestLength;
134 }
135
136
137
138
139
140
141 public void setAttributeDescriptionListLength( int attributeDescriptionListLength )
142 {
143 this.attributeDescriptionListLength = attributeDescriptionListLength;
144 }
145
146
147
148
149
150 public int getAttributeDescriptionListLength()
151 {
152 return attributeDescriptionListLength;
153 }
154
155
156
157
158
159
160 public void setTlvId( int tlvId )
161 {
162 this.tlvId = tlvId;
163 }
164
165
166 public Filter getCurrentFilter()
167 {
168 return currentFilter;
169 }
170
171
172
173
174
175
176
177 public Filter getCodecFilter()
178 {
179 return topFilter;
180 }
181
182
183
184
185
186
187
188 public ExprNode getFilterNode()
189 {
190 return transform( topFilter );
191 }
192
193
194
195
196
197
198
199 public Filter getTerminalFilter()
200 {
201 return terminalFilter;
202 }
203
204
205
206
207
208
209
210 public void setTerminalFilter( Filter terminalFilter )
211 {
212 this.terminalFilter = terminalFilter;
213 }
214
215
216
217
218
219 public SearchRequest setFilter( ExprNode filter )
220 {
221 topFilter = transform( filter );
222
223 return this;
224 }
225
226
227
228
229
230 public SearchRequest setFilter( String filter ) throws LdapException
231 {
232 getDecorated().setFilter( filter );
233 this.currentFilter = transform( getDecorated().getFilter() );
234
235 return this;
236 }
237
238
239
240
241
242
243
244 public void setCurrentFilter( Filter filter )
245 {
246 currentFilter = filter;
247 }
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262 public void addCurrentFilter( Filter localFilter ) throws DecoderException
263 {
264 if ( currentFilter != null )
265 {
266
267
268 ( ( ConnectorFilter ) currentFilter ).addFilter( localFilter );
269 localFilter.setParent( currentFilter, currentFilter.getTlvId() );
270
271 if ( localFilter instanceof ConnectorFilter )
272 {
273 currentFilter = localFilter;
274 }
275 }
276 else
277 {
278
279 currentFilter = localFilter;
280 currentFilter.setParent( null, tlvId );
281 topFilter = localFilter;
282 }
283 }
284
285
286
287
288
289
290
291
292
293
294 @SuppressWarnings("unchecked")
295 public void unstackFilters( Asn1Container container )
296 {
297 LdapMessageContainer<MessageDecorator<Message>> ldapMessageContainer =
298 ( LdapMessageContainer<MessageDecorator<Message>> ) container;
299
300 TLV tlv = ldapMessageContainer.getCurrentTLV();
301 TLV localParent = tlv.getParent();
302 Filter localFilter = terminalFilter;
303
304
305 while ( ( localParent != null ) && ( localParent.getExpectedLength() == 0 ) )
306 {
307 int parentTlvId = localFilter.getParent() != null ? localFilter.getParent().getTlvId() : localFilter
308 .getParentTlvId();
309
310 if ( localParent.getId() != parentTlvId )
311 {
312 localParent = localParent.getParent();
313 }
314 else
315 {
316 Filter filterParent = localFilter.getParent();
317
318
319
320 if ( localFilter instanceof PresentFilter )
321 {
322 if ( filterParent == null )
323 {
324
325 break;
326 }
327
328 filterParent = filterParent.getParent();
329 }
330 else if ( filterParent instanceof Filter )
331 {
332 filterParent = filterParent.getParent();
333 }
334
335 if ( filterParent instanceof Filter )
336 {
337
338
339 localFilter = currentFilter;
340 currentFilter = filterParent;
341 localParent = localParent.getParent();
342 }
343 else
344 {
345
346 break;
347 }
348 }
349 }
350 }
351
352
353
354
355
356
357
358
359 @SuppressWarnings(
360 { "unchecked", "rawtypes" })
361 private ExprNode transform( Filter filter )
362 {
363 if ( filter != null )
364 {
365
366 if ( filter instanceof ConnectorFilter )
367 {
368 BranchNode branch = null;
369
370 if ( filter instanceof AndFilter )
371 {
372 branch = new AndNode();
373 }
374 else if ( filter instanceof OrFilter )
375 {
376 branch = new OrNode();
377 }
378 else if ( filter instanceof NotFilter )
379 {
380 branch = new NotNode();
381 }
382
383 List<Filter> filtersSet = ( ( ConnectorFilter ) filter ).getFilterSet();
384
385
386 if ( filtersSet != null )
387 {
388 for ( Filter node : filtersSet )
389 {
390 branch.addNode( transform( node ) );
391 }
392 }
393
394 return branch;
395 }
396 else
397 {
398
399 LeafNode branch = null;
400
401 if ( filter instanceof PresentFilter )
402 {
403 branch = new PresenceNode( ( ( PresentFilter ) filter ).getAttributeDescription() );
404 }
405 else if ( filter instanceof AttributeValueAssertionFilter )
406 {
407 AttributeValueAssertion ava = ( ( AttributeValueAssertionFilter ) filter ).getAssertion();
408
409
410 switch ( ( ( AttributeValueAssertionFilter ) filter ).getFilterType() )
411 {
412 case LdapConstants.EQUALITY_MATCH_FILTER:
413 branch = new EqualityNode( ava.getAttributeDesc(), ava.getAssertionValue() );
414
415 break;
416
417 case LdapConstants.GREATER_OR_EQUAL_FILTER:
418 branch = new GreaterEqNode( ava.getAttributeDesc(), ava.getAssertionValue() );
419
420 break;
421
422 case LdapConstants.LESS_OR_EQUAL_FILTER:
423 branch = new LessEqNode( ava.getAttributeDesc(), ava.getAssertionValue() );
424
425 break;
426
427 case LdapConstants.APPROX_MATCH_FILTER:
428 branch = new ApproximateNode( ava.getAttributeDesc(), ava.getAssertionValue() );
429
430 break;
431 }
432
433 }
434 else if ( filter instanceof SubstringFilter )
435 {
436
437 SubstringFilter substrFilter = ( SubstringFilter ) filter;
438 String initialString = null;
439 String finalString = null;
440 List<String> anyString = null;
441
442 if ( substrFilter.getInitialSubstrings() != null )
443 {
444 initialString = substrFilter.getInitialSubstrings();
445 }
446
447 if ( substrFilter.getFinalSubstrings() != null )
448 {
449 finalString = substrFilter.getFinalSubstrings();
450 }
451
452 if ( substrFilter.getAnySubstrings() != null )
453 {
454 anyString = new ArrayList<String>();
455
456 for ( String any : substrFilter.getAnySubstrings() )
457 {
458 anyString.add( any );
459 }
460 }
461
462 branch = new SubstringNode( anyString, substrFilter.getType(), initialString, finalString );
463 }
464 else if ( filter instanceof ExtensibleMatchFilter )
465 {
466
467 ExtensibleMatchFilter extFilter = ( ExtensibleMatchFilter ) filter;
468 String matchingRule = null;
469
470 Value<?> value = extFilter.getMatchValue();
471
472 if ( extFilter.getMatchingRule() != null )
473 {
474 matchingRule = extFilter.getMatchingRule();
475 }
476
477 branch = new ExtensibleNode( extFilter.getType(), value, matchingRule, extFilter.isDnAttributes() );
478 }
479
480 return branch;
481 }
482 }
483 else
484 {
485
486 return null;
487 }
488 }
489
490
491
492
493
494
495
496
497 private static Filter transform( ExprNode exprNode )
498 {
499 if ( exprNode != null )
500 {
501 Filter filter = null;
502
503
504 if ( exprNode instanceof BranchNode )
505 {
506 if ( exprNode instanceof AndNode )
507 {
508 filter = new AndFilter();
509 }
510 else if ( exprNode instanceof OrNode )
511 {
512 filter = new OrFilter();
513 }
514 else if ( exprNode instanceof NotNode )
515 {
516 filter = new NotFilter();
517 }
518
519 List<ExprNode> children = ( ( BranchNode ) exprNode ).getChildren();
520
521
522 if ( children != null )
523 {
524 for ( ExprNode child : children )
525 {
526 try
527 {
528 ( ( ConnectorFilter ) filter ).addFilter( transform( child ) );
529 }
530 catch ( DecoderException de )
531 {
532 return null;
533 }
534 }
535 }
536 }
537 else
538 {
539 if ( exprNode instanceof PresenceNode )
540 {
541
542 filter = new PresentFilter();
543 ( ( PresentFilter ) filter ).setAttributeDescription( ( ( PresenceNode ) exprNode ).getAttribute() );
544 }
545 else if ( exprNode instanceof SimpleNode<?> )
546 {
547 if ( exprNode instanceof EqualityNode<?> )
548 {
549 filter = new AttributeValueAssertionFilter( LdapConstants.EQUALITY_MATCH_FILTER );
550 AttributeValueAssertion assertion = new AttributeValueAssertion();
551 assertion.setAttributeDesc( ( ( EqualityNode<?> ) exprNode ).getAttribute() );
552 assertion.setAssertionValue( ( ( EqualityNode<?> ) exprNode ).getValue() );
553 ( ( AttributeValueAssertionFilter ) filter ).setAssertion( assertion );
554 }
555 else if ( exprNode instanceof GreaterEqNode<?> )
556 {
557 filter = new AttributeValueAssertionFilter( LdapConstants.GREATER_OR_EQUAL_FILTER );
558 AttributeValueAssertion assertion = new AttributeValueAssertion();
559 assertion.setAttributeDesc( ( ( GreaterEqNode<?> ) exprNode ).getAttribute() );
560 assertion.setAssertionValue( ( ( GreaterEqNode<?> ) exprNode ).getValue() );
561 ( ( AttributeValueAssertionFilter ) filter ).setAssertion( assertion );
562 }
563 else if ( exprNode instanceof LessEqNode<?> )
564 {
565 filter = new AttributeValueAssertionFilter( LdapConstants.LESS_OR_EQUAL_FILTER );
566 AttributeValueAssertion assertion = new AttributeValueAssertion();
567 assertion.setAttributeDesc( ( ( LessEqNode<?> ) exprNode ).getAttribute() );
568 assertion.setAssertionValue( ( ( LessEqNode<?> ) exprNode ).getValue() );
569 ( ( AttributeValueAssertionFilter ) filter ).setAssertion( assertion );
570 }
571 else if ( exprNode instanceof ApproximateNode<?> )
572 {
573 filter = new AttributeValueAssertionFilter( LdapConstants.APPROX_MATCH_FILTER );
574 AttributeValueAssertion assertion = new AttributeValueAssertion();
575 assertion.setAttributeDesc( ( ( ApproximateNode<?> ) exprNode ).getAttribute() );
576 assertion.setAssertionValue( ( ( ApproximateNode<?> ) exprNode ).getValue() );
577 ( ( AttributeValueAssertionFilter ) filter ).setAssertion( assertion );
578 }
579 }
580 else if ( exprNode instanceof SubstringNode )
581 {
582
583 filter = new SubstringFilter();
584
585 ( ( SubstringFilter ) filter ).setType( ( ( SubstringNode ) exprNode ).getAttribute() );
586 String initialString = ( ( SubstringNode ) exprNode ).getInitial();
587 String finalString = ( ( SubstringNode ) exprNode ).getFinal();
588 List<String> anyStrings = ( ( SubstringNode ) exprNode ).getAny();
589
590 if ( initialString != null )
591 {
592 ( ( SubstringFilter ) filter ).setInitialSubstrings( initialString );
593 }
594
595 if ( finalString != null )
596 {
597 ( ( SubstringFilter ) filter ).setFinalSubstrings( finalString );
598 }
599
600 if ( anyStrings != null )
601 {
602 for ( String any : anyStrings )
603 {
604 ( ( SubstringFilter ) filter ).addAnySubstrings( any );
605 }
606 }
607 }
608 else if ( exprNode instanceof ExtensibleNode )
609 {
610
611 filter = new ExtensibleMatchFilter();
612
613 String attribute = ( ( ExtensibleNode ) exprNode ).getAttribute();
614 String matchingRule = ( ( ExtensibleNode ) exprNode ).getMatchingRuleId();
615 boolean dnAttributes = ( ( ExtensibleNode ) exprNode ).hasDnAttributes();
616 Value<?> value = ( ( ExtensibleNode ) exprNode ).getValue();
617
618 if ( attribute != null )
619 {
620 ( ( ExtensibleMatchFilter ) filter ).setType( attribute );
621 }
622
623 if ( matchingRule != null )
624 {
625 ( ( ExtensibleMatchFilter ) filter ).setMatchingRule( matchingRule );
626 }
627
628 ( ( ExtensibleMatchFilter ) filter ).setMatchValue( value );
629 ( ( ExtensibleMatchFilter ) filter ).setDnAttributes( dnAttributes );
630 }
631 }
632
633 return filter;
634 }
635 else
636 {
637
638 return null;
639 }
640 }
641
642
643
644
645
646 @Override
647 public int hashCode()
648 {
649 int hash = 37;
650
651 if ( getDecorated().getBase() != null )
652 {
653 hash = hash * 17 + getDecorated().getBase().hashCode();
654 }
655
656 hash = hash * 17 + getDecorated().getDerefAliases().hashCode();
657 hash = hash * 17 + getDecorated().getScope().hashCode();
658 hash = hash * 17 + Long.valueOf( getDecorated().getSizeLimit() ).hashCode();
659 hash = hash * 17 + getDecorated().getTimeLimit();
660 hash = hash * 17 + ( getDecorated().getTypesOnly() ? 0 : 1 );
661
662 List<String> attributes = getDecorated().getAttributes();
663 if ( attributes != null )
664 {
665 hash = hash * 17 + attributes.size();
666
667
668 for ( String attr : attributes )
669 {
670 hash = hash + attr.hashCode();
671 }
672 }
673
674 BranchNormalizedVisitor visitor = new BranchNormalizedVisitor();
675 getDecorated().getFilter().accept( visitor );
676 hash = hash * 17 + currentFilter.toString().hashCode();
677 hash = hash * 17 + super.hashCode();
678
679 return hash;
680 }
681
682
683
684
685
686 @Override
687 public boolean equals( Object o )
688 {
689 if ( !super.equals( o ) )
690 {
691 return false;
692 }
693
694 if ( ( o == null ) || ( o instanceof SearchRequestDecorator ) )
695 {
696 return false;
697 }
698
699 SearchRequestDecorator otherSearchRequestDecorator = ( SearchRequestDecorator ) o;
700
701 if ( ( getDecorated() != null ) && ( !getDecorated().equals( otherSearchRequestDecorator.getDecorated() ) ) )
702 {
703 return false;
704 }
705
706 if ( searchRequestLength != otherSearchRequestDecorator.searchRequestLength )
707 {
708 return false;
709 }
710
711 if ( attributeDescriptionListLength != otherSearchRequestDecorator.attributeDescriptionListLength )
712 {
713 return false;
714 }
715
716 if ( ( terminalFilter != null ) && ( terminalFilter.equals( otherSearchRequestDecorator.terminalFilter ) ) )
717 {
718 return false;
719 }
720
721 if ( ( currentFilter != null ) && ( currentFilter.equals( otherSearchRequestDecorator.currentFilter ) ) )
722 {
723 return false;
724 }
725
726 if ( ( topFilter != null ) && ( topFilter.equals( otherSearchRequestDecorator.topFilter ) ) )
727 {
728 return false;
729 }
730
731 if ( tlvId != otherSearchRequestDecorator.tlvId )
732 {
733 return false;
734 }
735
736 return true;
737 }
738
739
740
741
742
743
744
745
746 public MessageTypeEnum[] getResponseTypes()
747 {
748 return getDecorated().getResponseTypes();
749 }
750
751
752
753
754
755 public Dn getBase()
756 {
757 return getDecorated().getBase();
758 }
759
760
761
762
763
764 public SearchRequest setBase( Dn baseDn )
765 {
766 getDecorated().setBase( baseDn );
767
768 return this;
769 }
770
771
772
773
774
775 public SearchScope getScope()
776 {
777 return getDecorated().getScope();
778 }
779
780
781
782
783
784 public SearchRequest setScope( SearchScope scope )
785 {
786 getDecorated().setScope( scope );
787
788 return this;
789 }
790
791
792
793
794
795 public AliasDerefMode getDerefAliases()
796 {
797 return getDecorated().getDerefAliases();
798 }
799
800
801
802
803
804 public SearchRequest setDerefAliases( AliasDerefMode aliasDerefAliases )
805 {
806 getDecorated().setDerefAliases( aliasDerefAliases );
807
808 return this;
809 }
810
811
812
813
814
815 public long getSizeLimit()
816 {
817 return getDecorated().getSizeLimit();
818 }
819
820
821
822
823
824 public SearchRequest setSizeLimit( long entriesMax )
825 {
826 getDecorated().setSizeLimit( entriesMax );
827
828 return this;
829 }
830
831
832
833
834
835 public int getTimeLimit()
836 {
837 return getDecorated().getTimeLimit();
838 }
839
840
841
842
843
844 public SearchRequest setTimeLimit( int secondsMax )
845 {
846 getDecorated().setTimeLimit( secondsMax );
847
848 return this;
849 }
850
851
852
853
854
855 public boolean getTypesOnly()
856 {
857 return getDecorated().getTypesOnly();
858 }
859
860
861
862
863
864 public SearchRequest setTypesOnly( boolean typesOnly )
865 {
866 getDecorated().setTypesOnly( typesOnly );
867
868 return this;
869 }
870
871
872
873
874
875 public ExprNode getFilter()
876 {
877 return getDecorated().getFilter();
878 }
879
880
881
882
883
884 public List<String> getAttributes()
885 {
886 return getDecorated().getAttributes();
887 }
888
889
890
891
892
893 public SearchRequest addAttributes( String... attributes )
894 {
895 getDecorated().addAttributes( attributes );
896
897 return this;
898 }
899
900
901
902
903
904 public SearchRequest removeAttribute( String attribute )
905 {
906 getDecorated().removeAttribute( attribute );
907
908 return this;
909 }
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940 public int computeLength()
941 {
942 int searchRequestLength = 0;
943
944
945 dnBytes = Strings.getBytesUtf8( getBase().getName() );
946 searchRequestLength += 1 + TLV.getNbBytes( dnBytes.length ) + dnBytes.length;
947
948
949 searchRequestLength += 1 + 1 + 1;
950
951
952 searchRequestLength += 1 + 1 + 1;
953
954
955 searchRequestLength += 1 + 1 + BerValue.getNbBytes( getSizeLimit() );
956
957
958 searchRequestLength += 1 + 1 + BerValue.getNbBytes( getTimeLimit() );
959
960
961 searchRequestLength += 1 + 1 + 1;
962
963
964 setFilter( getFilter() );
965 searchRequestLength +=
966 getCodecFilter().computeLength();
967
968
969 int attributeDescriptionListLength = 0;
970
971 if ( ( getAttributes() != null ) && ( getAttributes().size() != 0 ) )
972 {
973
974 for ( String attribute : getAttributes() )
975 {
976
977 int idLength = Strings.getBytesUtf8( attribute ).length;
978 attributeDescriptionListLength += 1 + TLV.getNbBytes( idLength ) + idLength;
979 }
980 }
981
982 setAttributeDescriptionListLength( attributeDescriptionListLength );
983
984 searchRequestLength += 1 + TLV.getNbBytes( attributeDescriptionListLength ) + attributeDescriptionListLength;
985
986 setSearchRequestLength( searchRequestLength );
987
988 return 1 + TLV.getNbBytes( searchRequestLength ) + searchRequestLength;
989 }
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013 public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
1014 {
1015 try
1016 {
1017
1018 buffer.put( LdapConstants.SEARCH_REQUEST_TAG );
1019 buffer.put( TLV.getBytes( getSearchRequestLength() ) );
1020
1021
1022 BerValue.encode( buffer, dnBytes );
1023
1024
1025 BerValue.encodeEnumerated( buffer, getScope().getScope() );
1026
1027
1028 BerValue.encodeEnumerated( buffer, getDerefAliases().getValue() );
1029
1030
1031 BerValue.encode( buffer, getSizeLimit() );
1032
1033
1034 BerValue.encode( buffer, getTimeLimit() );
1035
1036
1037 BerValue.encode( buffer, getTypesOnly() );
1038
1039
1040 getCodecFilter().encode( buffer );
1041
1042
1043 buffer.put( UniversalTag.SEQUENCE.getValue() );
1044 buffer.put( TLV.getBytes( getAttributeDescriptionListLength() ) );
1045
1046 if ( ( getAttributes() != null ) && ( getAttributes().size() != 0 ) )
1047 {
1048
1049 for ( String attribute : getAttributes() )
1050 {
1051 BerValue.encode( buffer, attribute );
1052 }
1053 }
1054 }
1055 catch ( BufferOverflowException boe )
1056 {
1057 throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
1058 }
1059
1060 return buffer;
1061 }
1062
1063
1064 public SearchResultDone getResultResponse()
1065 {
1066 return ( SearchResultDone ) getDecorated().getResultResponse();
1067 }
1068
1069
1070 public boolean hasResponse()
1071 {
1072 return getDecorated().hasResponse();
1073 }
1074
1075
1076 public void abandon()
1077 {
1078 getDecorated().abandon();
1079 }
1080
1081
1082 public boolean isAbandoned()
1083 {
1084 return getDecorated().isAbandoned();
1085 }
1086
1087
1088 public SearchRequest addAbandonListener( AbandonListener listener )
1089 {
1090 getDecorated().addAbandonListener( listener );
1091
1092 return this;
1093 }
1094
1095
1096
1097
1098
1099 public SearchRequest setMessageId( int messageId )
1100 {
1101 return ( SearchRequest ) super.setMessageId( messageId );
1102 }
1103
1104
1105
1106
1107
1108 public SearchRequest addControl( Control control )
1109 {
1110 return ( SearchRequest ) super.addControl( control );
1111 }
1112
1113
1114
1115
1116
1117 public SearchRequest addAllControls( Control[] controls )
1118 {
1119 return ( SearchRequest ) super.addAllControls( controls );
1120 }
1121
1122
1123
1124
1125
1126 public SearchRequest removeControl( Control control )
1127 {
1128 return ( SearchRequest ) super.removeControl( control );
1129 }
1130
1131
1132
1133
1134
1135 public boolean isFollowReferrals()
1136 {
1137 return getDecorated().isFollowReferrals();
1138 }
1139
1140
1141
1142
1143
1144 public SearchRequest followReferrals()
1145 {
1146 return getDecorated().followReferrals();
1147 }
1148
1149
1150
1151
1152
1153 public boolean isIgnoreReferrals()
1154 {
1155 return getDecorated().isIgnoreReferrals();
1156 }
1157
1158
1159
1160
1161
1162 public SearchRequest ignoreReferrals()
1163 {
1164 return getDecorated().ignoreReferrals();
1165 }
1166 }