View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *
10   *    https://www.apache.org/licenses/LICENSE-2.0
11   *
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License.
18   *
19   */
20  
21  package org.apache.directory.api.dsmlv2.request;
22  
23  
24  import java.io.IOException;
25  import java.lang.reflect.Array;
26  import java.util.Base64;
27  import java.util.HashMap;
28  
29  import org.apache.directory.api.asn1.DecoderException;
30  import org.apache.directory.api.asn1.util.Oid;
31  import org.apache.directory.api.dsmlv2.AbstractGrammar;
32  import org.apache.directory.api.dsmlv2.DsmlControl;
33  import org.apache.directory.api.dsmlv2.DsmlLiterals;
34  import org.apache.directory.api.dsmlv2.Dsmlv2Container;
35  import org.apache.directory.api.dsmlv2.Dsmlv2StatesEnum;
36  import org.apache.directory.api.dsmlv2.Grammar;
37  import org.apache.directory.api.dsmlv2.GrammarAction;
38  import org.apache.directory.api.dsmlv2.GrammarTransition;
39  import org.apache.directory.api.dsmlv2.ParserUtils;
40  import org.apache.directory.api.dsmlv2.Tag;
41  import org.apache.directory.api.dsmlv2.request.BatchRequestDsml.OnError;
42  import org.apache.directory.api.dsmlv2.request.BatchRequestDsml.Processing;
43  import org.apache.directory.api.dsmlv2.request.BatchRequestDsml.ResponseOrder;
44  import org.apache.directory.api.i18n.I18n;
45  import org.apache.directory.api.ldap.codec.api.ControlFactory;
46  import org.apache.directory.api.ldap.codec.api.LdapApiService;
47  import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
48  import org.apache.directory.api.ldap.codec.api.LdapCodecConstants;
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.exception.LdapInvalidDnException;
52  import org.apache.directory.api.ldap.model.exception.LdapSchemaException;
53  import org.apache.directory.api.ldap.model.filter.ExprNode;
54  import org.apache.directory.api.ldap.model.message.AbandonRequestImpl;
55  import org.apache.directory.api.ldap.model.message.AddRequestImpl;
56  import org.apache.directory.api.ldap.model.message.AliasDerefMode;
57  import org.apache.directory.api.ldap.model.message.BindRequestImpl;
58  import org.apache.directory.api.ldap.model.message.CompareRequest;
59  import org.apache.directory.api.ldap.model.message.CompareRequestImpl;
60  import org.apache.directory.api.ldap.model.message.Control;
61  import org.apache.directory.api.ldap.model.message.DeleteRequestImpl;
62  import org.apache.directory.api.ldap.model.message.ModifyDnRequestImpl;
63  import org.apache.directory.api.ldap.model.message.ModifyRequestImpl;
64  import org.apache.directory.api.ldap.model.message.OpaqueExtendedRequest;
65  import org.apache.directory.api.ldap.model.message.Request;
66  import org.apache.directory.api.ldap.model.message.SearchRequest;
67  import org.apache.directory.api.ldap.model.message.SearchRequestImpl;
68  import org.apache.directory.api.ldap.model.message.SearchScope;
69  import org.apache.directory.api.ldap.model.message.controls.OpaqueControl;
70  import org.apache.directory.api.ldap.model.name.Dn;
71  import org.apache.directory.api.ldap.model.name.Rdn;
72  import org.apache.directory.api.util.Strings;
73  import org.xmlpull.v1.XmlPullParser;
74  import org.xmlpull.v1.XmlPullParserException;
75  
76  
77  /**
78   * This Class represents the DSMLv2 Request Grammar
79   *
80   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
81   */
82  public final class Dsmlv2Grammar extends AbstractGrammar implements Grammar
83  {
84      private LdapApiService codec = LdapApiServiceFactory.getSingleton();
85  
86      //*************************
87      //*    GRAMMAR ACTIONS    *
88      //*************************
89  
90      /**
91       * GrammarAction that creates a Batch Request
92       */
93      private final GrammarAction batchRequestCreation = new GrammarAction( "Create Batch Request" )
94      {
95          /**
96           * {@inheritDoc}
97           */
98          @Override
99          public void action( Dsmlv2Container container ) throws XmlPullParserException
100         {
101             BatchRequestDsml batchRequest = new BatchRequestDsml();
102 
103             container.setBatchRequest( batchRequest );
104 
105             XmlPullParser xpp = container.getParser();
106 
107             // Checking and adding the batchRequest's attributes
108             String attributeValue;
109             // requestID
110             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.REQUEST_ID );
111 
112             if ( attributeValue != null )
113             {
114                 batchRequest.setRequestID( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
115             }
116             // processing
117             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.PROCESSING );
118 
119             if ( attributeValue != null )
120             {
121                 if ( DsmlLiterals.SEQUENTIAL.equals( attributeValue ) )
122                 {
123                     batchRequest.setProcessing( Processing.SEQUENTIAL );
124                 }
125                 else if ( DsmlLiterals.PARALLEL.equals( attributeValue ) )
126                 {
127                     batchRequest.setProcessing( Processing.PARALLEL );
128                 }
129                 else
130                 {
131                     throw new XmlPullParserException( I18n.err( I18n.ERR_03013_UNKNOWN_PROCESSING_VALUE ), xpp, null );
132                 }
133             }
134             else
135             {
136                 batchRequest.setProcessing( Processing.SEQUENTIAL );
137             }
138 
139             // onError
140             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.ON_ERROR );
141 
142             if ( attributeValue != null )
143             {
144                 if ( DsmlLiterals.RESUME.equals( attributeValue ) )
145                 {
146                     batchRequest.setOnError( OnError.RESUME );
147                 }
148                 else if ( DsmlLiterals.EXIT.equals( attributeValue ) )
149                 {
150                     batchRequest.setOnError( OnError.EXIT );
151                 }
152                 else
153                 {
154                     throw new XmlPullParserException( I18n.err( I18n.ERR_03014_UNKNOWN_ON_ERROR_VALUE ), xpp, null );
155                 }
156             }
157             else
158             {
159                 batchRequest.setOnError( OnError.EXIT );
160             }
161 
162             // responseOrder
163             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.RESPONSE_ORDER );
164 
165             if ( attributeValue != null )
166             {
167                 if ( DsmlLiterals.SEQUENTIAL.equals( attributeValue ) )
168                 {
169                     batchRequest.setResponseOrder( ResponseOrder.SEQUENTIAL );
170                 }
171                 else if ( DsmlLiterals.UNORDERED.equals( attributeValue ) )
172                 {
173                     batchRequest.setResponseOrder( ResponseOrder.UNORDERED );
174                 }
175                 else
176                 {
177                     throw new XmlPullParserException( I18n.err( I18n.ERR_03015_UNKNOWN_RESPONSE_ORDER_VALUE ), xpp, null );
178                 }
179             }
180             else
181             {
182                 batchRequest.setResponseOrder( ResponseOrder.SEQUENTIAL );
183             }
184         }
185     };
186 
187     /**
188      * GrammarAction that creates an Abandon Request
189      */
190     private final GrammarAction abandonRequestCreation = new GrammarAction( "Create Abandon Request" )
191     {
192         /**
193          * {@inheritDoc}
194          */
195         @Override
196         public void action( Dsmlv2Container container ) throws XmlPullParserException
197         {
198             AbandonRequestDsml abandonRequest = new AbandonRequestDsml( codec, new AbandonRequestImpl() );
199             container.getBatchRequest().addRequest( abandonRequest );
200 
201             XmlPullParser xpp = container.getParser();
202 
203             // Checking and adding the request's attributes
204             String attributeValue;
205             // requestID
206             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.REQUEST_ID );
207 
208             if ( attributeValue != null )
209             {
210                 abandonRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
211             }
212             else
213             {
214                 if ( ParserUtils.isRequestIdNeeded( container ) )
215                 {
216                     throw new XmlPullParserException( I18n.err( I18n.ERR_03000_REQUEST_ID_REQUIRED ), xpp, null );
217                 }
218             }
219 
220             // abandonID
221             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.ABANDON_ID );
222 
223             if ( attributeValue != null )
224             {
225                 try
226                 {
227                     abandonRequest.setAbandoned( Integer.parseInt( attributeValue ) );
228                 }
229                 catch ( NumberFormatException nfe )
230                 {
231                     throw new XmlPullParserException( I18n.err( I18n.ERR_03017_ABANDON_ID_NOT_INTEGER ), xpp, nfe );
232                 }
233             }
234             else
235             {
236                 throw new XmlPullParserException( I18n.err( I18n.ERR_03018_ABANDON_ID_REQUIRED ), xpp, null );
237             }
238         }
239     };
240 
241     /**
242      * GrammarAction that creates an Add Request
243      */
244     private final GrammarAction addRequestCreation = new GrammarAction( "Create Add Request" )
245     {
246         /**
247          * {@inheritDoc}
248          */
249         @Override
250         public void action( Dsmlv2Container container ) throws XmlPullParserException
251         {
252             AddRequestDsml addRequest = new AddRequestDsml( codec, new AddRequestImpl() );
253             container.getBatchRequest().addRequest( addRequest );
254 
255             XmlPullParser xpp = container.getParser();
256 
257             // Checking and adding the request's attributes
258             String attributeValue;
259             // requestID
260             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.REQUEST_ID );
261 
262             if ( attributeValue != null )
263             {
264                 addRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
265             }
266             else
267             {
268                 if ( ParserUtils.isRequestIdNeeded( container ) )
269                 {
270                     throw new XmlPullParserException( I18n.err( I18n.ERR_03000_REQUEST_ID_REQUIRED ), xpp, null );
271                 }
272             }
273 
274             // dn
275             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.DN );
276 
277             if ( attributeValue != null )
278             {
279                 try
280                 {
281                     addRequest.setEntryDn( new Dn( attributeValue ) );
282                 }
283                 catch ( LdapInvalidDnException lide )
284                 {
285                     throw new XmlPullParserException( I18n.err( I18n.ERR_03039_PARSING_ERROR, lide.getMessage() ), xpp, lide );
286                 }
287             }
288             else
289             {
290                 throw new XmlPullParserException( I18n.err( I18n.ERR_03001_DN_ATTRIBUTE_REQUIRED ), xpp, null );
291             }
292         }
293     };
294 
295     /**
296      * GrammarAction that adds an attribute to an Add Request
297      */
298     private final GrammarAction addRequestAddAttribute = new GrammarAction( "Add Attribute to Add Request" )
299     {
300         /**
301          * {@inheritDoc}
302          */
303         @Override
304         public void action( Dsmlv2Container container ) throws XmlPullParserException
305         {
306             AddRequestDsml addRequest = ( AddRequestDsml )
307                 container.getBatchRequest().getCurrentRequest();
308 
309             XmlPullParser xpp = container.getParser();
310 
311             // Checking and adding the request's attributes
312             String attributeValue;
313             // name
314             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NAME );
315 
316             if ( attributeValue != null )
317             {
318                 try
319                 {
320                     addRequest.addAttributeType( attributeValue );
321                 }
322                 catch ( LdapException le )
323                 {
324                     throw new XmlPullParserException( I18n.err( I18n.ERR_03020_CANT_ADD_ATTRIBUTE_VALUE ), xpp, le );
325                 }
326             }
327             else
328             {
329                 throw new XmlPullParserException( I18n.err( I18n.ERR_03002_NAME_ATTRIBUTE_REQUIRED ), xpp, null );
330             }
331         }
332     };
333 
334     /**
335      * GrammarAction that adds a Value to an Attribute of an Add Request
336      */
337     private final GrammarAction addRequestAddValue = new GrammarAction( "Add Value to Attribute" )
338     {
339         /**
340          * {@inheritDoc}
341          */
342         @Override
343         public void action( Dsmlv2Container container ) throws XmlPullParserException
344         {
345             AddRequestDsml addRequest = ( AddRequestDsml )
346                 container.getBatchRequest().getCurrentRequest();
347 
348             XmlPullParser xpp = container.getParser();
349 
350             try
351             {
352                 // We have to catch the type Attribute Value before going to the next Text node
353                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
354 
355                 // Getting the value
356                 String nextText = xpp.nextText();
357 
358                 if ( !Strings.isEmpty( nextText ) )
359                 {
360                     try
361                     {
362                         if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
363                         {
364                             addRequest.addAttributeValue( Base64.getDecoder().decode( nextText.trim() ) );
365                         }
366                         else
367                         {
368                             addRequest.addAttributeValue( nextText.trim() );
369                         }
370                     }
371                     catch ( LdapException le )
372                     {
373                         throw new XmlPullParserException( le.getMessage(), xpp, le );
374                     }
375                 }
376             }
377             catch ( IOException ioe )
378             {
379                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008_UNEXPECTED_ERROR, ioe.getMessage() ), xpp, ioe );
380             }
381         }
382     };
383 
384     /**
385      * GrammarAction that creates an Auth Request
386      */
387     private final GrammarAction authRequestCreation = new GrammarAction( "Create Auth Request" )
388     {
389         /**
390          * {@inheritDoc}
391          */
392         @Override
393         public void action( Dsmlv2Container container ) throws XmlPullParserException
394         {
395             BindRequestDsml authRequest = new BindRequestDsml( codec, new BindRequestImpl() );
396             container.getBatchRequest().addRequest( authRequest );
397 
398             authRequest.setSimple( true );
399             authRequest.setVersion3( true );
400 
401             XmlPullParser xpp = container.getParser();
402 
403             // Checking and adding the request's attributes
404             String attributeValue;
405             // requestID
406             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.REQUEST_ID );
407 
408             if ( attributeValue != null )
409             {
410                 authRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
411             }
412             else
413             {
414                 if ( ParserUtils.isRequestIdNeeded( container ) )
415                 {
416                     throw new XmlPullParserException( I18n.err( I18n.ERR_03000_REQUEST_ID_REQUIRED ), xpp, null );
417                 }
418             }
419             // principal
420             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.PRINCIPAL );
421 
422             if ( attributeValue != null )
423             {
424                 authRequest.setName( attributeValue );
425             }
426             else
427             {
428                 throw new XmlPullParserException( I18n.err( I18n.ERR_03021_PRINCIPAL_ATTRIBUTE_REQUIRED ), xpp, null );
429             }
430         }
431     };
432 
433     /**
434      * GrammarAction that creates an Compare Request
435      */
436     private final GrammarAction compareRequestCreation = new GrammarAction( "Create Compare Request" )
437     {
438         /**
439          * {@inheritDoc}
440          */
441         @Override
442         public void action( Dsmlv2Container container ) throws XmlPullParserException
443         {
444             CompareRequestDsml compareRequest = new CompareRequestDsml( codec, new CompareRequestImpl() );
445             container.getBatchRequest().addRequest( compareRequest );
446 
447             XmlPullParser xpp = container.getParser();
448 
449             // Checking and adding the request's attributes
450             String attributeValue;
451             // requestID
452             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.REQUEST_ID );
453 
454             if ( attributeValue != null )
455             {
456                 compareRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
457             }
458             else
459             {
460                 if ( ParserUtils.isRequestIdNeeded( container ) )
461                 {
462                     throw new XmlPullParserException( I18n.err( I18n.ERR_03000_REQUEST_ID_REQUIRED ), xpp, null );
463                 }
464             }
465 
466             // dn
467             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.DN );
468 
469             if ( attributeValue != null )
470             {
471                 try
472                 {
473                     compareRequest.setName( new Dn( attributeValue ) );
474                 }
475                 catch ( LdapInvalidDnException lide )
476                 {
477                     throw new XmlPullParserException( I18n.err( I18n.ERR_03039_PARSING_ERROR, lide.getMessage() ), xpp, lide );
478                 }
479             }
480             else
481             {
482                 throw new XmlPullParserException( I18n.err( I18n.ERR_03001_DN_ATTRIBUTE_REQUIRED ), xpp, null );
483             }
484         }
485     };
486 
487     /**
488      * GrammarAction that adds an Assertion to a Compare Request
489      */
490     private final GrammarAction compareRequestAddAssertion = new GrammarAction( "Add Assertion to Compare Request" )
491     {
492         /**
493          * {@inheritDoc}
494          */
495         @Override
496         public void action( Dsmlv2Container container ) throws XmlPullParserException
497         {
498             CompareRequest compareRequest = ( CompareRequest ) container.getBatchRequest().getCurrentRequest();
499 
500             XmlPullParser xpp = container.getParser();
501 
502             // Checking and adding the request's attributes
503             String attributeId;
504 
505             // name
506             attributeId = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NAME );
507 
508             if ( attributeId != null )
509             {
510                 compareRequest.setAttributeId( attributeId );
511             }
512             else
513             {
514                 throw new XmlPullParserException( I18n.err( I18n.ERR_03002_NAME_ATTRIBUTE_REQUIRED ), xpp, null );
515             }
516         }
517     };
518 
519     /**
520      * GrammarAction that adds a Value to a Compare Request
521      */
522     private final GrammarAction compareRequestAddValue = new GrammarAction( "Add Value to Compare Request" )
523     {
524         /**
525          * {@inheritDoc}
526          */
527         @Override
528         public void action( Dsmlv2Container container ) throws XmlPullParserException
529         {
530             CompareRequest compareRequest = ( CompareRequest ) container.getBatchRequest().getCurrentRequest();
531 
532             XmlPullParser xpp = container.getParser();
533 
534             try
535             {
536                 // We have to catch the type Attribute Value before going to the next Text node
537                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
538 
539                 // Getting the value
540                 String nextText = xpp.nextText();
541 
542                 if ( !Strings.isEmpty( nextText ) )
543                 {
544                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
545                     {
546                         compareRequest.setAssertionValue( Base64.getDecoder().decode( nextText.trim() ) );
547                     }
548                     else
549                     {
550                         compareRequest.setAssertionValue( nextText.trim() );
551                     }
552                 }
553             }
554             catch ( IOException ioe )
555             {
556                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008_UNEXPECTED_ERROR, ioe.getMessage() ), xpp, ioe );
557             }
558         }
559     };
560 
561     /**
562      * GrammarAction that creates a Del Request
563      */
564     private final GrammarAction delRequestCreation = new GrammarAction( "Create Del Request" )
565     {
566         /**
567          * {@inheritDoc}
568          */
569         @Override
570         public void action( Dsmlv2Container container ) throws XmlPullParserException
571         {
572             DelRequestDsml delRequest = new DelRequestDsml( codec, new DeleteRequestImpl() );
573             container.getBatchRequest().addRequest( delRequest );
574 
575             XmlPullParser xpp = container.getParser();
576 
577             // Checking and adding the request's attributes
578             String attributeValue;
579             // requestID
580             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.REQUEST_ID );
581 
582             if ( attributeValue != null )
583             {
584                 delRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
585             }
586             else
587             {
588                 if ( ParserUtils.isRequestIdNeeded( container ) )
589                 {
590                     throw new XmlPullParserException( I18n.err( I18n.ERR_03000_REQUEST_ID_REQUIRED ), xpp, null );
591                 }
592             }
593 
594             // dn
595             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.DN );
596 
597             if ( attributeValue != null )
598             {
599                 try
600                 {
601                     delRequest.setName( new Dn( attributeValue ) );
602                 }
603                 catch ( LdapInvalidDnException lide )
604                 {
605                     throw new XmlPullParserException( I18n.err( I18n.ERR_03039_PARSING_ERROR, lide.getMessage() ), xpp, lide );
606                 }
607             }
608             else
609             {
610                 throw new XmlPullParserException( I18n.err( I18n.ERR_03001_DN_ATTRIBUTE_REQUIRED ), xpp, null );
611             }
612         }
613     };
614 
615     /**
616      * GrammarAction that creates an Extended Request
617      */
618     private final GrammarAction extendedRequestCreation = new GrammarAction( "Create Extended Request" )
619     {
620         /**
621          * {@inheritDoc}
622          */
623         @Override
624         public void action( Dsmlv2Container container ) throws XmlPullParserException
625         {
626             ExtendedRequestDsml<?, ?> extendedRequest =
627                 new ExtendedRequestDsml<>( codec,
628                     new OpaqueExtendedRequest() );
629             container.getBatchRequest().addRequest( extendedRequest );
630 
631             XmlPullParser xpp = container.getParser();
632 
633             // Checking and adding the request's attributes
634             String attributeValue;
635             // requestID
636             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.REQUEST_ID );
637 
638             if ( attributeValue != null )
639             {
640                 extendedRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
641             }
642             else
643             {
644                 if ( ParserUtils.isRequestIdNeeded( container ) )
645                 {
646                     throw new XmlPullParserException( I18n.err( I18n.ERR_03000_REQUEST_ID_REQUIRED ), xpp, null );
647                 }
648             }
649         }
650     };
651 
652     /**
653      * GrammarAction that adds a Name to an Extended Request
654      */
655     private final GrammarAction extendedRequestAddName = new GrammarAction( "Add Name to Extended Request" )
656     {
657         /**
658          * {@inheritDoc}
659          */
660         @Override
661         public void action( Dsmlv2Container container ) throws XmlPullParserException
662         {
663             ExtendedRequestDsml<?, ?> extendedRequest = ( ExtendedRequestDsml<?, ?> )
664                 container.getBatchRequest().getCurrentRequest();
665 
666             XmlPullParser xpp = container.getParser();
667 
668             try
669             {
670                 String nextText = xpp.nextText();
671 
672                 if ( Strings.isEmpty( nextText ) )
673                 {
674                     throw new XmlPullParserException( I18n.err( I18n.ERR_03022_NULL_REQUEST_NAME ), xpp, null );
675                 }
676                 else
677                 {
678                     String oid = nextText.trim();
679 
680                     if ( Oid.isOid( oid ) )
681                     {
682                         extendedRequest.setRequestName( nextText.trim() );
683                     }
684                     else
685                     {
686                         throw new XmlPullParserException( I18n.err( I18n.ERR_03038_BAD_OID, oid ), xpp, null );
687                     }
688                 }
689             }
690             catch ( IOException ioe )
691             {
692                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008_UNEXPECTED_ERROR, ioe.getMessage() ), xpp, ioe );
693             }
694         }
695     };
696 
697     /**
698      * GrammarAction that adds a Value to an Extended Request
699      */
700     private final GrammarAction extendedRequestAddValue = new GrammarAction( "Add Value to Extended Request" )
701     {
702         /**
703          * {@inheritDoc}
704          */
705         @Override
706         public void action( Dsmlv2Container container ) throws XmlPullParserException
707         {
708             ExtendedRequestDsml<?, ?> extendedRequest = ( ExtendedRequestDsml<?, ?> )
709                 container.getBatchRequest().getCurrentRequest();
710 
711             XmlPullParser xpp = container.getParser();
712 
713             try
714             {
715                 // We have to catch the type Attribute Value before going to the next Text node
716                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
717 
718                 // Getting the value
719                 String nextText = xpp.nextText();
720 
721                 if ( !Strings.isEmpty( nextText ) )
722                 {
723                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
724                     {
725                         extendedRequest.setRequestValue( Base64.getDecoder().decode( nextText.trim() ) );
726                     }
727                     else
728                     {
729                         extendedRequest.setRequestValue( Strings.getBytesUtf8( nextText.trim() ) );
730                     }
731                 }
732             }
733             catch ( IOException ioe )
734             {
735                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008_UNEXPECTED_ERROR, ioe.getMessage() ), xpp, ioe );
736             }
737         }
738     };
739 
740     /**
741      * GrammarAction that creates a Modify Dn Request
742      */
743     private final GrammarAction modDNRequestCreation = new GrammarAction( "Create Modify Dn Request" )
744     {
745         /**
746          * {@inheritDoc}
747          */
748         @Override
749         public void action( Dsmlv2Container container ) throws XmlPullParserException
750         {
751             ModifyDNRequestDsml modifyDNRequest = new ModifyDNRequestDsml( codec, new ModifyDnRequestImpl() );
752             container.getBatchRequest().addRequest( modifyDNRequest );
753 
754             XmlPullParser xpp = container.getParser();
755 
756             // Checking and adding the request's attributes
757             String attributeValue;
758             // requestID
759             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.REQUEST_ID );
760 
761             if ( attributeValue != null )
762             {
763                 modifyDNRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
764             }
765             else
766             {
767                 if ( ParserUtils.isRequestIdNeeded( container ) )
768                 {
769                     throw new XmlPullParserException( I18n.err( I18n.ERR_03000_REQUEST_ID_REQUIRED ), xpp, null );
770                 }
771             }
772 
773             // dn
774             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.DN );
775 
776             if ( attributeValue != null )
777             {
778                 try
779                 {
780                     modifyDNRequest.setName( new Dn( attributeValue ) );
781                 }
782                 catch ( LdapInvalidDnException lide )
783                 {
784                     throw new XmlPullParserException( I18n.err( I18n.ERR_03039_PARSING_ERROR, lide.getMessage() ), xpp, lide );
785                 }
786             }
787             else
788             {
789                 throw new XmlPullParserException( I18n.err( I18n.ERR_03001_DN_ATTRIBUTE_REQUIRED ), xpp, null );
790             }
791 
792             // newrdn
793             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NEW_RDN );
794 
795             if ( attributeValue != null )
796             {
797                 try
798                 {
799                     modifyDNRequest.setNewRdn( new Rdn( attributeValue ) );
800                 }
801                 catch ( LdapInvalidDnException lide )
802                 {
803                     throw new XmlPullParserException( I18n.err( I18n.ERR_03039_PARSING_ERROR, lide.getMessage() ), xpp, lide );
804                 }
805             }
806             else
807             {
808                 throw new XmlPullParserException( I18n.err( I18n.ERR_03023_NEW_RDN_ATTRIBUTE_REQUESTED ), xpp, null );
809             }
810 
811             // deleteoldrdn
812             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.DELETE_OLD_RDN );
813 
814             if ( attributeValue != null )
815             {
816                 if ( ( attributeValue.equalsIgnoreCase( DsmlLiterals.TRUE ) ) || ( "1".equals( attributeValue ) ) )
817                 {
818                     modifyDNRequest.setDeleteOldRdn( true );
819                 }
820                 else if ( ( attributeValue.equalsIgnoreCase( DsmlLiterals.FALSE ) ) || ( "0".equals( attributeValue ) ) )
821                 {
822                     modifyDNRequest.setDeleteOldRdn( false );
823                 }
824                 else
825                 {
826                     throw new XmlPullParserException( I18n.err( I18n.ERR_03024_INCORRECT_DELETE_OLD_RDN_VALUE ), xpp, null );
827                 }
828             }
829             else
830             {
831                 modifyDNRequest.setDeleteOldRdn( true );
832             }
833 
834             // newsuperior
835             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NEW_SUPERIOR );
836 
837             if ( attributeValue != null )
838             {
839                 try
840                 {
841                     modifyDNRequest.setNewSuperior( new Dn( attributeValue ) );
842                 }
843                 catch ( LdapInvalidDnException lide )
844                 {
845                     throw new XmlPullParserException( I18n.err( I18n.ERR_03039_PARSING_ERROR, lide.getMessage() ), xpp, lide );
846                 }
847             }
848         }
849     };
850 
851     /**
852      * GrammarAction that creates a Modify Request
853      */
854     private final GrammarAction modifyRequestCreation = new GrammarAction( "Create Modify Request" )
855     {
856         /**
857          * {@inheritDoc}
858          */
859         @Override
860         public void action( Dsmlv2Container container ) throws XmlPullParserException
861         {
862             ModifyRequestDsml modifyRequest = new ModifyRequestDsml( codec, new ModifyRequestImpl() );
863             container.getBatchRequest().addRequest( modifyRequest );
864 
865             XmlPullParser xpp = container.getParser();
866 
867             // Checking and adding the request's attributes
868             String attributeValue;
869             // requestID
870             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.REQUEST_ID );
871 
872             if ( attributeValue != null )
873             {
874                 modifyRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
875             }
876             else
877             {
878                 if ( ParserUtils.isRequestIdNeeded( container ) )
879                 {
880                     throw new XmlPullParserException( I18n.err( I18n.ERR_03000_REQUEST_ID_REQUIRED ), xpp, null );
881                 }
882             }
883 
884             // dn
885             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.DN );
886 
887             if ( attributeValue != null )
888             {
889                 try
890                 {
891                     modifyRequest.setName( new Dn( attributeValue ) );
892                 }
893                 catch ( LdapInvalidDnException lide )
894                 {
895                     throw new XmlPullParserException( I18n.err( I18n.ERR_03039_PARSING_ERROR, lide.getLocalizedMessage() ), xpp, lide );
896                 }
897             }
898             else
899             {
900                 throw new XmlPullParserException( I18n.err( I18n.ERR_03001_DN_ATTRIBUTE_REQUIRED ), xpp, null );
901             }
902         }
903     };
904 
905     /**
906      * GrammarAction that adds a Modification to a Modify Request
907      */
908     private final GrammarAction modifyRequestAddModification = new GrammarAction( "Adds Modification to Modify Request" )
909     {
910         /**
911          * {@inheritDoc}
912          */
913         @Override
914         public void action( Dsmlv2Container container ) throws XmlPullParserException
915         {
916             ModifyRequestDsml modifyRequest = ( ModifyRequestDsml )
917                 container.getBatchRequest().getCurrentRequest();
918 
919             XmlPullParser xpp = container.getParser();
920 
921             // Checking and adding the request's attributes
922             String attributeValue;
923             // operation
924             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.OPERATION );
925 
926             if ( attributeValue != null )
927             {
928                 if ( DsmlLiterals.ADD.equals( attributeValue ) )
929                 {
930                     modifyRequest.setCurrentOperation( LdapCodecConstants.OPERATION_ADD );
931                 }
932                 else if ( DsmlLiterals.DELETE.equals( attributeValue ) )
933                 {
934                     modifyRequest.setCurrentOperation( LdapCodecConstants.OPERATION_DELETE );
935                 }
936                 else if ( DsmlLiterals.REPLACE.equals( attributeValue ) )
937                 {
938                     modifyRequest.setCurrentOperation( LdapCodecConstants.OPERATION_REPLACE );
939                 }
940                 else if ( DsmlLiterals.INCREMENT.equals( attributeValue ) )
941                 {
942                     modifyRequest.setCurrentOperation( LdapCodecConstants.OPERATION_INCREMENT );
943                 }
944                 else
945                 {
946                     throw new XmlPullParserException( I18n.err( I18n.ERR_03040_UNKNOWN_OPERATION ), xpp, null );
947                 }
948             }
949             else
950             {
951                 throw new XmlPullParserException( I18n.err( I18n.ERR_03025_OPERATION_TTRIBUTE_REQUIRED ), xpp, null );
952             }
953 
954             // name
955             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NAME );
956 
957             if ( attributeValue != null )
958             {
959                 modifyRequest.addAttributeTypeAndValues( attributeValue );
960             }
961             else
962             {
963                 throw new XmlPullParserException( I18n.err( I18n.ERR_03002_NAME_ATTRIBUTE_REQUIRED ), xpp, null );
964             }
965         }
966     };
967 
968     /**
969      * GrammarAction that adds a Value to a Modification of a Modify Request
970      */
971     private final GrammarAction modifyRequestAddValue = new GrammarAction(
972         "Add Value to Modification of Modify Request" )
973     {
974         /**
975          * {@inheritDoc}
976          */
977         @Override
978         public void action( Dsmlv2Container container ) throws XmlPullParserException
979         {
980             ModifyRequestDsml modifyRequest = ( ModifyRequestDsml )
981                 container.getBatchRequest().getCurrentRequest();
982 
983             XmlPullParser xpp = container.getParser();
984 
985             try
986             {
987                 // We have to catch the type Attribute Value before going to the next Text node
988                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
989 
990                 // Getting the value
991                 String nextText = xpp.nextText();
992                 // We are testing if nextText equals "" since a modification can be "".
993 
994                 try
995                 {
996                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
997                     {
998                         modifyRequest.addAttributeValue( Base64.getDecoder().decode( nextText.trim() ) );
999                     }
1000                     else
1001                     {
1002                         modifyRequest.addAttributeValue( nextText.trim() );
1003                     }
1004                 }
1005                 catch ( LdapException le )
1006                 {
1007                     throw new XmlPullParserException( le.getMessage(), xpp, le );
1008                 }
1009             }
1010             catch ( IOException ioe )
1011             {
1012                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008_UNEXPECTED_ERROR, ioe.getMessage() ), xpp, ioe );
1013             }
1014         }
1015     };
1016 
1017     /**
1018      * GrammarAction that creates a Search Request
1019      */
1020     private final GrammarAction searchRequestCreation = new GrammarAction( "Create Search Request" )
1021     {
1022         /**
1023          * {@inheritDoc}
1024          */
1025         @Override
1026         public void action( Dsmlv2Container container ) throws XmlPullParserException
1027         {
1028             SearchRequestDsml searchRequest = new SearchRequestDsml( codec, new SearchRequestImpl() );
1029             container.getBatchRequest().addRequest( searchRequest );
1030 
1031             XmlPullParser xpp = container.getParser();
1032 
1033             // Checking and adding the request's attributes
1034             String attributeValue;
1035             // requestID
1036             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.REQUEST_ID );
1037 
1038             if ( attributeValue != null )
1039             {
1040                 searchRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1041             }
1042             else
1043             {
1044                 if ( ParserUtils.isRequestIdNeeded( container ) )
1045                 {
1046                     throw new XmlPullParserException( I18n.err( I18n.ERR_03000_REQUEST_ID_REQUIRED ), xpp, null );
1047                 }
1048             }
1049 
1050             // dn
1051             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.DN );
1052 
1053             if ( attributeValue != null )
1054             {
1055                 try
1056                 {
1057                     searchRequest.setBase( new Dn( attributeValue ) );
1058                 }
1059                 catch ( LdapInvalidDnException lide )
1060                 {
1061                     throw new XmlPullParserException( I18n.err( I18n.ERR_03039_PARSING_ERROR, lide.getMessage() ), xpp, lide );
1062                 }
1063             }
1064             else
1065             {
1066                 throw new XmlPullParserException( I18n.err( I18n.ERR_03001_DN_ATTRIBUTE_REQUIRED ), xpp, null );
1067             }
1068 
1069             // scope
1070             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.SCOPE );
1071 
1072             if ( attributeValue != null )
1073             {
1074                 if ( DsmlLiterals.BASE_OBJECT.equals( attributeValue ) )
1075                 {
1076                     searchRequest.setScope( SearchScope.OBJECT );
1077                 }
1078                 else if ( DsmlLiterals.SINGLE_LEVEL.equals( attributeValue ) )
1079                 {
1080                     searchRequest.setScope( SearchScope.ONELEVEL );
1081                 }
1082                 else if ( DsmlLiterals.WHOLE_SUBTREE.equals( attributeValue ) )
1083                 {
1084                     searchRequest.setScope( SearchScope.SUBTREE );
1085                 }
1086                 else
1087                 {
1088                     throw new XmlPullParserException( I18n.err( I18n.ERR_03026_UNKNOWN_SCOPE ), xpp, null );
1089                 }
1090             }
1091             else
1092             {
1093                 throw new XmlPullParserException( I18n.err( I18n.ERR_03027_SCOPE_ATTRIBUTE_REQUIRED ), xpp, null );
1094             }
1095 
1096             // derefAliases
1097             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.DEREF_ALIASES );
1098 
1099             if ( attributeValue != null )
1100             {
1101                 if ( DsmlLiterals.NEVER_DEREF_ALIASES.equals( attributeValue ) )
1102                 {
1103                     searchRequest.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
1104                 }
1105                 else if ( DsmlLiterals.DEREF_IN_SEARCHING.equals( attributeValue ) )
1106                 {
1107                     searchRequest.setDerefAliases( AliasDerefMode.DEREF_IN_SEARCHING );
1108                 }
1109                 else if ( DsmlLiterals.DEREF_FINDING_BASE_OBJ.equals( attributeValue ) )
1110                 {
1111                     searchRequest.setDerefAliases( AliasDerefMode.DEREF_FINDING_BASE_OBJ );
1112                 }
1113                 else if ( DsmlLiterals.DEREF_ALWAYS.equals( attributeValue ) )
1114                 {
1115                     searchRequest.setDerefAliases( AliasDerefMode.DEREF_ALWAYS );
1116                 }
1117                 else
1118                 {
1119                     throw new XmlPullParserException( I18n.err( I18n.ERR_03028_UNKNOWN_DEREFALIAS_VALUE ), xpp, null );
1120                 }
1121             }
1122             else
1123             {
1124                 throw new XmlPullParserException( I18n.err( I18n.ERR_03029_DEREFALIA_ATTRIBUTE_REQUIRED ), xpp, null );
1125             }
1126 
1127             // sizeLimit
1128             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.SIZE_LIMIT );
1129 
1130             if ( attributeValue != null )
1131             {
1132                 try
1133                 {
1134                     searchRequest.setSizeLimit( Long.parseLong( attributeValue ) );
1135                 }
1136                 catch ( NumberFormatException nfe )
1137                 {
1138                     throw new XmlPullParserException( I18n.err( I18n.ERR_03030_SIZE_LIMIT_NOT_INTEGER ), xpp, nfe );
1139                 }
1140             }
1141             else
1142             {
1143                 searchRequest.setSizeLimit( 0L );
1144             }
1145 
1146             // timeLimit
1147             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.TIME_LIMIT );
1148 
1149             if ( attributeValue != null )
1150             {
1151                 try
1152                 {
1153                     searchRequest.setTimeLimit( Integer.parseInt( attributeValue ) );
1154                 }
1155                 catch ( NumberFormatException nfe )
1156                 {
1157                     throw new XmlPullParserException( I18n.err( I18n.ERR_03031_TIME_LIMIT_NOT_INTEGER ), xpp, nfe );
1158                 }
1159             }
1160             else
1161             {
1162                 searchRequest.setTimeLimit( 0 );
1163             }
1164 
1165             // typesOnly
1166             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.TYPES_ONLY );
1167 
1168             if ( attributeValue != null )
1169             {
1170                 if ( ( attributeValue.equals( DsmlLiterals.TRUE ) ) || ( "1".equals( attributeValue ) ) )
1171                 {
1172                     searchRequest.setTypesOnly( true );
1173                 }
1174                 else if ( ( attributeValue.equals( DsmlLiterals.FALSE ) ) || ( "0".equals( attributeValue ) ) )
1175                 {
1176                     searchRequest.setTypesOnly( false );
1177                 }
1178                 else
1179                 {
1180                     throw new XmlPullParserException( I18n.err( I18n.ERR_03032_TYPES_ONLY_NOT_BOOLEAN ), xpp, null );
1181                 }
1182             }
1183             else
1184             {
1185                 searchRequest.setTypesOnly( false );
1186             }
1187         }
1188     };
1189 
1190     /**
1191      * GrammarAction that adds an Attribute to a Search Request
1192      */
1193     private final GrammarAction searchRequestAddAttribute = new GrammarAction(
1194         "Add Value to Modification of Modify Request" )
1195     {
1196         /**
1197          * {@inheritDoc}
1198          */
1199         @Override
1200         public void action( Dsmlv2Container container ) throws XmlPullParserException
1201         {
1202             SearchRequest searchRequest = ( SearchRequest ) container.getBatchRequest().getCurrentRequest();
1203 
1204             XmlPullParser xpp = container.getParser();
1205 
1206             // Checking and adding the request's attribute name
1207             String attributeName = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NAME );
1208 
1209             if ( attributeName != null )
1210             {
1211                 searchRequest.addAttributes( attributeName );
1212             }
1213             else
1214             {
1215                 throw new XmlPullParserException( I18n.err( I18n.ERR_03002_NAME_ATTRIBUTE_REQUIRED ), xpp, null );
1216             }
1217         }
1218     };
1219 
1220     /**
1221      * GrammarAction that create a Substring Filter
1222      */
1223     private final GrammarAction substringsFilterCreation = new GrammarAction( "Create Substring Filter" )
1224     {
1225         /**
1226          * {@inheritDoc}
1227          */
1228         @Override
1229         public void action( Dsmlv2Container container ) throws XmlPullParserException
1230         {
1231             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1232                 container.getBatchRequest().getCurrentRequest();
1233 
1234             XmlPullParser xpp = container.getParser();
1235 
1236             SubstringFilter filter = new SubstringFilter();
1237 
1238             // Adding the filter to the Search Filter
1239             try
1240             {
1241                 searchRequestDecorator.addCurrentFilter( filter );
1242             }
1243             catch ( DecoderException de )
1244             {
1245                 throw new XmlPullParserException( de.getMessage(), xpp, de );
1246             }
1247 
1248             searchRequestDecorator.setTerminalFilter( filter );
1249 
1250             // Checking and adding the filter's attributes
1251             String attributeValue;
1252             // name
1253             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NAME );
1254 
1255             if ( attributeValue != null )
1256             {
1257                 filter.setType( attributeValue );
1258             }
1259             else
1260             {
1261                 throw new XmlPullParserException( I18n.err( I18n.ERR_03002_NAME_ATTRIBUTE_REQUIRED ), xpp, null );
1262             }
1263         }
1264     };
1265 
1266     /**
1267      * GrammarAction that sets the Initial value to a Substring Filter
1268      */
1269     private final GrammarAction substringsFilterSetInitial = new GrammarAction( "Set Initial value to Substring Filter" )
1270     {
1271         /**
1272          * {@inheritDoc}
1273          */
1274         @Override
1275         public void action( Dsmlv2Container container ) throws XmlPullParserException
1276         {
1277             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1278                 container.getBatchRequest().getCurrentRequest();
1279 
1280             SubstringFilter substringFilter = ( SubstringFilter )
1281                 searchRequestDecorator.getTerminalFilter();
1282 
1283             XmlPullParser xpp = container.getParser();
1284 
1285             try
1286             {
1287                 // We have to catch the type Attribute Value before going to the next Text node
1288                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
1289 
1290                 // Getting the value
1291                 String nextText = xpp.nextText();
1292 
1293                 if ( !Strings.isEmpty( nextText ) )
1294                 {
1295                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
1296                     {
1297                         substringFilter
1298                             .setInitialSubstrings( Strings.utf8ToString( Base64.getDecoder().decode( nextText.trim() ) ) );
1299                     }
1300                     else
1301                     {
1302                         substringFilter.setInitialSubstrings( nextText.trim() );
1303                     }
1304                 }
1305             }
1306             catch ( IOException ioe )
1307             {
1308                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008_UNEXPECTED_ERROR, ioe.getMessage() ), xpp, ioe );
1309             }
1310         }
1311     };
1312 
1313     /**
1314      * GrammarAction that adds a Any value to a Substring Filter
1315      */
1316     private final GrammarAction substringsFilterAddAny = new GrammarAction( "Add Any value to Substring Filter" )
1317     {
1318         /**
1319          * {@inheritDoc}
1320          */
1321         @Override
1322         public void action( Dsmlv2Container container ) throws XmlPullParserException
1323         {
1324             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1325                 container.getBatchRequest().getCurrentRequest();
1326 
1327             SubstringFilter substringFilter = ( SubstringFilter ) searchRequestDecorator.getTerminalFilter();
1328 
1329             XmlPullParser xpp = container.getParser();
1330 
1331             try
1332             {
1333                 // We have to catch the type Attribute Value before going to the next Text node
1334                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
1335 
1336                 // Getting the value
1337                 String nextText = xpp.nextText();
1338 
1339                 if ( !Strings.isEmpty( nextText ) )
1340                 {
1341                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
1342                     {
1343                         substringFilter.addAnySubstrings( Strings.utf8ToString( 
1344                             Base64.getDecoder().decode( nextText.trim() ) ) );
1345                     }
1346                     else
1347                     {
1348                         substringFilter.addAnySubstrings( nextText.trim() );
1349                     }
1350                 }
1351             }
1352             catch ( IOException ioe )
1353             {
1354                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008_UNEXPECTED_ERROR, ioe.getMessage() ), xpp, ioe );
1355             }
1356         }
1357     };
1358 
1359     /**
1360      * GrammarAction that sets the Final value to a Substring Filter
1361      */
1362     private final GrammarAction substringsFilterSetFinal = new GrammarAction( "Set Final value to Substring Filter" )
1363     {
1364         /**
1365          * {@inheritDoc}
1366          */
1367         @Override
1368         public void action( Dsmlv2Container container ) throws XmlPullParserException
1369         {
1370             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1371                 container.getBatchRequest().getCurrentRequest();
1372 
1373             SubstringFilter substringFilter = ( SubstringFilter ) searchRequestDecorator.getTerminalFilter();
1374 
1375             XmlPullParser xpp = container.getParser();
1376 
1377             try
1378             {
1379                 // We have to catch the type Attribute Value before going to the next Text node
1380                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
1381 
1382                 // Getting the value
1383                 String nextText = xpp.nextText();
1384 
1385                 if ( !Strings.isEmpty( nextText ) )
1386                 {
1387                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
1388                     {
1389                         substringFilter
1390                             .setFinalSubstrings( Strings.utf8ToString( 
1391                                 Base64.getDecoder().decode( nextText.trim() ) ) );
1392                     }
1393                     else
1394                     {
1395                         substringFilter.setFinalSubstrings( nextText.trim() );
1396                     }
1397                 }
1398             }
1399             catch ( IOException ioe )
1400             {
1401                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008_UNEXPECTED_ERROR, ioe.getMessage() ), xpp, ioe );
1402             }
1403         }
1404     };
1405 
1406     /**
1407      * GrammarAction that closes a Substring Filter
1408      */
1409     private final GrammarAction substringsFilterClose = new GrammarAction( "Close Substring Filter" )
1410     {
1411         /**
1412          * {@inheritDoc}
1413          */
1414         @Override
1415         public void action( Dsmlv2Container container ) throws XmlPullParserException
1416         {
1417             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1418                 container.getBatchRequest().getCurrentRequest();
1419 
1420             searchRequestDecorator.setTerminalFilter( null );
1421         }
1422     };
1423 
1424     /**
1425      * GrammarAction that create a And Filter
1426      */
1427     private final GrammarAction andFilterCreation = new GrammarAction( "Create And Filter" )
1428     {
1429         /**
1430          * {@inheritDoc}
1431          */
1432         @Override
1433         public void action( Dsmlv2Container container ) throws XmlPullParserException
1434         {
1435             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1436                 container.getBatchRequest().getCurrentRequest();
1437 
1438             XmlPullParser xpp = container.getParser();
1439 
1440             AndFilter filter = new AndFilter();
1441 
1442             // Adding the filter to the Search Filter
1443             try
1444             {
1445                 searchRequestDecorator.addCurrentFilter( filter );
1446             }
1447             catch ( DecoderException de )
1448             {
1449                 throw new XmlPullParserException( de.getMessage(), xpp, de );
1450             }
1451         }
1452     };
1453 
1454     /**
1455      * GrammarAction that closes a Connector Filter (And, Or, Not)
1456      */
1457     private final GrammarAction connectorFilterClose = new GrammarAction( "Close Connector Filter" )
1458     {
1459         /**
1460          * {@inheritDoc}
1461          */
1462         @Override
1463         public void action( Dsmlv2Container container ) throws XmlPullParserException
1464         {
1465             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1466                 container.getBatchRequest().getCurrentRequest();
1467 
1468             searchRequestDecorator.endCurrentConnectorFilter();
1469         }
1470     };
1471 
1472     /**
1473      * GrammarAction that create a Or Filter
1474      */
1475     private final GrammarAction orFilterCreation = new GrammarAction( "Create Or Filter" )
1476     {
1477         /**
1478          * {@inheritDoc}
1479          */
1480         @Override
1481         public void action( Dsmlv2Container container ) throws XmlPullParserException
1482         {
1483             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1484                 container.getBatchRequest().getCurrentRequest();
1485 
1486             XmlPullParser xpp = container.getParser();
1487 
1488             OrFilter filter = new OrFilter();
1489 
1490             // Adding the filter to the Search Filter
1491             try
1492             {
1493                 searchRequestDecorator.addCurrentFilter( filter );
1494             }
1495             catch ( DecoderException de )
1496             {
1497                 throw new XmlPullParserException( de.getMessage(), xpp, de );
1498             }
1499         }
1500     };
1501 
1502     /**
1503      * GrammarAction that create a Not Filter
1504      */
1505     private final GrammarAction notFilterCreation = new GrammarAction( "Create Not Filter" )
1506     {
1507         /**
1508          * {@inheritDoc}
1509          */
1510         @Override
1511         public void action( Dsmlv2Container container ) throws XmlPullParserException
1512         {
1513             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1514                 container.getBatchRequest().getCurrentRequest();
1515 
1516             XmlPullParser xpp = container.getParser();
1517 
1518             NotFilter filter = new NotFilter();
1519 
1520             // Adding the filter to the Search Filter
1521             try
1522             {
1523                 searchRequestDecorator.addCurrentFilter( filter );
1524             }
1525             catch ( DecoderException de )
1526             {
1527                 throw new XmlPullParserException( de.getMessage(), xpp, de );
1528             }
1529         }
1530     };
1531 
1532     /**
1533      * GrammarAction that create a Equality Match Filter
1534      */
1535     private final GrammarAction equalityMatchFilterCreation = new GrammarAction( "Create Equality Match Filter" )
1536     {
1537         /**
1538          * {@inheritDoc}
1539          */
1540         @Override
1541         public void action( Dsmlv2Container container ) throws XmlPullParserException
1542         {
1543             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1544                 container.getBatchRequest().getCurrentRequest();
1545 
1546             XmlPullParser xpp = container.getParser();
1547 
1548             AttributeValueAssertion assertion = new AttributeValueAssertion();
1549 
1550             // Checking and adding the filter's attributes
1551             String attributeName = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NAME );
1552 
1553             if ( attributeName != null )
1554             {
1555                 assertion.setAttributeDesc( attributeName );
1556             }
1557             else
1558             {
1559                 throw new XmlPullParserException( I18n.err( I18n.ERR_03002_NAME_ATTRIBUTE_REQUIRED ), xpp, null );
1560             }
1561 
1562             AttributeValueAssertionFilter filter = new AttributeValueAssertionFilter(
1563                 LdapCodecConstants.EQUALITY_MATCH_FILTER );
1564 
1565             filter.setAssertion( assertion );
1566 
1567             // Adding the filter to the Search Filter
1568             try
1569             {
1570                 searchRequestDecorator.addCurrentFilter( filter );
1571             }
1572             catch ( DecoderException de )
1573             {
1574                 throw new XmlPullParserException( de.getMessage(), xpp, de );
1575             }
1576 
1577             searchRequestDecorator.setTerminalFilter( filter );
1578         }
1579     };
1580 
1581     /**
1582      * GrammarAction that create a Greater Or Equal Filter
1583      */
1584     private final GrammarAction greaterOrEqualFilterCreation = new GrammarAction( "Create Greater Or Equal Filter" )
1585     {
1586         /**
1587          * {@inheritDoc}
1588          */
1589         @Override
1590         public void action( Dsmlv2Container container ) throws XmlPullParserException
1591         {
1592             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1593                 container.getBatchRequest().getCurrentRequest();
1594 
1595             XmlPullParser xpp = container.getParser();
1596 
1597             AttributeValueAssertion assertion = new AttributeValueAssertion();
1598 
1599             // Checking and adding the filter's attributes
1600             String attributeName = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NAME );
1601 
1602             if ( attributeName != null )
1603             {
1604                 assertion.setAttributeDesc( attributeName );
1605             }
1606             else
1607             {
1608                 throw new XmlPullParserException( I18n.err( I18n.ERR_03002_NAME_ATTRIBUTE_REQUIRED ), xpp, null );
1609             }
1610 
1611             AttributeValueAssertionFilter filter = new AttributeValueAssertionFilter(
1612                 LdapCodecConstants.GREATER_OR_EQUAL_FILTER );
1613 
1614             filter.setAssertion( assertion );
1615 
1616             // Adding the filter to the Search Filter
1617             try
1618             {
1619                 searchRequestDecorator.addCurrentFilter( filter );
1620             }
1621             catch ( DecoderException de )
1622             {
1623                 throw new XmlPullParserException( de.getMessage(), xpp, de );
1624             }
1625 
1626             searchRequestDecorator.setTerminalFilter( filter );
1627         }
1628     };
1629 
1630     /**
1631      * GrammarAction that create a Less Or Equal Filter
1632      */
1633     private final GrammarAction lessOrEqualFilterCreation = new GrammarAction( "Create Less Or Equal Filter" )
1634     {
1635         /**
1636          * {@inheritDoc}
1637          */
1638         @Override
1639         public void action( Dsmlv2Container container ) throws XmlPullParserException
1640         {
1641             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1642                 container.getBatchRequest().getCurrentRequest();
1643 
1644             XmlPullParser xpp = container.getParser();
1645 
1646             AttributeValueAssertion assertion = new AttributeValueAssertion();
1647 
1648             // Checking and adding the filter's attributes
1649             String attributeValue;
1650             // name
1651             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NAME );
1652 
1653             if ( attributeValue != null )
1654             {
1655                 assertion.setAttributeDesc( attributeValue );
1656             }
1657             else
1658             {
1659                 throw new XmlPullParserException( I18n.err( I18n.ERR_03002_NAME_ATTRIBUTE_REQUIRED ), xpp, null );
1660             }
1661 
1662             AttributeValueAssertionFilter filter = new AttributeValueAssertionFilter(
1663                 LdapCodecConstants.LESS_OR_EQUAL_FILTER );
1664 
1665             filter.setAssertion( assertion );
1666 
1667             // Adding the filter to the Search Filter
1668             try
1669             {
1670                 searchRequestDecorator.addCurrentFilter( filter );
1671             }
1672             catch ( DecoderException de )
1673             {
1674                 throw new XmlPullParserException( de.getMessage(), xpp, de );
1675             }
1676 
1677             searchRequestDecorator.setTerminalFilter( filter );
1678         }
1679     };
1680 
1681     /**
1682      * GrammarAction that create an Approx Match Filter
1683      */
1684     private final GrammarAction approxMatchFilterCreation = new GrammarAction( "Create Approx Match Filter" )
1685     {
1686         /**
1687          * {@inheritDoc}
1688          */
1689         @Override
1690         public void action( Dsmlv2Container container ) throws XmlPullParserException
1691         {
1692             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1693                 container.getBatchRequest().getCurrentRequest();
1694 
1695             XmlPullParser xpp = container.getParser();
1696 
1697             AttributeValueAssertion assertion = new AttributeValueAssertion();
1698 
1699             // Checking and adding the filter's attributes
1700             String attributeName = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NAME );
1701 
1702             if ( attributeName != null )
1703             {
1704                 assertion.setAttributeDesc( attributeName );
1705             }
1706             else
1707             {
1708                 throw new XmlPullParserException( I18n.err( I18n.ERR_03002_NAME_ATTRIBUTE_REQUIRED ), xpp, null );
1709             }
1710 
1711             AttributeValueAssertionFilter filter = new AttributeValueAssertionFilter(
1712                 LdapCodecConstants.APPROX_MATCH_FILTER );
1713 
1714             filter.setAssertion( assertion );
1715 
1716             // Adding the filter to the Search Filter
1717             try
1718             {
1719                 searchRequestDecorator.addCurrentFilter( filter );
1720             }
1721             catch ( DecoderException de )
1722             {
1723                 throw new XmlPullParserException( de.getMessage(), xpp, de );
1724             }
1725 
1726             searchRequestDecorator.setTerminalFilter( filter );
1727         }
1728     };
1729 
1730     /**
1731      * GrammarAction that adds a Value to a Filter
1732      */
1733     private final GrammarAction filterAddValue = new GrammarAction( "Adds Value to Filter" )
1734     {
1735         /**
1736          * {@inheritDoc}
1737          */
1738         @Override
1739         public void action( Dsmlv2Container container ) throws XmlPullParserException
1740         {
1741             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1742                 container.getBatchRequest().getCurrentRequest();
1743             AttributeValueAssertionFilter filter = ( AttributeValueAssertionFilter ) searchRequestDecorator
1744                 .getTerminalFilter();
1745             AttributeValueAssertion assertion = filter.getAssertion();
1746 
1747             XmlPullParser xpp = container.getParser();
1748 
1749             try
1750             {
1751                 // We have to catch the type Attribute Value before going to the next Text node
1752                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
1753 
1754                 // Getting the value
1755                 String nextText = xpp.nextText();
1756 
1757                 if ( !Strings.isEmpty( nextText ) )
1758                 {
1759                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
1760                     {
1761                         Value value = new Value( Base64.getDecoder().decode( nextText.trim() ) );
1762                         assertion.setAssertionValue( value );
1763                     }
1764                     else
1765                     {
1766                         Value value = new Value( nextText.trim() );
1767                         assertion.setAssertionValue( value );
1768                     }
1769                 }
1770             }
1771             catch ( IOException ioe )
1772             {
1773                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008_UNEXPECTED_ERROR, ioe.getMessage() ), xpp, ioe );
1774             }
1775         }
1776     };
1777 
1778     /**
1779      * GrammarAction that creates a Present Filter
1780      */
1781     private final GrammarAction presentFilterCreation = new GrammarAction( "Create Present Filter" )
1782     {
1783         /**
1784          * {@inheritDoc}
1785          */
1786         @Override
1787         public void action( Dsmlv2Container container ) throws XmlPullParserException
1788         {
1789             PresentFilter presentFilter = new PresentFilter();
1790 
1791             XmlPullParser xpp = container.getParser();
1792 
1793             // Adding the filter to the Search Filter
1794             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1795                 container.getBatchRequest().getCurrentRequest();
1796 
1797             try
1798             {
1799                 searchRequestDecorator.addCurrentFilter( presentFilter );
1800             }
1801             catch ( DecoderException de )
1802             {
1803                 throw new XmlPullParserException( de.getMessage(), xpp, de );
1804             }
1805 
1806             // Checking and adding the filter's attributes
1807             String attributeValue;
1808             // name
1809             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NAME );
1810 
1811             if ( attributeValue != null )
1812             {
1813                 presentFilter.setAttributeDescription( attributeValue );
1814             }
1815             else
1816             {
1817                 throw new XmlPullParserException( I18n.err( I18n.ERR_03002_NAME_ATTRIBUTE_REQUIRED ), xpp, null );
1818             }
1819         }
1820     };
1821 
1822     /**
1823      * GrammarAction that store the Filter into the searchRequest
1824      */
1825     private final GrammarAction storeFilter = new GrammarAction( "Store Filter" )
1826     {
1827         /**
1828          * {@inheritDoc}
1829          */
1830         @Override
1831         public void action( Dsmlv2Container container ) throws XmlPullParserException
1832         {
1833             // Adding the filter to the Search Filter
1834             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1835                 container.getBatchRequest().getCurrentRequest();
1836             SearchRequest searchRequest = searchRequestDecorator.getDecorated();
1837 
1838             try
1839             {
1840                 ExprNode exprNode = searchRequestDecorator.getFilterNode();
1841 
1842                 if ( exprNode == null )
1843                 {
1844                     throw new IllegalStateException( I18n.err( I18n.ERR_03041_NO_FILTER_ELEMENT ) );
1845                 }
1846 
1847                 searchRequest.setFilter( exprNode );
1848             }
1849             catch ( LdapSchemaException lse )
1850             {
1851 
1852             }
1853         }
1854     };
1855 
1856     /**
1857      * GrammarAction that creates an Extensible Match Filter
1858      */
1859     private final GrammarAction extensibleMatchFilterCreation = new GrammarAction( "Create Extensible Match Filter" )
1860     {
1861         /**
1862          * {@inheritDoc}
1863          */
1864         @Override
1865         public void action( Dsmlv2Container container ) throws XmlPullParserException
1866         {
1867             ExtensibleMatchFilter extensibleMatchFilter = new ExtensibleMatchFilter();
1868 
1869             XmlPullParser xpp = container.getParser();
1870 
1871             // Adding the filter to the Search Filter
1872             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1873                 container.getBatchRequest().getCurrentRequest();
1874 
1875             try
1876             {
1877                 searchRequestDecorator.addCurrentFilter( extensibleMatchFilter );
1878             }
1879             catch ( DecoderException de )
1880             {
1881                 throw new XmlPullParserException( I18n.err( I18n.ERR_03002_NAME_ATTRIBUTE_REQUIRED ), xpp, de );
1882             }
1883 
1884             searchRequestDecorator.setTerminalFilter( extensibleMatchFilter );
1885 
1886             // Checking and adding the filter's attributes
1887             String attributeValue;
1888             // dnAttributes
1889             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.DN_ATTRIBUTES );
1890 
1891             if ( attributeValue != null )
1892             {
1893                 if ( ( attributeValue.equals( DsmlLiterals.TRUE ) ) || ( "1".equals( attributeValue ) ) )
1894                 {
1895                     extensibleMatchFilter.setDnAttributes( true );
1896                 }
1897                 else if ( ( attributeValue.equals( DsmlLiterals.FALSE ) ) || ( "0".equals( attributeValue ) ) )
1898                 {
1899                     extensibleMatchFilter.setDnAttributes( false );
1900                 }
1901                 else
1902                 {
1903                     throw new XmlPullParserException( I18n.err( I18n.ERR_03033_DN_ATTRIBUTES_NOT_BOOLEAN ), xpp, null );
1904                 }
1905             }
1906             else
1907             {
1908                 extensibleMatchFilter.setDnAttributes( false );
1909             }
1910 
1911             // matchingRule
1912             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING,  DsmlLiterals.MATCHING_RULE );
1913 
1914             if ( attributeValue != null )
1915             {
1916                 extensibleMatchFilter.setMatchingRule( attributeValue );
1917             }
1918 
1919             // name
1920             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.NAME );
1921 
1922             if ( attributeValue != null )
1923             {
1924                 extensibleMatchFilter.setType( attributeValue );
1925             }
1926         }
1927     };
1928 
1929     /**
1930      * GrammarAction that adds a Value to an Extensible Match Filter
1931      */
1932     private final GrammarAction extensibleMatchAddValue = new GrammarAction( "Adds Value to Extensible MatchFilter" )
1933     {
1934         /**
1935          * {@inheritDoc}
1936          */
1937         @Override
1938         public void action( Dsmlv2Container container ) throws XmlPullParserException
1939         {
1940             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
1941                 container.getBatchRequest().getCurrentRequest();
1942             ExtensibleMatchFilter filter = ( ExtensibleMatchFilter ) searchRequestDecorator.getTerminalFilter();
1943 
1944             XmlPullParser xpp = container.getParser();
1945 
1946             try
1947             {
1948                 // We have to catch the type Attribute Value before going to the next Text node
1949                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
1950 
1951                 // Getting the value
1952                 String nextText = xpp.nextText();
1953 
1954                 if ( !Strings.isEmpty( nextText ) )
1955                 {
1956                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
1957                     {
1958                         filter.setMatchValue( new Value( Base64.getDecoder().decode( nextText.trim() ) ) );
1959                     }
1960                     else
1961                     {
1962                         filter.setMatchValue( new Value( nextText.trim() ) );
1963                     }
1964                 }
1965             }
1966             catch ( IOException ioe )
1967             {
1968                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008_UNEXPECTED_ERROR, ioe.getMessage() ), xpp, ioe );
1969             }
1970         }
1971     };
1972 
1973     /**
1974      * GrammarAction that creates a Control
1975      */
1976     private final GrammarAction controlCreation = new GrammarAction( "Create Control" )
1977     {
1978         /**
1979          * {@inheritDoc}
1980          */
1981         @Override
1982         public void action( Dsmlv2Container container ) throws XmlPullParserException
1983         {
1984             XmlPullParser xpp = container.getParser();
1985             Control control;
1986 
1987             // Checking and adding the Control's attributes
1988             String attributeValue;
1989             
1990             // TYPE
1991             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.TYPE );
1992 
1993             if ( attributeValue != null )
1994             {
1995                 if ( !Oid.isOid( attributeValue ) )
1996                 {
1997                     throw new XmlPullParserException( I18n.err( I18n.ERR_03034_INCORRECT_TYPE_VALUE ), xpp, null );
1998                 }
1999                 
2000                 ControlFactory<? extends Control> factory = codec.getRequestControlFactories().get( attributeValue );
2001                 
2002                 if ( factory == null )
2003                 {
2004                     control = new OpaqueControl( attributeValue );
2005                 }
2006                 else
2007                 {
2008                     control = factory.newControl();
2009                 }
2010                 
2011                 ( ( Request ) container.getBatchRequest().getCurrentRequest() ).addControl( control );
2012             }
2013             else
2014             {
2015                 throw new XmlPullParserException( I18n.err( I18n.ERR_03035_TYPE_ATTRIBUTE_REQUIRED ), xpp, null );
2016             }
2017 
2018             // CRITICALITY
2019             attributeValue = xpp.getAttributeValue( Strings.EMPTY_STRING, DsmlLiterals.CRITICALITY );
2020 
2021             if ( attributeValue != null )
2022             {
2023                 if ( attributeValue.equals( DsmlLiterals.TRUE ) )
2024                 {
2025                     control.setCritical( true );
2026                 }
2027                 else if ( attributeValue.equals( DsmlLiterals.FALSE ) )
2028                 {
2029                     control.setCritical( false );
2030                 }
2031                 else
2032                 {
2033                     throw new XmlPullParserException( I18n.err( I18n.ERR_03007_INCORRECT_CRITICALITY_VALUE ), xpp, null );
2034                 }
2035             }
2036         }
2037     };
2038 
2039     /**
2040      * GrammarAction that adds a Value to a Control
2041      */
2042     private final GrammarAction controlValueCreation = new GrammarAction( "Add ControlValue to Control" )
2043     {
2044         /**
2045          * {@inheritDoc}
2046          */
2047         @Override
2048         public void action( Dsmlv2Container container ) throws XmlPullParserException
2049         {
2050             AbstractRequestDsml<? extends Request> request =
2051                 ( AbstractRequestDsml<? extends Request> ) container.getBatchRequest().getCurrentRequest();
2052             DsmlControl<? extends Control> control = request.getCurrentControl();
2053 
2054             XmlPullParser xpp = container.getParser();
2055 
2056             try
2057             {
2058                 // We have to catch the type Attribute Value before going to the next Text node
2059                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
2060 
2061                 // Getting the value
2062                 String nextText = xpp.nextText();
2063 
2064                 if ( !Strings.isEmpty( nextText ) )
2065                 {
2066                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
2067                     {
2068                         control.setValue( Base64.getDecoder().decode( nextText.trim() ) );
2069                     }
2070                     else
2071                     {
2072                         control.setValue( Strings.getBytesUtf8( nextText.trim() ) );
2073                     }
2074                 }
2075             }
2076             catch ( IOException ioe )
2077             {
2078                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008_UNEXPECTED_ERROR, ioe.getMessage() ), xpp, ioe );
2079             }
2080         }
2081     };
2082 
2083 
2084     /**
2085      * Creates a new instance of Dsmlv2Grammar.
2086      */
2087     @SuppressWarnings("unchecked")
2088     public Dsmlv2Grammar()
2089     {
2090         name = Dsmlv2Grammar.class.getName();
2091 
2092         // Create the transitions table
2093         super.transitions = ( HashMap<Tag, GrammarTransition>[] ) Array.newInstance( HashMap.class, 200 );
2094 
2095         //====================================================
2096         //  Transitions concerning : BATCH REQUEST
2097         //====================================================
2098         super.transitions[Dsmlv2StatesEnum.INIT_GRAMMAR_STATE.ordinal()] = new HashMap<Tag, GrammarTransition>();
2099         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2100         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()] = new HashMap<Tag, GrammarTransition>();
2101         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2102 
2103         // ** OPEN BATCH REQUEST **
2104         // State: [INIT_GRAMMAR_STATE] - Tag: <batchRequest>
2105         super.transitions[Dsmlv2StatesEnum.INIT_GRAMMAR_STATE.ordinal()].put( new Tag( DsmlLiterals.BATCH_REQUEST, Tag.START ),
2106             new GrammarTransition( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE, Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
2107                 batchRequestCreation ) );
2108 
2109         // ** CLOSE BATCH REQUEST **
2110         // state: [BATCHREQUEST_START_TAG] - Tag: </batchRequest>
2111         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()]
2112             .put( new Tag( DsmlLiterals.BATCH_REQUEST, Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
2113                 Dsmlv2StatesEnum.BATCHREQUEST_END_TAG, null ) );
2114         //state: [BATCHREQUEST_LOOP] - Tag: </batchRequest>
2115         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( DsmlLiterals.BATCH_REQUEST, Tag.END ),
2116             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.GRAMMAR_END, null ) );
2117 
2118         // ** ABANDON REQUEST **
2119         // State: [BATCHREQUEST_START_TAG] - Tag: <abandonRequest>
2120         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
2121             new Tag( DsmlLiterals.ABANDON_REQUEST, Tag.START ),
2122             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG,
2123                 abandonRequestCreation ) );
2124         // state: [BATCHREQUEST_LOOP] - Tag: <abandonRequest>
2125         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( DsmlLiterals.ABANDON_REQUEST, Tag.START ),
2126             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG,
2127                 abandonRequestCreation ) );
2128 
2129         // ** ADD REQUEST **
2130         // state: [BATCHREQUEST_START_TAG] - Tag: <addRequest>
2131         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.ADD_REQUEST, Tag.START ),
2132             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.ADD_REQUEST_START_TAG,
2133                 addRequestCreation ) );
2134         // state: [BATCHREQUEST_LOOP] - Tag: <addRequest>
2135         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( DsmlLiterals.ADD_REQUEST, Tag.START ),
2136             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.ADD_REQUEST_START_TAG,
2137                 addRequestCreation ) );
2138 
2139         // ** AUTH REQUEST **
2140         // state: [BATCHREQUEST_START_TAG] - Tag: <authRequest>
2141         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.AUTH_REQUEST, Tag.START ),
2142             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG,
2143                 authRequestCreation ) );
2144 
2145         // ** COMPARE REQUEST **
2146         // state: [BATCHREQUEST_START_TAG] - Tag: <compareRequest>
2147         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
2148             new Tag( DsmlLiterals.COMPARE_REQUEST, Tag.START ),
2149             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG,
2150                 compareRequestCreation ) );
2151         // state: [BATCHREQUEST_LOOP] - Tag: <compareRequest>
2152         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( DsmlLiterals.COMPARE_REQUEST, Tag.START ),
2153             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG,
2154                 compareRequestCreation ) );
2155 
2156         // ** DEL REQUEST **
2157         // state: [BATCHREQUEST_START_TAG] - Tag: <delRequest>
2158         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.DEL_REQUEST, Tag.START ),
2159             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.DEL_REQUEST_START_TAG,
2160                 delRequestCreation ) );
2161         // state: [BATCHREQUEST_LOOP] - Tag: <delRequest>
2162         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( DsmlLiterals.DEL_REQUEST, Tag.START ),
2163             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.DEL_REQUEST_START_TAG,
2164                 delRequestCreation ) );
2165 
2166         // ** EXTENDED REQUEST **
2167         // state: [BATCHREQUEST_START_TAG] - Tag: <extendedRequest>
2168         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
2169             new Tag( DsmlLiterals.EXTENDED_REQUEST, Tag.START ),
2170             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
2171                 Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG, extendedRequestCreation ) );
2172         // state: [BATCHREQUEST_LOOP] - Tag: <extendedRequest>
2173         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( DsmlLiterals.EXTENDED_REQUEST, Tag.START ),
2174             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG,
2175                 extendedRequestCreation ) );
2176 
2177         // ** MOD Dn REQUEST **
2178         // state: [BATCHREQUEST_START_TAG] - Tag: <modDNRequest>
2179         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.MOD_DN_REQUEST, Tag.START ),
2180             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
2181                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG, modDNRequestCreation ) );
2182         // state: [BATCHREQUEST_LOOP] - Tag: <modDNRequest>
2183         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( DsmlLiterals.MOD_DN_REQUEST, Tag.START ),
2184             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG,
2185                 modDNRequestCreation ) );
2186 
2187         // ** MODIFY REQUEST **
2188         // state: [BATCHREQUEST_START_TAG] - Tag: <modifyRequest>
2189         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
2190             new Tag( DsmlLiterals.MODIFY_REQUEST, Tag.START ),
2191             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
2192                 modifyRequestCreation ) );
2193         // state: [BATCHREQUEST_LOOP] - Tag: <modifyRequest>
2194         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( DsmlLiterals.MODIFY_REQUEST, Tag.START ),
2195             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
2196                 modifyRequestCreation ) );
2197 
2198         // ** SEARCH REQUEST **
2199         // state: [BATCHREQUEST_START_TAG] - Tag: <searchRequest>
2200         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
2201             new Tag( DsmlLiterals.SEARCH_REQUEST, Tag.START ),
2202             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
2203                 searchRequestCreation ) );
2204         // state: [BATCHREQUEST_LOOP] - Tag: <searchRequest>
2205         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( DsmlLiterals.SEARCH_REQUEST, Tag.START ),
2206             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
2207                 searchRequestCreation ) );
2208 
2209         //====================================================
2210         //  Transitions concerning : ABANDON REQUEST
2211         //====================================================
2212         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2213         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2214         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2215         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2216 
2217         // State: [ABANDON_REQUEST_START_TAG] - Tag: </abandonRequest>
2218         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG.ordinal()]
2219             .put( new Tag( DsmlLiterals.ABANDON_REQUEST, Tag.END ), new GrammarTransition(
2220                 Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2221 
2222         // State: [ABANDON_REQUEST_START_TAG] - Tag: <control>
2223         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.START ),
2224             new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG,
2225                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG, controlCreation ) );
2226 
2227         // State: [ABANDON_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
2228         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG.ordinal()].put(
2229             new Tag( DsmlLiterals.CONTROL_VALUE, Tag.START ), new GrammarTransition(
2230                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG,
2231                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
2232 
2233         // State: [ABANDON_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
2234         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2235             Tag.END ),
2236             new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG,
2237                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG, null ) );
2238 
2239         // State: [ABANDON_REQUEST_CONTROL_START_TAG] - Tag: </control>
2240         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2241             Tag.END ),
2242             new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG,
2243                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG, null ) );
2244 
2245         // State: [ABANDON_REQUEST_CONTROL_END_TAG] - Tag: <control>
2246         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2247             Tag.START ),
2248             new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG,
2249                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG, controlCreation ) );
2250 
2251         // State: [ABANDON_REQUEST_CONTROL_END_TAG] - Tag: </abandonRequest>
2252         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.ABANDON_REQUEST,
2253             Tag.END ),
2254             new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG,
2255                 Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2256 
2257         //====================================================
2258         //  Transitions concerning : ADD REQUEST
2259         //====================================================
2260         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2261         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2262         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2263         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2264         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2265         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2266 
2267         // state: [ADD_REQUEST_START_TAG] -> Tag: </addRequest>
2268         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.ADD_REQUEST, Tag.END ),
2269             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2270 
2271         // State: [ADD_REQUEST_START_TAG] - Tag: <control>
2272         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.START ),
2273             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_START_TAG,
2274                 Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG, controlCreation ) );
2275 
2276         // State: [ADD_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
2277         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL_VALUE,
2278             Tag.START ),
2279             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG,
2280                 Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
2281 
2282         // State: [ADD_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
2283         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put(
2284             new Tag( DsmlLiterals.CONTROL, Tag.END ),
2285             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG,
2286                 Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG, null ) );
2287 
2288         // State: [ADD_REQUEST_CONTROL_START_TAG] - Tag: </control>
2289         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.END ),
2290             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG,
2291                 Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG, null ) );
2292 
2293         // State: [ADD_REQUEST_CONTROL_END_TAG] - Tag: <control>
2294         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.START ),
2295             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG,
2296                 Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG, controlCreation ) );
2297 
2298         // State: [ADD_REQUEST_CONTROL_END_TAG] - Tag: </addRequest>
2299         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()].put(
2300             new Tag( DsmlLiterals.ADD_REQUEST, Tag.END ),
2301             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
2302                 null ) );
2303 
2304         // State: [ADD_REQUEST_START_TAG] - Tag: <attr>
2305         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.ATTR, Tag.START ),
2306             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_START_TAG, Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG,
2307                 addRequestAddAttribute ) );
2308 
2309         // State: [ADD_REQUEST_CONTROL_END_TAG] - Tag: <attr>
2310         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.ATTR, Tag.START ),
2311             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG,
2312                 Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG, addRequestAddAttribute ) );
2313 
2314         // State: [ADD_REQUEST_ATTR_END_TAG] - Tag: <attr>
2315         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG.ordinal()].put( new Tag( DsmlLiterals.ATTR, Tag.START ),
2316             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG,
2317                 Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG, addRequestAddAttribute ) );
2318 
2319         // State: [ADD_REQUEST_ATTR_START_TAG] - Tag: </attr>
2320         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG.ordinal()].put( new Tag( DsmlLiterals.ATTR, Tag.END ),
2321             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG,
2322                 Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG, null ) );
2323 
2324         // State: [ADD_REQUEST_ATTR_START_TAG] - Tag: <value>
2325         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG.ordinal()].put( new Tag( DsmlLiterals.VALUE, Tag.START ),
2326             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG,
2327                 Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG, addRequestAddValue ) );
2328 
2329         // State: [ADD_REQUEST_ATTR_END_TAG] - Tag: </addRequest>
2330         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG.ordinal()]
2331             .put( new Tag( DsmlLiterals.ADD_REQUEST, Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG,
2332                 Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2333 
2334         //====================================================
2335         //  Transitions concerning : AUTH REQUEST
2336         //====================================================
2337         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2338         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2339         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2340         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2341 
2342         // state: [AUTH_REQUEST_START_TAG] -> Tag: </authRequest>
2343         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.AUTH_REQUEST, Tag.END ),
2344             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2345 
2346         // State: [AUTH_REQUEST_START_TAG] - Tag: <control>
2347         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.START ),
2348             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG,
2349                 Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG, controlCreation ) );
2350 
2351         // State: [AUTH_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
2352         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL_VALUE,
2353             Tag.START ),
2354             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG,
2355                 Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
2356 
2357         // State: [AUTH_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
2358         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2359             Tag.END ),
2360             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG,
2361                 Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG, null ) );
2362 
2363         // State: [AUTH_REQUEST_CONTROL_START_TAG] - Tag: </control>
2364         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG.ordinal()].put(
2365             new Tag( DsmlLiterals.CONTROL, Tag.END ),
2366             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG,
2367                 Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG, null ) );
2368 
2369         // State: [AUTH_REQUEST_CONTROL_END_TAG] - Tag: <control>
2370         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG.ordinal()].put(
2371             new Tag( DsmlLiterals.CONTROL, Tag.START ),
2372             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG,
2373                 Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG, controlCreation ) );
2374 
2375         // State: [AUTH_REQUEST_CONTROL_END_TAG] - Tag: </authRequest>
2376         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG.ordinal()].put(
2377             new Tag( DsmlLiterals.AUTH_REQUEST, Tag.END ),
2378             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
2379                 null ) );
2380 
2381         //====================================================
2382         //  Transitions concerning : COMPARE REQUEST
2383         //====================================================
2384         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2385         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2386         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2387         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2388         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2389         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2390         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2391 
2392         // State: [COMPARE_REQUEST_START_TAG] - Tag: <control>
2393         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.START ),
2394             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG,
2395                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG, controlCreation ) );
2396 
2397         // State: [COMPARE_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
2398         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG.ordinal()].put(
2399             new Tag( DsmlLiterals.CONTROL_VALUE, Tag.START ), new GrammarTransition(
2400                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG,
2401                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
2402 
2403         // State: [COMPARE_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
2404         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2405             Tag.END ),
2406             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG,
2407                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG, null ) );
2408 
2409         // State: [COMPARE_REQUEST_CONTROL_START_TAG] - Tag: </control>
2410         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2411             Tag.END ),
2412             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG,
2413                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG, null ) );
2414 
2415         // State: [COMPARE_REQUEST_CONTROL_END_TAG] - Tag: <control>
2416         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2417             Tag.START ),
2418             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG,
2419                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG, controlCreation ) );
2420 
2421         // State: [COMPARE_REQUEST_CONTROL_END_TAG] - Tag: </compareRequest>
2422         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.COMPARE_REQUEST,
2423             Tag.END ),
2424             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG,
2425                 Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2426 
2427         // State: [COMPARE_REQUEST_START_TAG] - Tag: <assertion>
2428         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.ASSERTION, Tag.START ),
2429             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG,
2430                 Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG, compareRequestAddAssertion ) );
2431 
2432         // State: [COMPARE_REQUEST_CONTROL_END_TAG] - Tag: <assertion>
2433         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.ASSERTION,
2434             Tag.START ),
2435             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG,
2436                 Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG, compareRequestAddAssertion ) );
2437 
2438         // State: [COMPARE_REQUEST_ASSERTION_START_TAG] - Tag: <value>
2439         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG.ordinal()].put( new Tag( DsmlLiterals.VALUE,
2440             Tag.START ),
2441             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG,
2442                 Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG, compareRequestAddValue ) );
2443 
2444         //State: [COMPARE_REQUEST_VALUE_END_TAG] - Tag: </assertion>
2445         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG.ordinal()].put(
2446             new Tag( DsmlLiterals.ASSERTION, Tag.END ),
2447             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG,
2448                 Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG, null ) );
2449 
2450         // State: [COMPARE_REQUEST_ASSERTION_END_TAG] - Tag: </compareRequest>
2451         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG.ordinal()].put(
2452             new Tag( DsmlLiterals.COMPARE_REQUEST, Tag.END ), new GrammarTransition(
2453                 Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2454 
2455         //====================================================
2456         //  Transitions concerning : DEL REQUEST
2457         //====================================================
2458         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2459         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2460         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2461         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2462 
2463         // State: [DEL_REQUEST_START_TAG] - Tag: </delRequest>
2464         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.DEL_REQUEST, Tag.END ),
2465             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2466 
2467         // State: [DEL_REQUEST_START_TAG] - Tag: <control>
2468         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.START ),
2469             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_START_TAG,
2470                 Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG, controlCreation ) );
2471 
2472         // State: [DEL_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
2473         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL_VALUE,
2474             Tag.START ),
2475             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG,
2476                 Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
2477 
2478         // State: [DEL_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
2479         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put(
2480             new Tag( DsmlLiterals.CONTROL, Tag.END ),
2481             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG,
2482                 Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG, null ) );
2483 
2484         // State: [DEL_REQUEST_CONTROL_START_TAG] - Tag: </control>
2485         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.END ),
2486             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG,
2487                 Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG, null ) );
2488 
2489         // State: [DEL_REQUEST_CONTROL_END_TAG] - Tag: <control>
2490         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.START ),
2491             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG,
2492                 Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG, controlCreation ) );
2493 
2494         // State: [DEL_REQUEST_CONTROL_END_TAG] - Tag: </delRequest>
2495         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG.ordinal()].put(
2496             new Tag( DsmlLiterals.DEL_REQUEST, Tag.END ),
2497             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
2498                 null ) );
2499 
2500         //====================================================
2501         //  Transitions concerning : EXTENDED REQUEST
2502         //====================================================
2503         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2504         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2505         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2506         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2507         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2508         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2509 
2510         // State: [EXTENDED_REQUEST_START_TAG] - Tag: <control>
2511         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.START ),
2512             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG,
2513                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG, controlCreation ) );
2514 
2515         // State: [EXTENDED_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
2516         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG.ordinal()].put(
2517             new Tag( DsmlLiterals.CONTROL_VALUE, Tag.START ), new GrammarTransition(
2518                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG,
2519                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
2520 
2521         // State: [EXTENDED_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
2522         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2523             Tag.END ),
2524             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG,
2525                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG, null ) );
2526 
2527         // State: [EXTENDED_REQUEST_CONTROL_START_TAG] - Tag: </control>
2528         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2529             Tag.END ),
2530             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG,
2531                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG, null ) );
2532 
2533         // State: [EXTENDED_REQUEST_CONTROL_END_TAG] - Tag: <control>
2534         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2535             Tag.START ),
2536             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG,
2537                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG, controlCreation ) );
2538 
2539         // State: [EXTENDED_REQUEST_CONTROL_END_TAG] - Tag: </extendedRequest>
2540         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()].put(
2541             new Tag( DsmlLiterals.EXTENDED_REQUEST, Tag.END ), new GrammarTransition(
2542                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2543 
2544         // State: [EXTENDED_REQUEST_START_TAG] - Tag: <requestName>
2545         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG.ordinal()].put(
2546             new Tag( DsmlLiterals.REQUEST_NAME, Tag.START ),
2547             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG,
2548                 Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG, extendedRequestAddName ) );
2549 
2550         // State: [EXTENDED_REQUEST_CONTROL_END_TAG] - Tag: <requestName>
2551         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.REQUEST_NAME,
2552             Tag.START ),
2553             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG,
2554                 Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG, extendedRequestAddName ) );
2555 
2556         // State: [EXTENDED_REQUEST_REQUESTNAME_END_TAG] - Tag: </extendedRequest>
2557         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG.ordinal()].put( new Tag(
2558             DsmlLiterals.EXTENDED_REQUEST,
2559             Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG,
2560             Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2561 
2562         // State: [EXTENDED_REQUEST_REQUESTNAME_END_TAG] - Tag: <requestValue>
2563         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG.ordinal()].put( new Tag(
2564             DsmlLiterals.REQUEST_VALUE,
2565             Tag.START ), new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG,
2566             Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG, extendedRequestAddValue ) );
2567 
2568         // State: [EXTENDED_REQUEST_REQUESTVALUE_END_TAG] - Tag: </requestRequest>
2569         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG.ordinal()].put( new Tag(
2570             DsmlLiterals.EXTENDED_REQUEST,
2571             Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG,
2572             Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2573 
2574         //====================================================
2575         //  Transitions concerning : MODIFY Dn REQUEST
2576         //====================================================
2577         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2578         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2579         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2580         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2581 
2582         // State: [MODIFY_DN_REQUEST_START_TAG] - Tag: </modDNRequest>
2583         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG.ordinal()].put(
2584             new Tag( DsmlLiterals.MOD_DN_REQUEST, Tag.END ),
2585             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
2586                 null ) );
2587 
2588         // State: [MODIFY_DN_REQUEST_START_TAG] - Tag: <control>
2589         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.START ),
2590             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG,
2591                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG, controlCreation ) );
2592 
2593         // State: [MODIFY_DN_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
2594         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG.ordinal()].put(
2595             new Tag( DsmlLiterals.CONTROL_VALUE, Tag.START ), new GrammarTransition(
2596                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG,
2597                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
2598 
2599         // State: [MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
2600         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2601             Tag.END ),
2602             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG,
2603                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG, null ) );
2604 
2605         // State: [MODIFY_DN_REQUEST_CONTROL_START_TAG] - Tag: </control>
2606         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2607             Tag.END ),
2608             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG,
2609                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG, null ) );
2610 
2611         // State: [MODIFY_DN_REQUEST_CONTROL_END_TAG] - Tag: <control>
2612         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2613             Tag.START ),
2614             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG,
2615                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG, controlCreation ) );
2616 
2617         // State: [MODIFY_DN_REQUEST_CONTROL_END_TAG] - Tag: </modDNRequest>
2618         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.MOD_DN_REQUEST,
2619             Tag.END ),
2620             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG,
2621                 Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2622 
2623         //====================================================
2624         //  Transitions concerning : MODIFY REQUEST
2625         //====================================================
2626         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2627         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2628         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2629         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2630         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2631         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2632         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2633 
2634         // State: [MODIFY_REQUEST_START_TAG] - Tag: </modifyRequest>
2635         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()]
2636             .put( new Tag( DsmlLiterals.MODIFY_REQUEST, Tag.END ), new GrammarTransition(
2637                 Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2638 
2639         // State: [MODIFY_REQUEST_START_TAG] - Tag: <control>
2640         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.START ),
2641             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
2642                 Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG, controlCreation ) );
2643 
2644         // State: [MODIFY_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
2645         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL_VALUE,
2646             Tag.START ),
2647             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG,
2648                 Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
2649 
2650         // State: [MODIFY_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
2651         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2652             Tag.END ),
2653             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG,
2654                 Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG, null ) );
2655 
2656         // State: [MODIFY_REQUEST_CONTROL_START_TAG] - Tag: </control>
2657         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG.ordinal()].put(
2658             new Tag( DsmlLiterals.CONTROL, Tag.END ),
2659             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG,
2660                 Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG, null ) );
2661 
2662         // State: [MODIFY_REQUEST_CONTROL_END_TAG] - Tag: <control>
2663         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()].put(
2664             new Tag( DsmlLiterals.CONTROL, Tag.START ),
2665             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG,
2666                 Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG, controlCreation ) );
2667 
2668         // State: [MODIFY_REQUEST_CONTROL_END_TAG] - Tag: </modifyRequest>
2669         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.MODIFY_REQUEST,
2670             Tag.END ),
2671             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
2672                 null ) );
2673 
2674         // State: [MODIFY_REQUEST_CONTROL_END_TAG] - Tag: <modification>
2675         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.MODIFICATION,
2676             Tag.START ),
2677             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG,
2678                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG, modifyRequestAddModification ) );
2679 
2680         // State: [MODIFY_REQUEST_START_TAG] - Tag: <modification>
2681         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()].put(
2682             new Tag( DsmlLiterals.MODIFICATION, Tag.START ),
2683             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
2684                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG, modifyRequestAddModification ) );
2685 
2686         // State: [MODIFY_REQUEST_MODIFICATION_END_TAG] - Tag: <modification>
2687         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG.ordinal()].put(
2688             new Tag( DsmlLiterals.MODIFICATION, Tag.START ), new GrammarTransition(
2689                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG,
2690                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG, modifyRequestAddModification ) );
2691 
2692         // State: [MODIFY_REQUEST_MODIFICATION_START_TAG] - Tag: </modification>
2693         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG.ordinal()].put(
2694             new Tag( DsmlLiterals.MODIFICATION, Tag.END ), new GrammarTransition(
2695                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG,
2696                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG, null ) );
2697 
2698         // State: [MODIFY_REQUEST_MODIFICATION_START_TAG] - Tag: <value>
2699         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG.ordinal()].put( new Tag( DsmlLiterals.VALUE,
2700             Tag.START ),
2701             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG,
2702                 Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG, modifyRequestAddValue ) );
2703 
2704         // State: [MODIFY_REQUEST_VALUE_END_TAG] - Tag: <value>
2705         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.VALUE, Tag.START ),
2706             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG,
2707                 Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG, modifyRequestAddValue ) );
2708 
2709         // State: [MODIFY_REQUEST_VALUE_END_TAG] - Tag: </modification>
2710         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.MODIFICATION,
2711             Tag.END ),
2712             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG,
2713                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG, null ) );
2714 
2715         // State: [MODIFY_REQUEST_MODIFICATION_END_TAG] - Tag: </modifyRequest>
2716         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG.ordinal()].put(
2717             new Tag( DsmlLiterals.MODIFY_REQUEST, Tag.END ), new GrammarTransition(
2718                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
2719 
2720         //====================================================
2721         //  Transitions concerning : SEARCH REQUEST
2722         //====================================================
2723         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2724         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2725         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2726         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2727         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2728         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2729         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2730         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2731 
2732         // State: [SEARCH_REQUEST_START_TAG] - Tag: <control>
2733         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL, Tag.START ),
2734             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
2735                 Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG, controlCreation ) );
2736 
2737         // State: [SEARCH_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
2738         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL_VALUE,
2739             Tag.START ),
2740             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG,
2741                 Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
2742 
2743         // State: [SEARCH_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
2744         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.CONTROL,
2745             Tag.END ),
2746             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG,
2747                 Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG, null ) );
2748 
2749         // State: [SEARCH_REQUEST_CONTROL_START_TAG] - Tag: </control>
2750         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG.ordinal()].put(
2751             new Tag( DsmlLiterals.CONTROL, Tag.END ),
2752             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG,
2753                 Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG, null ) );
2754 
2755         // State: [SEARCH_REQUEST_CONTROL_END_TAG] - Tag: <control>
2756         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()].put(
2757             new Tag( DsmlLiterals.CONTROL, Tag.START ),
2758             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG,
2759                 Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG, controlCreation ) );
2760 
2761         // State: [SEARCH_REQUEST_FILTER_END_TAG] - Tag: </searchRequest>
2762         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.SEARCH_REQUEST,
2763             Tag.END ),
2764             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
2765                 storeFilter ) );
2766 
2767         // State: [SEARCH_REQUEST_ATTRIBUTES_START_TAG] - Tag: </attributes>
2768         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG.ordinal()].put( new Tag( DsmlLiterals.ATTRIBUTES,
2769             Tag.END ),
2770             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG,
2771                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG, null ) );
2772 
2773         // State: [SEARCH_REQUEST_ATTRIBUTES_START_TAG] - Tag: <attribute>
2774         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG.ordinal()].put( new Tag( DsmlLiterals.ATTRIBUTE,
2775             Tag.START ),
2776             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG,
2777                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG, searchRequestAddAttribute ) );
2778 
2779         // State: [SEARCH_REQUEST_ATTRIBUTE_START_TAG] - Tag: </attribute>
2780         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG.ordinal()].put( new Tag( DsmlLiterals.ATTRIBUTE,
2781             Tag.END ),
2782             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG,
2783                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG, null ) );
2784 
2785         // State: [SEARCH_REQUEST_ATTRIBUTE_END_TAG] - Tag: <attribute>
2786         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.ATTRIBUTE,
2787             Tag.START ),
2788             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG,
2789                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG, searchRequestAddAttribute ) );
2790 
2791         // State: [SEARCH_REQUEST_ATTRIBUTE_END_TAG] - Tag: </attributes>
2792         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.ATTRIBUTES,
2793             Tag.END ),
2794             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG,
2795                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG, null ) );
2796 
2797         // State: [SEARCH_REQUEST_ATTRIBUTES_END_TAG] - Tag: </searchRequest>
2798         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG.ordinal()].put( new Tag( DsmlLiterals.SEARCH_REQUEST,
2799             Tag.END ),
2800             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG,
2801                 Dsmlv2StatesEnum.BATCHREQUEST_LOOP, storeFilter ) );
2802 
2803         //====================================================
2804         //  Transitions concerning : FILTER
2805         //====================================================
2806         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2807         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2808         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()] = new HashMap<Tag, GrammarTransition>();
2809         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2810         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_GREATEROREQUAL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2811         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_LESSOREQUAL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2812         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_APPROXMATCH_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2813         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_PRESENT_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2814         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2815         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2816         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
2817 
2818         // State: [SEARCH_REQUEST_START_TAG] - Tag: <filter>
2819         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG.ordinal()].put( new Tag( DsmlLiterals.FILTER, Tag.START ),
2820             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
2821                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG, null ) );
2822 
2823         // State: [SEARCH_REQUEST_CONTROL_END_TAG] - Tag: <filter>
2824         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()].put(
2825             new Tag( DsmlLiterals.FILTER, Tag.START ),
2826             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG,
2827                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG, null ) );
2828 
2829         //*** AND ***
2830         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <and>
2831         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( DsmlLiterals.AND, Tag.START ),
2832             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
2833                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, andFilterCreation ) );
2834 
2835         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <and>
2836         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( DsmlLiterals.AND, Tag.START ),
2837             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
2838                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, andFilterCreation ) );
2839 
2840         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: </and>
2841         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( DsmlLiterals.AND, Tag.END ),
2842             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
2843                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, connectorFilterClose ) );
2844 
2845         //*** OR ***
2846         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <or>
2847         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( DsmlLiterals.OR, Tag.START ),
2848             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
2849                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, orFilterCreation ) );
2850 
2851         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <or>
2852         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( DsmlLiterals.OR, Tag.START ),
2853             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
2854                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, orFilterCreation ) );
2855 
2856         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: </or>
2857         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( DsmlLiterals.OR, Tag.END ),
2858             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
2859                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, connectorFilterClose ) );
2860 
2861         //*** NOT ***
2862         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <not>
2863         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( DsmlLiterals.NOT, Tag.START ),
2864             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
2865                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, notFilterCreation ) );
2866 
2867         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <not>
2868         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( DsmlLiterals.NOT, Tag.START ),
2869             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
2870                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, notFilterCreation ) );
2871 
2872         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: </not>
2873         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( DsmlLiterals.NOT, Tag.END ),
2874             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
2875                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, connectorFilterClose ) );
2876 
2877         //*** DsmlLiterals.SUBSTRINGS ***
2878         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <substrings>
2879         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( DsmlLiterals.SUBSTRINGS,
2880             Tag.START ),
2881             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
2882                 Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG, substringsFilterCreation ) );
2883 
2884         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <substrings>
2885         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put(
2886             new Tag( DsmlLiterals.SUBSTRINGS, Tag.START ),
2887             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
2888                 Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG, substringsFilterCreation ) );
2889 
2890         //*** EQUALITY MATCH ***
2891         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <equalityMatch>
2892         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( DsmlLiterals.EQUALITY_MATCH,
2893             Tag.START ),
2894             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
2895                 Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG, equalityMatchFilterCreation ) );
2896 
2897         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <equalityMatch>
2898         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( DsmlLiterals.EQUALITY_MATCH,
2899             Tag.START ),
2900             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
2901                 Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG, equalityMatchFilterCreation ) );
2902 
2903         // State: [SEARCH_REQUEST_EQUALITYMATCH_START_TAG] - Tag: <value>
2904         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG.ordinal()].put( new Tag( DsmlLiterals.VALUE,
2905             Tag.START ),
2906             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG,
2907                 Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG, filterAddValue ) );
2908 
2909         // State: [SEARCH_REQUEST_VALUE_END_TAG] - Tag: </equalityMatch>
2910         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.EQUALITY_MATCH,
2911             Tag.END ),
2912             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG,
2913                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
2914 
2915         //*** GREATER OR EQUAL ***
2916         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <greaterOrEqual>
2917         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put(
2918             new Tag( DsmlLiterals.GREATER_OR_EQUAL, Tag.START ), new GrammarTransition(
2919                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
2920                 Dsmlv2StatesEnum.SEARCH_REQUEST_GREATEROREQUAL_START_TAG, greaterOrEqualFilterCreation ) );
2921 
2922         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <greaterOrEqual>
2923         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( DsmlLiterals.GREATER_OR_EQUAL,
2924             Tag.START ),
2925             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
2926                 Dsmlv2StatesEnum.SEARCH_REQUEST_GREATEROREQUAL_START_TAG, greaterOrEqualFilterCreation ) );
2927 
2928         // State: [SEARCH_REQUEST_GREATEROREQUAL_START_TAG] - Tag: <value>
2929         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_GREATEROREQUAL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.VALUE,
2930             Tag.START ),
2931             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_GREATEROREQUAL_START_TAG,
2932                 Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG, filterAddValue ) );
2933 
2934         // State: [SEARCH_REQUEST_VALUE_END_TAG] - Tag: </greaterOrEqual>
2935         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG.ordinal()].put( new Tag( DsmlLiterals.GREATER_OR_EQUAL,
2936             Tag.END ),
2937             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG,
2938                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
2939 
2940         //*** LESS OR EQUAL ***
2941         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <lessOrEqual>
2942         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( DsmlLiterals.LESS_OR_EQUAL,
2943             Tag.START ),
2944             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
2945                 Dsmlv2StatesEnum.SEARCH_REQUEST_LESSOREQUAL_START_TAG, lessOrEqualFilterCreation ) );
2946 
2947         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <lessOrEqual>
2948         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put(
2949             new Tag( DsmlLiterals.LESS_OR_EQUAL, Tag.START ),
2950             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
2951                 Dsmlv2StatesEnum.SEARCH_REQUEST_LESSOREQUAL_START_TAG, lessOrEqualFilterCreation ) );
2952 
2953         // State: [SEARCH_REQUEST_LESSOREQUAL_START_TAG] - Tag: <value>
2954         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_LESSOREQUAL_START_TAG.ordinal()].put( new Tag( DsmlLiterals.VALUE,
2955             Tag.START ),
2956             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_LESSOREQUAL_START_TAG,
2957                 Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG, filterAddValue ) );
2958 
2959         // State: [SEARCH_REQUEST_VALUE_END_TAG] - Tag: </lessOrEqual>
2960         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG.ordinal()].put(
2961             new Tag( DsmlLiterals.LESS_OR_EQUAL, Tag.END ),
2962             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG,
2963                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
2964 
2965         //*** LESS OR EQUAL ***
2966         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <approxMatch>
2967         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( DsmlLiterals.APPROX_MATCH,
2968             Tag.START ),
2969             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
2970                 Dsmlv2StatesEnum.SEARCH_REQUEST_APPROXMATCH_START_TAG, approxMatchFilterCreation ) );
2971 
2972         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <approxMatch>
2973         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put(
2974             new Tag( DsmlLiterals.APPROX_MATCH, Tag.START ),
2975             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
2976                 Dsmlv2StatesEnum.SEARCH_REQUEST_APPROXMATCH_START_TAG, approxMatchFilterCreation ) );
2977 
2978         // State: [SEARCH_REQUEST_APPROXMATCH_START_TAG] - Tag: <value>
2979         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_APPROXMATCH_START_TAG.ordinal()].put( new Tag( DsmlLiterals.VALUE,
2980             Tag.START ),
2981             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_APPROXMATCH_START_TAG,
2982                 Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG, filterAddValue ) );
2983 
2984         // State: [SEARCH_REQUEST_VALUE_END_TAG] - Tag: </approxMatch>
2985         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG.ordinal()].put(
2986             new Tag( DsmlLiterals.APPROX_MATCH, Tag.END ),
2987             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG,
2988                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
2989 
2990         //*** PRESENT ***
2991         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <present>
2992         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( DsmlLiterals.PRESENT,
2993             Tag.START ),
2994             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
2995                 Dsmlv2StatesEnum.SEARCH_REQUEST_PRESENT_START_TAG, presentFilterCreation ) );
2996 
2997         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <present>
2998         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( DsmlLiterals.PRESENT, Tag.START ),
2999             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
3000                 Dsmlv2StatesEnum.SEARCH_REQUEST_PRESENT_START_TAG, presentFilterCreation ) );
3001 
3002         // State: [SEARCH_REQUEST_PRESENT_START_TAG] - Tag: </present>
3003         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_PRESENT_START_TAG.ordinal()].put(
3004             new Tag( DsmlLiterals.PRESENT, Tag.END ),
3005             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_PRESENT_START_TAG,
3006                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
3007 
3008         //*** EXTENSIBLE MATCH ***
3009         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <extensibleMatch>
3010         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put(
3011             new Tag( DsmlLiterals.EXTENSIBLE_MATCH, Tag.START ), new GrammarTransition(
3012                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
3013                 Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG, extensibleMatchFilterCreation ) );
3014 
3015         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <extensibleMatch>
3016         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( DsmlLiterals.EXTENSIBLE_MATCH,
3017             Tag.START ),
3018             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
3019                 Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG, extensibleMatchFilterCreation ) );
3020 
3021         // State: [SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG] - Tag: <value>
3022         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG.ordinal()].put(
3023             new Tag( DsmlLiterals.VALUE, Tag.START ), new GrammarTransition(
3024                 Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG,
3025                 Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG, extensibleMatchAddValue ) );
3026 
3027         // State: [SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG] - Tag: </extensibleMatch>
3028         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG.ordinal()].put( new Tag(
3029             DsmlLiterals.EXTENSIBLE_MATCH, Tag.END ), new GrammarTransition(
3030             Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG, Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
3031             null ) );
3032 
3033         //*** Filter (end) ***
3034         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: </filter>
3035         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( DsmlLiterals.FILTER, Tag.END ),
3036             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
3037                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG, null ) );
3038 
3039         // State: [SEARCH_REQUEST_FILTER_END_TAG] - Tag: <attributes>
3040         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG.ordinal()].put( new Tag( DsmlLiterals.ATTRIBUTES,
3041             Tag.START ),
3042             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG,
3043                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG, null ) );
3044 
3045         // State: [SEARCH_REQUEST_FILTER_END_TAG] - Tag: </searchRequest>
3046         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG.ordinal()].put( new Tag( DsmlLiterals.SEARCH_REQUEST,
3047             Tag.END ),
3048             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
3049                 storeFilter ) );
3050 
3051         //====================================================
3052         //  Transitions concerning : SUBSTRING FILTER
3053         //====================================================
3054         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
3055         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
3056         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
3057         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
3058         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
3059 
3060         // State: [SEARCH_REQUEST_SUBSTRINGS_START_TAG] - Tag: </substrings>
3061         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG.ordinal()].put( new Tag( DsmlLiterals.SUBSTRINGS,
3062             Tag.END ),
3063             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG,
3064                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
3065 
3066         // State: [SEARCH_REQUEST_SUBSTRINGS_START_TAG] - Tag: <initial>
3067         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG.ordinal()].put( new Tag( DsmlLiterals.INITIAL,
3068             Tag.START ),
3069             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG,
3070                 Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG, substringsFilterSetInitial ) );
3071 
3072         // State: [SEARCH_REQUEST_INITIAL_END_TAG] - Tag: <any>
3073         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.ANY, Tag.START ),
3074             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG,
3075                 Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG, substringsFilterAddAny ) );
3076 
3077         // State: [SEARCH_REQUEST_INITIAL_END_TAG] - Tag: <final>
3078         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG.ordinal()].put(
3079             new Tag( DsmlLiterals.FINAL, Tag.START ),
3080             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG,
3081                 Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG, substringsFilterSetFinal ) );
3082 
3083         // State: [SEARCH_REQUEST_INITIAL_END_TAG] - Tag: </substrings>
3084         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG.ordinal()].put( new Tag( DsmlLiterals.SUBSTRINGS,
3085             Tag.END ),
3086             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG,
3087                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, substringsFilterClose ) );
3088 
3089         // State: [SEARCH_REQUEST_SUBSTRINGS_START_TAG] - Tag: <any>
3090         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG.ordinal()].put( new Tag( DsmlLiterals.ANY,
3091             Tag.START ),
3092             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG,
3093                 Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG, substringsFilterAddAny ) );
3094 
3095         // State: [SEARCH_REQUEST_ANY_END_TAG] - Tag: </any>
3096         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG.ordinal()].put( new Tag( DsmlLiterals.ANY, Tag.START ),
3097             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG,
3098                 Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG, substringsFilterAddAny ) );
3099 
3100         // State: [SEARCH_REQUEST_ANY_END_TAG] - Tag: <final>
3101         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG.ordinal()].put( new Tag( DsmlLiterals.FINAL, Tag.START ),
3102             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG,
3103                 Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG, substringsFilterSetFinal ) );
3104 
3105         // State: [SEARCH_REQUEST_ANY_END_TAG] - Tag: </substrings>
3106         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG.ordinal()].put( new Tag( DsmlLiterals.SUBSTRINGS, Tag.END ),
3107             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG,
3108                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, substringsFilterClose ) );
3109 
3110         // State: [SEARCH_REQUEST_SUBSTRINGS_START_TAG] - Tag: <final>
3111         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG.ordinal()].put( new Tag( DsmlLiterals.FINAL,
3112             Tag.START ),
3113             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG,
3114                 Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG, substringsFilterSetFinal ) );
3115 
3116         // State: [SEARCH_REQUEST_FINAL_END_TAG] - Tag: </substrings>
3117         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG.ordinal()].put(
3118             new Tag( DsmlLiterals.SUBSTRINGS, Tag.END ),
3119             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG,
3120                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, substringsFilterClose ) );
3121 
3122         //------------------------------------------ handle SOAP envelopes --------------------------
3123         super.transitions[Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
3124         super.transitions[Dsmlv2StatesEnum.SOAP_HEADER_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
3125         super.transitions[Dsmlv2StatesEnum.SOAP_HEADER_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
3126         super.transitions[Dsmlv2StatesEnum.SOAP_BODY_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
3127         super.transitions[Dsmlv2StatesEnum.SOAP_BODY_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
3128 
3129         super.transitions[Dsmlv2StatesEnum.GRAMMAR_END.ordinal()] = new HashMap<Tag, GrammarTransition>();
3130 
3131         // State: [INIT_GRAMMAR_STATE] - Tag: <envelope>
3132         super.transitions[Dsmlv2StatesEnum.INIT_GRAMMAR_STATE.ordinal()].put( new Tag( DsmlLiterals.ENVELOPE, Tag.START ),
3133             new GrammarTransition( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE, Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG,
3134                 null ) );
3135 
3136         // state: [SOAP_ENVELOPE_START_TAG] -> Tag: <header>
3137         super.transitions[Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG.ordinal()].put( new Tag( DsmlLiterals.HEADER, Tag.START ),
3138             new GrammarTransition( Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG, Dsmlv2StatesEnum.SOAP_HEADER_START_TAG,
3139                 ParserUtils.READ_SOAP_HEADER ) );
3140 
3141         // state: [SOAP_HEADER_START_TAG] -> Tag: </header>
3142         super.transitions[Dsmlv2StatesEnum.SOAP_HEADER_START_TAG.ordinal()]
3143             .put( new Tag( DsmlLiterals.HEADER, Tag.END ),
3144                 new GrammarTransition( Dsmlv2StatesEnum.SOAP_HEADER_START_TAG, Dsmlv2StatesEnum.SOAP_HEADER_END_TAG,
3145                     null ) );
3146 
3147         // state: [SOAP_HEADER_END_TAG] -> Tag: <body>
3148         super.transitions[Dsmlv2StatesEnum.SOAP_HEADER_END_TAG.ordinal()].put( new Tag( DsmlLiterals.BODY, Tag.START ),
3149             new GrammarTransition( Dsmlv2StatesEnum.SOAP_HEADER_END_TAG, Dsmlv2StatesEnum.SOAP_BODY_START_TAG, null ) );
3150 
3151         // state: [SOAP_BODY_START_TAG] -> Tag: <batchRequest>
3152         super.transitions[Dsmlv2StatesEnum.SOAP_BODY_START_TAG.ordinal()].put( new Tag( DsmlLiterals.BATCH_REQUEST, Tag.START ),
3153             new GrammarTransition( Dsmlv2StatesEnum.SOAP_BODY_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
3154                 batchRequestCreation ) );
3155 
3156         // the optional transition if no soap header is present
3157         // state: [SOAP_ENVELOPE_START_TAG] -> Tag: <body>
3158         super.transitions[Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG.ordinal()]
3159             .put( new Tag( DsmlLiterals.BODY, Tag.START ),
3160                 new GrammarTransition( Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG, Dsmlv2StatesEnum.SOAP_BODY_START_TAG,
3161                     null ) );
3162 
3163         // the below two transitions are a bit unconventional, technically the container's state is set to GRAMMAR_END
3164         // when the </batchRequest> tag is encountered by the parser and the corresponding action gets executed but in
3165         // a SOAP envelop we still have two more end tags(</body> and </envelope>) are left so we set those corresponding
3166         // current and next transition states always to GRAMMAR_END
3167         super.transitions[Dsmlv2StatesEnum.GRAMMAR_END.ordinal()].put( new Tag( DsmlLiterals.BODY, Tag.END ),
3168             new GrammarTransition( Dsmlv2StatesEnum.GRAMMAR_END, Dsmlv2StatesEnum.GRAMMAR_END, null ) );
3169 
3170         super.transitions[Dsmlv2StatesEnum.GRAMMAR_END.ordinal()].put( new Tag( DsmlLiterals.ENVELOPE, Tag.END ),
3171             new GrammarTransition( Dsmlv2StatesEnum.GRAMMAR_END, Dsmlv2StatesEnum.GRAMMAR_END, null ) );
3172 
3173         //------------------------------------------
3174 
3175     } // End of the constructor
3176 
3177 
3178     /**
3179      * @return The LDAP codec service.
3180      */
3181     public LdapApiService getLdapCodecService()
3182     {
3183         return codec;
3184     }
3185 }