You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2016/12/17 15:18:17 UTC
svn commit: r1774774 [3/10] - in /directory/shared/branches/shared-value: ./
asn1/ber/src/main/java/org/apache/directory/api/asn1/actions/
asn1/ber/src/main/java/org/apache/directory/api/asn1/ber/
asn1/ber/src/main/java/org/apache/directory/api/asn1/be...
Modified: directory/shared/branches/shared-value/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/request/Dsmlv2Grammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/request/Dsmlv2Grammar.java?rev=1774774&r1=1774773&r2=1774774&view=diff
==============================================================================
--- directory/shared/branches/shared-value/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/request/Dsmlv2Grammar.java (original)
+++ directory/shared/branches/shared-value/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/request/Dsmlv2Grammar.java Sat Dec 17 15:18:15 2016
@@ -57,9 +57,7 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.message.CompareRequestImpl;
import org.apache.directory.api.ldap.model.message.Control;
import org.apache.directory.api.ldap.model.message.DeleteRequestImpl;
-import org.apache.directory.api.ldap.model.message.ExtendedRequest;
import org.apache.directory.api.ldap.model.message.ExtendedRequestImpl;
-import org.apache.directory.api.ldap.model.message.ExtendedResponse;
import org.apache.directory.api.ldap.model.message.ModifyDnRequestImpl;
import org.apache.directory.api.ldap.model.message.ModifyRequestImpl;
import org.apache.directory.api.ldap.model.message.Request;
@@ -103,1519 +101,1661 @@ public final class Dsmlv2Grammar extends
private static final String NAME = "name";
private static final String TRUE = "true";
private static final String FALSE = "false";
-
+ //*************************
+ //* GRAMMAR ACTIONS *
+ //*************************
/**
- * Creates a new instance of Dsmlv2Grammar.
+ * GrammarAction that creates a Batch Request
*/
- @SuppressWarnings("unchecked")
- public Dsmlv2Grammar()
+ private final GrammarAction batchRequestCreation = new GrammarAction( "Create Batch Request" )
{
- name = Dsmlv2Grammar.class.getName();
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ BatchRequestDsml batchRequest = new BatchRequestDsml();
- // Create the transitions table
- super.transitions = ( HashMap<Tag, GrammarTransition>[] ) Array.newInstance( HashMap.class, 200 );
+ container.setBatchRequest( batchRequest );
- //====================================================
- // Transitions concerning : BATCH REQUEST
- //====================================================
- super.transitions[Dsmlv2StatesEnum.INIT_GRAMMAR_STATE.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
+ XmlPullParser xpp = container.getParser();
- // ** OPEN BATCH REQUEST **
- // State: [INIT_GRAMMAR_STATE] - Tag: <batchRequest>
- super.transitions[Dsmlv2StatesEnum.INIT_GRAMMAR_STATE.ordinal()].put( new Tag( BATCH_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE, Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
- batchRequestCreation ) );
+ // Checking and adding the batchRequest's attributes
+ String attributeValue;
+ // requestID
+ attributeValue = xpp.getAttributeValue( "", REQUEST_ID );
- // ** CLOSE BATCH REQUEST **
- // state: [BATCHREQUEST_START_TAG] - Tag: </batchRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()]
- .put( new Tag( BATCH_REQUEST, Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
- Dsmlv2StatesEnum.BATCHREQUEST_END_TAG, null ) );
- //state: [BATCHREQUEST_LOOP] - Tag: </batchRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( BATCH_REQUEST, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.GRAMMAR_END, null ) );
+ if ( attributeValue != null )
+ {
+ batchRequest.setRequestID( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ }
+ // processing
+ attributeValue = xpp.getAttributeValue( "", "processing" );
- // ** ABANDON REQUEST **
- // State: [BATCHREQUEST_START_TAG] - Tag: <abandonRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
- new Tag( ABANDON_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG,
- abandonRequestCreation ) );
- // state: [BATCHREQUEST_LOOP] - Tag: <abandonRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( ABANDON_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG,
- abandonRequestCreation ) );
+ if ( attributeValue != null )
+ {
+ if ( "sequential".equals( attributeValue ) )
+ {
+ batchRequest.setProcessing( Processing.SEQUENTIAL );
+ }
+ else if ( "parallel".equals( attributeValue ) )
+ {
+ batchRequest.setProcessing( Processing.PARALLEL );
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03013 ), xpp, null );
+ }
+ }
+ else
+ {
+ batchRequest.setProcessing( Processing.SEQUENTIAL );
+ }
- // ** ADD REQUEST **
- // state: [BATCHREQUEST_START_TAG] - Tag: <addRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( ADD_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.ADD_REQUEST_START_TAG,
- addRequestCreation ) );
- // state: [BATCHREQUEST_LOOP] - Tag: <addRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( ADD_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.ADD_REQUEST_START_TAG,
- addRequestCreation ) );
+ // onError
+ attributeValue = xpp.getAttributeValue( "", "onError" );
- // ** AUTH REQUEST **
- // state: [BATCHREQUEST_START_TAG] - Tag: <authRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( "authRequest", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG,
- authRequestCreation ) );
+ if ( attributeValue != null )
+ {
+ if ( "resume".equals( attributeValue ) )
+ {
+ batchRequest.setOnError( OnError.RESUME );
+ }
+ else if ( "exit".equals( attributeValue ) )
+ {
+ batchRequest.setOnError( OnError.EXIT );
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03014 ), xpp, null );
+ }
+ }
+ else
+ {
+ batchRequest.setOnError( OnError.EXIT );
+ }
- // ** COMPARE REQUEST **
- // state: [BATCHREQUEST_START_TAG] - Tag: <compareRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
- new Tag( COMPARE_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG,
- compareRequestCreation ) );
- // state: [BATCHREQUEST_LOOP] - Tag: <compareRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( COMPARE_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG,
- compareRequestCreation ) );
+ // responseOrder
+ attributeValue = xpp.getAttributeValue( "", "responseOrder" );
- // ** DEL REQUEST **
- // state: [BATCHREQUEST_START_TAG] - Tag: <delRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( DEL_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.DEL_REQUEST_START_TAG,
- delRequestCreation ) );
- // state: [BATCHREQUEST_LOOP] - Tag: <delRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( DEL_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.DEL_REQUEST_START_TAG,
- delRequestCreation ) );
+ if ( attributeValue != null )
+ {
+ if ( "sequential".equals( attributeValue ) )
+ {
+ batchRequest.setResponseOrder( ResponseOrder.SEQUENTIAL );
+ }
+ else if ( "unordered".equals( attributeValue ) )
+ {
+ batchRequest.setResponseOrder( ResponseOrder.UNORDERED );
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03015 ), xpp, null );
+ }
+ }
+ else
+ {
+ batchRequest.setResponseOrder( ResponseOrder.SEQUENTIAL );
+ }
+ }
+ };
- // ** EXTENDED REQUEST **
- // state: [BATCHREQUEST_START_TAG] - Tag: <extendedRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
- new Tag( EXTENDED_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
- Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG, extendedRequestCreation ) );
- // state: [BATCHREQUEST_LOOP] - Tag: <extendedRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( EXTENDED_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG,
- extendedRequestCreation ) );
+ /**
+ * GrammarAction that creates an Abandon Request
+ */
+ private final GrammarAction abandonRequestCreation = new GrammarAction( "Create Abandon Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ AbandonRequestDsml abandonRequest = new AbandonRequestDsml( codec, new AbandonRequestImpl() );
+ container.getBatchRequest().addRequest( abandonRequest );
- // ** MOD Dn REQUEST **
- // state: [BATCHREQUEST_START_TAG] - Tag: <modDNRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( MOD_DN_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
- Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG, modDNRequestCreation ) );
- // state: [BATCHREQUEST_LOOP] - Tag: <modDNRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( MOD_DN_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG,
- modDNRequestCreation ) );
+ XmlPullParser xpp = container.getParser();
- // ** MODIFY REQUEST **
- // state: [BATCHREQUEST_START_TAG] - Tag: <modifyRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
- new Tag( MODIFY_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
- modifyRequestCreation ) );
- // state: [BATCHREQUEST_LOOP] - Tag: <modifyRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( MODIFY_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
- modifyRequestCreation ) );
+ // Checking and adding the request's attributes
+ String attributeValue;
+ // requestID
+ attributeValue = xpp.getAttributeValue( "", REQUEST_ID );
+
+ if ( attributeValue != null )
+ {
+ abandonRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ }
+ else
+ {
+ if ( ParserUtils.isRequestIdNeeded( container ) )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
+ }
+ }
+
+ // abandonID
+ attributeValue = xpp.getAttributeValue( "", "abandonID" );
+
+ if ( attributeValue != null )
+ {
+ try
+ {
+ abandonRequest.setAbandoned( Integer.parseInt( attributeValue ) );
+ }
+ catch ( NumberFormatException nfe )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03017 ), xpp, nfe );
+ }
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03018 ), xpp, null );
+ }
+ }
+ };
- // ** SEARCH REQUEST **
- // state: [BATCHREQUEST_START_TAG] - Tag: <searchRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
- new Tag( SEARCH_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
- searchRequestCreation ) );
- // state: [BATCHREQUEST_LOOP] - Tag: <searchRequest>
- super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( SEARCH_REQUEST, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
- searchRequestCreation ) );
+ /**
+ * GrammarAction that creates an Add Request
+ */
+ private final GrammarAction addRequestCreation = new GrammarAction( "Create Add Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ AddRequestDsml addRequest = new AddRequestDsml( codec, new AddRequestImpl() );
+ container.getBatchRequest().addRequest( addRequest );
- //====================================================
- // Transitions concerning : ABANDON REQUEST
- //====================================================
- super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
+ XmlPullParser xpp = container.getParser();
- // State: [ABANDON_REQUEST_START_TAG] - Tag: </abandonRequest>
- super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG.ordinal()]
- .put( new Tag( ABANDON_REQUEST, Tag.END ), new GrammarTransition(
- Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
-
- // State: [ABANDON_REQUEST_START_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG.ordinal()].put( new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG,
- Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG, controlCreation ) );
-
- // State: [ABANDON_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
- super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG.ordinal()].put(
- new Tag( CONTROL_VALUE, Tag.START ), new GrammarTransition(
- Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
+ // Checking and adding the request's attributes
+ String attributeValue;
+ // requestID
+ attributeValue = xpp.getAttributeValue( "", REQUEST_ID );
+
+ if ( attributeValue != null )
+ {
+ addRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ }
+ else
+ {
+ if ( ParserUtils.isRequestIdNeeded( container ) )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
+ }
+ }
+
+ // dn
+ attributeValue = xpp.getAttributeValue( "", "dn" );
+
+ if ( attributeValue != null )
+ {
+ try
+ {
+ addRequest.setEntryDn( new Dn( attributeValue ) );
+ }
+ catch ( LdapInvalidDnException lide )
+ {
+ throw new XmlPullParserException( lide.getMessage(), xpp, lide );
+ }
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03019 ), xpp, null );
+ }
+ }
+ };
- // State: [ABANDON_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG,
- Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG, null ) );
+ /**
+ * GrammarAction that adds an attribute to an Add Request
+ */
+ private final GrammarAction addRequestAddAttribute = new GrammarAction( "Add Attribute to Add Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ AddRequestDsml addRequest = ( AddRequestDsml )
+ container.getBatchRequest().getCurrentRequest();
- // State: [ABANDON_REQUEST_CONTROL_START_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG, null ) );
+ XmlPullParser xpp = container.getParser();
- // State: [ABANDON_REQUEST_CONTROL_END_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ // Checking and adding the request's attributes
+ String attributeValue;
+ // name
+ attributeValue = xpp.getAttributeValue( "", NAME );
- // State: [ABANDON_REQUEST_CONTROL_END_TAG] - Tag: </abandonRequest>
- super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( ABANDON_REQUEST,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ if ( attributeValue != null )
+ {
+ try
+ {
+ addRequest.addAttributeType( attributeValue );
+ }
+ catch ( LdapException le )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03020 ), xpp, le );
+ }
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
+ }
+ }
+ };
- //====================================================
- // Transitions concerning : ADD REQUEST
- //====================================================
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
+ /**
+ * GrammarAction that adds a Value to an Attribute of an Add Request
+ */
+ private final GrammarAction addRequestAddValue = new GrammarAction( "Add Value to Attribute" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ AddRequestDsml addRequest = ( AddRequestDsml )
+ container.getBatchRequest().getCurrentRequest();
- // state: [ADD_REQUEST_START_TAG] -> Tag: </addRequest>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()].put( new Tag( ADD_REQUEST, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ XmlPullParser xpp = container.getParser();
- // State: [ADD_REQUEST_START_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()].put( new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_START_TAG,
- Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ try
+ {
+ // We have to catch the type Attribute Value before going to the next Text node
+ String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
- // State: [ADD_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( CONTROL_VALUE,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
+ // Getting the value
+ String nextText = xpp.nextText();
+
+ if ( !Strings.isEmpty( nextText ) )
+ {
+ try
+ {
+ if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
+ {
+ addRequest.addAttributeValue( Base64.decode( nextText.trim().toCharArray() ) );
+ }
+ else
+ {
+ addRequest.addAttributeValue( nextText.trim() );
+ }
+ }
+ catch ( LdapException le )
+ {
+ throw new XmlPullParserException( le.getMessage(), xpp, le );
+ }
+ }
+ }
+ catch ( IOException ioe )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03008, ioe.getMessage() ), xpp, ioe );
+ }
+ }
+ };
- // State: [ADD_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put(
- new Tag( CONTROL, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG,
- Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG, null ) );
+ /**
+ * GrammarAction that creates an Auth Request
+ */
+ private final GrammarAction authRequestCreation = new GrammarAction( "Create Auth Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ BindRequestDsml authRequest = new BindRequestDsml( codec, new BindRequestImpl() );
+ container.getBatchRequest().addRequest( authRequest );
- // State: [ADD_REQUEST_CONTROL_START_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( CONTROL, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG, null ) );
+ authRequest.setSimple( true );
+ authRequest.setVersion3( true );
- // State: [ADD_REQUEST_CONTROL_END_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ XmlPullParser xpp = container.getParser();
- // State: [ADD_REQUEST_CONTROL_END_TAG] - Tag: </addRequest>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()].put(
- new Tag( ADD_REQUEST, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
- null ) );
+ // Checking and adding the request's attributes
+ String attributeValue;
+ // requestID
+ attributeValue = xpp.getAttributeValue( "", REQUEST_ID );
- // State: [ADD_REQUEST_START_TAG] - Tag: <attr>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()].put( new Tag( ATTR, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_START_TAG, Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG,
- addRequestAddAttribute ) );
+ if ( attributeValue != null )
+ {
+ authRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ }
+ else
+ {
+ if ( ParserUtils.isRequestIdNeeded( container ) )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
+ }
+ }
+ // principal
+ attributeValue = xpp.getAttributeValue( "", "principal" );
- // State: [ADD_REQUEST_CONTROL_END_TAG] - Tag: <attr>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( ATTR, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG, addRequestAddAttribute ) );
+ if ( attributeValue != null )
+ {
+ authRequest.setName( attributeValue );
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03021 ), xpp, null );
+ }
+ }
+ };
- // State: [ADD_REQUEST_ATTR_END_TAG] - Tag: <attr>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG.ordinal()].put( new Tag( ATTR, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG,
- Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG, addRequestAddAttribute ) );
+ /**
+ * GrammarAction that creates an Compare Request
+ */
+ private final GrammarAction compareRequestCreation = new GrammarAction( "Create Compare Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ CompareRequestDsml compareRequest = new CompareRequestDsml( codec, new CompareRequestImpl() );
+ container.getBatchRequest().addRequest( compareRequest );
- // State: [ADD_REQUEST_ATTR_START_TAG] - Tag: </attr>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG.ordinal()].put( new Tag( ATTR, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG,
- Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG, null ) );
+ XmlPullParser xpp = container.getParser();
- // State: [ADD_REQUEST_ATTR_START_TAG] - Tag: <value>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG.ordinal()].put( new Tag( VALUE, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG,
- Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG, addRequestAddValue ) );
+ // Checking and adding the request's attributes
+ String attributeValue;
+ // requestID
+ attributeValue = xpp.getAttributeValue( "", REQUEST_ID );
- // State: [ADD_REQUEST_ATTR_END_TAG] - Tag: </addRequest>
- super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG.ordinal()]
- .put( new Tag( ADD_REQUEST, Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG,
- Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ if ( attributeValue != null )
+ {
+ compareRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ }
+ else
+ {
+ if ( ParserUtils.isRequestIdNeeded( container ) )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
+ }
+ }
- //====================================================
- // Transitions concerning : AUTH REQUEST
- //====================================================
- super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
+ // dn
+ attributeValue = xpp.getAttributeValue( "", "dn" );
- // state: [AUTH_REQUEST_START_TAG] -> Tag: </authRequest>
- super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG.ordinal()].put( new Tag( "authRequest", Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ if ( attributeValue != null )
+ {
+ try
+ {
+ compareRequest.setName( new Dn( attributeValue ) );
+ }
+ catch ( LdapInvalidDnException lide )
+ {
+ throw new XmlPullParserException( lide.getMessage(), xpp, lide );
+ }
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03019 ), xpp, null );
+ }
+ }
+ };
- // State: [AUTH_REQUEST_START_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG.ordinal()].put( new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG,
- Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ /**
+ * GrammarAction that adds an Assertion to a Compare Request
+ */
+ private final GrammarAction compareRequestAddAssertion = new GrammarAction( "Add Assertion to Compare Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ CompareRequest compareRequest = ( CompareRequest ) container.getBatchRequest().getCurrentRequest();
- // State: [AUTH_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
- super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( CONTROL_VALUE,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
+ XmlPullParser xpp = container.getParser();
- // State: [AUTH_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG,
- Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG, null ) );
+ // Checking and adding the request's attributes
+ String attributeId;
- // State: [AUTH_REQUEST_CONTROL_START_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG.ordinal()].put(
- new Tag( CONTROL, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG, null ) );
+ // name
+ attributeId = xpp.getAttributeValue( "", NAME );
- // State: [AUTH_REQUEST_CONTROL_END_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG.ordinal()].put(
- new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ if ( attributeId != null )
+ {
+ compareRequest.setAttributeId( attributeId );
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
+ }
+ }
+ };
- // State: [AUTH_REQUEST_CONTROL_END_TAG] - Tag: </authRequest>
- super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG.ordinal()].put(
- new Tag( "authRequest", Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
- null ) );
+ /**
+ * GrammarAction that adds a Value to a Compare Request
+ */
+ private final GrammarAction compareRequestAddValue = new GrammarAction( "Add Value to Compare Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ CompareRequest compareRequest = ( CompareRequest ) container.getBatchRequest().getCurrentRequest();
- //====================================================
- // Transitions concerning : COMPARE REQUEST
- //====================================================
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
+ XmlPullParser xpp = container.getParser();
- // State: [COMPARE_REQUEST_START_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG.ordinal()].put( new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG,
- Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ try
+ {
+ // We have to catch the type Attribute Value before going to the next Text node
+ String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
- // State: [COMPARE_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG.ordinal()].put(
- new Tag( CONTROL_VALUE, Tag.START ), new GrammarTransition(
- Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
+ // Getting the value
+ String nextText = xpp.nextText();
- // State: [COMPARE_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG,
- Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG, null ) );
+ if ( !Strings.isEmpty( nextText ) )
+ {
+ if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
+ {
+ compareRequest.setAssertionValue( Base64.decode( nextText.trim().toCharArray() ) );
+ }
+ else
+ {
+ compareRequest.setAssertionValue( nextText.trim() );
+ }
+ }
+ }
+ catch ( IOException ioe )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03008, ioe.getMessage() ), xpp, ioe );
+ }
+ }
+ };
- // State: [COMPARE_REQUEST_CONTROL_START_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG, null ) );
+ /**
+ * GrammarAction that creates a Del Request
+ */
+ private final GrammarAction delRequestCreation = new GrammarAction( "Create Del Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ DelRequestDsml delRequest = new DelRequestDsml( codec, new DeleteRequestImpl() );
+ container.getBatchRequest().addRequest( delRequest );
- // State: [COMPARE_REQUEST_CONTROL_END_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ XmlPullParser xpp = container.getParser();
- // State: [COMPARE_REQUEST_CONTROL_END_TAG] - Tag: </compareRequest>
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( COMPARE_REQUEST,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ // Checking and adding the request's attributes
+ String attributeValue;
+ // requestID
+ attributeValue = xpp.getAttributeValue( "", REQUEST_ID );
- // State: [COMPARE_REQUEST_START_TAG] - Tag: <assertion>
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG.ordinal()].put( new Tag( "assertion", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG, compareRequestAddAssertion ) );
+ if ( attributeValue != null )
+ {
+ delRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ }
+ else
+ {
+ if ( ParserUtils.isRequestIdNeeded( container ) )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
+ }
+ }
- // State: [COMPARE_REQUEST_CONTROL_END_TAG] - Tag: <assertion>
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "assertion",
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG, compareRequestAddAssertion ) );
+ // dn
+ attributeValue = xpp.getAttributeValue( "", "dn" );
- // State: [COMPARE_REQUEST_ASSERTION_START_TAG] - Tag: <value>
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG.ordinal()].put( new Tag( VALUE,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG,
- Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG, compareRequestAddValue ) );
+ if ( attributeValue != null )
+ {
+ try
+ {
+ delRequest.setName( new Dn( attributeValue ) );
+ }
+ catch ( LdapInvalidDnException lide )
+ {
+ throw new XmlPullParserException( "" + lide.getMessage(), xpp, lide );
+ }
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03019 ), xpp, null );
+ }
+ }
+ };
- //State: [COMPARE_REQUEST_VALUE_END_TAG] - Tag: </assertion>
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG.ordinal()].put(
- new Tag( "assertion", Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG,
- Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG, null ) );
+ /**
+ * GrammarAction that creates an Extended Request
+ */
+ private final GrammarAction extendedRequestCreation = new GrammarAction( "Create Extended Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ ExtendedRequestDsml<?, ?> extendedRequest =
+ new ExtendedRequestDsml<>( codec,
+ new ExtendedRequestImpl() );
+ container.getBatchRequest().addRequest( extendedRequest );
- // State: [COMPARE_REQUEST_ASSERTION_END_TAG] - Tag: </compareRequest>
- super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG.ordinal()].put(
- new Tag( COMPARE_REQUEST, Tag.END ), new GrammarTransition(
- Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ XmlPullParser xpp = container.getParser();
- //====================================================
- // Transitions concerning : DEL REQUEST
- //====================================================
- super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
+ // Checking and adding the request's attributes
+ String attributeValue;
+ // requestID
+ attributeValue = xpp.getAttributeValue( "", REQUEST_ID );
- // State: [DEL_REQUEST_START_TAG] - Tag: </delRequest>
- super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_START_TAG.ordinal()].put( new Tag( DEL_REQUEST, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
-
- // State: [DEL_REQUEST_START_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_START_TAG.ordinal()].put( new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_START_TAG,
- Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG, controlCreation ) );
-
- // State: [DEL_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
- super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( CONTROL_VALUE,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
+ if ( attributeValue != null )
+ {
+ extendedRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ }
+ else
+ {
+ if ( ParserUtils.isRequestIdNeeded( container ) )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
+ }
+ }
+ }
+ };
- // State: [DEL_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put(
- new Tag( CONTROL, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG,
- Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG, null ) );
+ /**
+ * GrammarAction that adds a Name to an Extended Request
+ */
+ private final GrammarAction extendedRequestAddName = new GrammarAction( "Add Name to Extended Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ ExtendedRequestDsml<?, ?> extendedRequest = ( ExtendedRequestDsml<?, ?> )
+ container.getBatchRequest().getCurrentRequest();
- // State: [DEL_REQUEST_CONTROL_START_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( CONTROL, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG, null ) );
+ XmlPullParser xpp = container.getParser();
- // State: [DEL_REQUEST_CONTROL_END_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ try
+ {
+ String nextText = xpp.nextText();
- // State: [DEL_REQUEST_CONTROL_END_TAG] - Tag: </delRequest>
- super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG.ordinal()].put(
- new Tag( DEL_REQUEST, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
- null ) );
+ if ( Strings.isEmpty( nextText ) )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03022 ), xpp, null );
+ }
+ else
+ {
+ String oid = nextText.trim();
- //====================================================
- // Transitions concerning : EXTENDED REQUEST
- //====================================================
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
+ if ( Oid.isOid( oid ) )
+ {
+ extendedRequest.setRequestName( nextText.trim() );
+ }
+ else
+ {
+ throw new XmlPullParserException( "Bad oid : " + oid, xpp, null );
+ }
+ }
+ }
+ catch ( IOException ioe )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03008, ioe.getMessage() ), xpp, ioe );
+ }
+ }
+ };
- // State: [EXTENDED_REQUEST_START_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG.ordinal()].put( new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG,
- Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ /**
+ * GrammarAction that adds a Value to an Extended Request
+ */
+ private final GrammarAction extendedRequestAddValue = new GrammarAction( "Add Value to Extended Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ ExtendedRequestDsml<?, ?> extendedRequest = ( ExtendedRequestDsml<?, ?> )
+ container.getBatchRequest().getCurrentRequest();
- // State: [EXTENDED_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG.ordinal()].put(
- new Tag( CONTROL_VALUE, Tag.START ), new GrammarTransition(
- Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
+ XmlPullParser xpp = container.getParser();
- // State: [EXTENDED_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG,
- Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG, null ) );
+ try
+ {
+ // We have to catch the type Attribute Value before going to the next Text node
+ String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
- // State: [EXTENDED_REQUEST_CONTROL_START_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG, null ) );
+ // Getting the value
+ String nextText = xpp.nextText();
- // State: [EXTENDED_REQUEST_CONTROL_END_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ if ( !Strings.isEmpty( nextText ) )
+ {
+ if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
+ {
+ extendedRequest.setRequestValue( Base64.decode( nextText.trim().toCharArray() ) );
+ }
+ else
+ {
+ extendedRequest.setRequestValue( Strings.getBytesUtf8( nextText.trim() ) );
+ }
+ }
+ }
+ catch ( IOException ioe )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03008, ioe.getMessage() ), xpp, ioe );
+ }
+ }
+ };
- // State: [EXTENDED_REQUEST_CONTROL_END_TAG] - Tag: </extendedRequest>
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()].put(
- new Tag( EXTENDED_REQUEST, Tag.END ), new GrammarTransition(
- Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ /**
+ * GrammarAction that creates a Modify Dn Request
+ */
+ private final GrammarAction modDNRequestCreation = new GrammarAction( "Create Modify Dn Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ ModifyDNRequestDsml modifyDNRequest = new ModifyDNRequestDsml( codec, new ModifyDnRequestImpl() );
+ container.getBatchRequest().addRequest( modifyDNRequest );
- // State: [EXTENDED_REQUEST_START_TAG] - Tag: <requestName>
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG.ordinal()].put(
- new Tag( "requestName", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG,
- Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG, extendedRequestAddName ) );
+ XmlPullParser xpp = container.getParser();
- // State: [EXTENDED_REQUEST_CONTROL_END_TAG] - Tag: <requestName>
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "requestName",
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG, extendedRequestAddName ) );
+ // Checking and adding the request's attributes
+ String attributeValue;
+ // requestID
+ attributeValue = xpp.getAttributeValue( "", REQUEST_ID );
- // State: [EXTENDED_REQUEST_REQUESTNAME_END_TAG] - Tag: </extendedRequest>
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG.ordinal()].put( new Tag(
- EXTENDED_REQUEST,
- Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG,
- Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ if ( attributeValue != null )
+ {
+ modifyDNRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ }
+ else
+ {
+ if ( ParserUtils.isRequestIdNeeded( container ) )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
+ }
+ }
- // State: [EXTENDED_REQUEST_REQUESTNAME_END_TAG] - Tag: <requestValue>
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG.ordinal()].put( new Tag(
- "requestValue",
- Tag.START ), new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG,
- Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG, extendedRequestAddValue ) );
+ // dn
+ attributeValue = xpp.getAttributeValue( "", "dn" );
- // State: [EXTENDED_REQUEST_REQUESTVALUE_END_TAG] - Tag: </requestRequest>
- super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG.ordinal()].put( new Tag(
- EXTENDED_REQUEST,
- Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG,
- Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ if ( attributeValue != null )
+ {
+ try
+ {
+ modifyDNRequest.setName( new Dn( attributeValue ) );
+ }
+ catch ( LdapInvalidDnException lide )
+ {
+ throw new XmlPullParserException( "" + lide.getMessage(), xpp, lide );
+ }
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03019 ), xpp, null );
+ }
- //====================================================
- // Transitions concerning : MODIFY Dn REQUEST
- //====================================================
- super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
+ // newrdn
+ attributeValue = xpp.getAttributeValue( "", "newrdn" );
- // State: [MODIFY_DN_REQUEST_START_TAG] - Tag: </modDNRequest>
- super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG.ordinal()].put(
- new Tag( MOD_DN_REQUEST, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
- null ) );
+ if ( attributeValue != null )
+ {
+ try
+ {
+ modifyDNRequest.setNewRdn( new Rdn( attributeValue ) );
+ }
+ catch ( LdapInvalidDnException lide )
+ {
+ throw new XmlPullParserException( "" + lide.getMessage(), xpp, lide );
+ }
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03023 ), xpp, null );
+ }
- // State: [MODIFY_DN_REQUEST_START_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG.ordinal()].put( new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG,
- Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ // deleteoldrdn
+ attributeValue = xpp.getAttributeValue( "", "deleteoldrdn" );
- // State: [MODIFY_DN_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
- super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG.ordinal()].put(
- new Tag( CONTROL_VALUE, Tag.START ), new GrammarTransition(
- Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
-
- // State: [MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG,
- Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG, null ) );
-
- // State: [MODIFY_DN_REQUEST_CONTROL_START_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG, null ) );
+ if ( attributeValue != null )
+ {
+ if ( ( attributeValue.equalsIgnoreCase( TRUE ) ) || ( "1".equals( attributeValue ) ) )
+ {
+ modifyDNRequest.setDeleteOldRdn( true );
+ }
+ else if ( ( attributeValue.equalsIgnoreCase( FALSE ) ) || ( "0".equals( attributeValue ) ) )
+ {
+ modifyDNRequest.setDeleteOldRdn( false );
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03024 ), xpp, null );
+ }
+ }
+ else
+ {
+ modifyDNRequest.setDeleteOldRdn( true );
+ }
- // State: [MODIFY_DN_REQUEST_CONTROL_END_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ // newsuperior
+ attributeValue = xpp.getAttributeValue( "", "newSuperior" );
- // State: [MODIFY_DN_REQUEST_CONTROL_END_TAG] - Tag: </modDNRequest>
- super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( MOD_DN_REQUEST,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ if ( attributeValue != null )
+ {
+ try
+ {
+ modifyDNRequest.setNewSuperior( new Dn( attributeValue ) );
+ }
+ catch ( LdapInvalidDnException lide )
+ {
+ throw new XmlPullParserException( "" + lide.getMessage(), xpp, lide );
+ }
+ }
+ }
+ };
- //====================================================
- // Transitions concerning : MODIFY REQUEST
- //====================================================
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
+ /**
+ * GrammarAction that creates a Modify Request
+ */
+ private final GrammarAction modifyRequestCreation = new GrammarAction( "Create Modify Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ ModifyRequestDsml modifyRequest = new ModifyRequestDsml( codec, new ModifyRequestImpl() );
+ container.getBatchRequest().addRequest( modifyRequest );
- // State: [MODIFY_REQUEST_START_TAG] - Tag: </modifyRequest>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()]
- .put( new Tag( MODIFY_REQUEST, Tag.END ), new GrammarTransition(
- Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ XmlPullParser xpp = container.getParser();
- // State: [MODIFY_REQUEST_START_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()].put( new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ // Checking and adding the request's attributes
+ String attributeValue;
+ // requestID
+ attributeValue = xpp.getAttributeValue( "", REQUEST_ID );
- // State: [MODIFY_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( CONTROL_VALUE,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
+ if ( attributeValue != null )
+ {
+ modifyRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ }
+ else
+ {
+ if ( ParserUtils.isRequestIdNeeded( container ) )
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
+ }
+ }
- // State: [MODIFY_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG, null ) );
+ // dn
+ attributeValue = xpp.getAttributeValue( "", "dn" );
- // State: [MODIFY_REQUEST_CONTROL_START_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG.ordinal()].put(
- new Tag( CONTROL, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG, null ) );
+ if ( attributeValue != null )
+ {
+ try
+ {
+ modifyRequest.setName( new Dn( attributeValue ) );
+ }
+ catch ( LdapInvalidDnException lide )
+ {
+ throw new XmlPullParserException( "" + lide.getLocalizedMessage(), xpp, lide );
+ }
+ }
+ else
+ {
+ throw new XmlPullParserException( "dn attribute is required", xpp, null );
+ }
+ }
+ };
- // State: [MODIFY_REQUEST_CONTROL_END_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()].put(
- new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG, controlCreation ) );
+ /**
+ * GrammarAction that adds a Modification to a Modify Request
+ */
+ private final GrammarAction modifyRequestAddModification = new GrammarAction( "Adds Modification to Modify Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ ModifyRequestDsml modifyRequest = ( ModifyRequestDsml )
+ container.getBatchRequest().getCurrentRequest();
- // State: [MODIFY_REQUEST_CONTROL_END_TAG] - Tag: </modifyRequest>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( MODIFY_REQUEST,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
- null ) );
+ XmlPullParser xpp = container.getParser();
- // State: [MODIFY_REQUEST_CONTROL_END_TAG] - Tag: <modification>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( MODIFICATION,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG, modifyRequestAddModification ) );
+ // Checking and adding the request's attributes
+ String attributeValue;
+ // operation
+ attributeValue = xpp.getAttributeValue( "", "operation" );
- // State: [MODIFY_REQUEST_START_TAG] - Tag: <modification>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()].put(
- new Tag( MODIFICATION, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG, modifyRequestAddModification ) );
+ if ( attributeValue != null )
+ {
+ if ( "add".equals( attributeValue ) )
+ {
+ modifyRequest.setCurrentOperation( LdapCodecConstants.OPERATION_ADD );
+ }
+ else if ( "delete".equals( attributeValue ) )
+ {
+ modifyRequest.setCurrentOperation( LdapCodecConstants.OPERATION_DELETE );
+ }
+ else if ( "replace".equals( attributeValue ) )
+ {
+ modifyRequest.setCurrentOperation( LdapCodecConstants.OPERATION_REPLACE );
+ }
+ else
+ {
+ throw new XmlPullParserException(
+ "unknown operation. Operation can be 'add', 'delete' or 'replace'.", xpp, null );
+ }
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03025 ), xpp, null );
+ }
- // State: [MODIFY_REQUEST_MODIFICATION_END_TAG] - Tag: <modification>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG.ordinal()].put(
- new Tag( MODIFICATION, Tag.START ), new GrammarTransition(
- Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG, modifyRequestAddModification ) );
+ // name
+ attributeValue = xpp.getAttributeValue( "", NAME );
- // State: [MODIFY_REQUEST_MODIFICATION_START_TAG] - Tag: </modification>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG.ordinal()].put(
- new Tag( MODIFICATION, Tag.END ), new GrammarTransition(
- Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG, null ) );
+ if ( attributeValue != null )
+ {
+ modifyRequest.addAttributeTypeAndValues( attributeValue );
+ }
+ else
+ {
+ throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
+ }
+ }
+ };
- // State: [MODIFY_REQUEST_MODIFICATION_START_TAG] - Tag: <value>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG.ordinal()].put( new Tag( VALUE,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG, modifyRequestAddValue ) );
+ /**
+ * GrammarAction that adds a Value to a Modification of a Modify Request
+ */
+ private final GrammarAction modifyRequestAddValue = new GrammarAction(
+ "Add Value to Modification of Modify Request" )
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void action( Dsmlv2Container container ) throws XmlPullParserException
+ {
+ ModifyRequestDsml modifyRequest = ( ModifyRequestDsml )
+ container.getBatchRequest().getCurrentRequest();
- // State: [MODIFY_REQUEST_VALUE_END_TAG] - Tag: <value>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG.ordinal()].put( new Tag( VALUE, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG, modifyRequestAddValue ) );
+ XmlPullParser xpp = container.getParser();
- // State: [MODIFY_REQUEST_VALUE_END_TAG] - Tag: </modification>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG.ordinal()].put( new Tag( MODIFICATION,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG,
- Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG, null ) );
+ try
+ {
+ // We have to catch the type Attribute Value before going to the next Text node
+ String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
- // State: [MODIFY_REQUEST_MODIFICATION_END_TAG] - Tag: </modifyRequest>
- super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG.ordinal()].put(
- new Tag( MODIFY_REQUEST, Tag.END ), new GrammarTransition(
- Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
+ // Getting the value
+ String nextText = xpp.nextText();
+ // We are testing if nextText equals "" since a modification can be "".
- //====================================================
- // Transitions concerning : SEARCH REQUEST
- //====================================================
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
-
- // State: [SEARCH_REQUEST_START_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG.ordinal()].put( new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG, controlCreation ) );
-
- // State: [SEARCH_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( CONTROL_VALUE,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
-
- // State: [SEARCH_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( CONTROL,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG, null ) );
-
- // State: [SEARCH_REQUEST_CONTROL_START_TAG] - Tag: </control>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG.ordinal()].put(
- new Tag( CONTROL, Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG, null ) );
-
- // State: [SEARCH_REQUEST_CONTROL_END_TAG] - Tag: <control>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()].put(
- new Tag( CONTROL, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG, controlCreation ) );
-
- // State: [SEARCH_REQUEST_FILTER_END_TAG] - Tag: </searchRequest>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( SEARCH_REQUEST,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
- storeFilter ) );
-
- // State: [SEARCH_REQUEST_ATTRIBUTES_START_TAG] - Tag: </attributes>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG.ordinal()].put( new Tag( "attributes",
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG, null ) );
-
- // State: [SEARCH_REQUEST_ATTRIBUTES_START_TAG] - Tag: <attribute>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG.ordinal()].put( new Tag( "attribute",
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG, searchRequestAddAttribute ) );
-
- // State: [SEARCH_REQUEST_ATTRIBUTE_START_TAG] - Tag: </attribute>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG.ordinal()].put( new Tag( "attribute",
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG, null ) );
-
- // State: [SEARCH_REQUEST_ATTRIBUTE_END_TAG] - Tag: <attribute>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG.ordinal()].put( new Tag( "attribute",
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG, searchRequestAddAttribute ) );
-
- // State: [SEARCH_REQUEST_ATTRIBUTE_END_TAG] - Tag: </attributes>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG.ordinal()].put( new Tag( "attributes",
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG, null ) );
-
- // State: [SEARCH_REQUEST_ATTRIBUTES_END_TAG] - Tag: </searchRequest>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG.ordinal()].put( new Tag( SEARCH_REQUEST,
- Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG,
- Dsmlv2StatesEnum.BATCHREQUEST_LOOP, storeFilter ) );
-
- //====================================================
- // Transitions concerning : FILTER
- //====================================================
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_GREATEROREQUAL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_LESSOREQUAL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_APPROXMATCH_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_PRESENT_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
-
- // State: [SEARCH_REQUEST_START_TAG] - Tag: <filter>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG.ordinal()].put( new Tag( "filter", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG, null ) );
-
- // State: [SEARCH_REQUEST_CONTROL_END_TAG] - Tag: <filter>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()].put(
- new Tag( "filter", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG, null ) );
-
- //*** AND ***
- // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <and>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "and", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, andFilterCreation ) );
-
- // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <and>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "and", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
- Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, andFilterCreation ) );
-
- // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: </and>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "and", Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
- Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, connectorFilterClose ) );
-
- //*** OR ***
- // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <or>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "or", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, orFilterCreation ) );
-
- // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <or>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "or", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
- Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, orFilterCreation ) );
-
- // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: </or>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "or", Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
- Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, connectorFilterClose ) );
-
- //*** NOT ***
- // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <not>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "not", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, notFilterCreation ) );
-
- // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <not>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "not", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
- Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, notFilterCreation ) );
-
- // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: </not>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "not", Tag.END ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
- Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, connectorFilterClose ) );
-
- //*** SUBSTRINGS ***
- // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <substrings>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( SUBSTRINGS,
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG, substringsFilterCreation ) );
-
- // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <substrings>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put(
- new Tag( SUBSTRINGS, Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
- Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG, substringsFilterCreation ) );
-
- //*** EQUALITY MATCH ***
- // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <equalityMatch>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "equalityMatch",
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
- Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG, equalityMatchFilterCreation ) );
-
- // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <equalityMatch>
- super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "equalityMatch",
- Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
- Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG, equalityMatchFilterCreation ) );
-
[... 3767 lines stripped ...]