Package com.verisign.epp.codec.gen

## Class EPPCommand

- java.lang.Object
- - com.verisign.epp.codec.gen.EPPCommand

- All Implemented Interfaces:
    `EPPCodecComponent`, `EPPMessage`, `java.io.Serializable`, `java.lang.Cloneable`
  Direct Known Subclasses:
    `EPPCheckCmd`, `EPPCreateCmd`, `EPPDeleteCmd`, `EPPInfoCmd`, `EPPLoginCmd`, `EPPLogoutCmd`, `EPPPollCmd`, `EPPRenewCmd`, `EPPTransferCmd`, `EPPUpdateCmd`

      public abstract class EPPCommand
      extends java.lang.Object
      implements EPPMessage

  Represents an EPP command that is sent by an EPP Client and received by an EPP Server. An `EPPCommand` can be encoded and decoded by `EPPCodec`.
  Every EPP command must extend `EPPCommand` and implement the Template Method Design Pattern `doGenEncode` and `doGenDecode` methods. An `EPPCommand` client will call `encode` or `decode`, which in turn will call `doGenEncode` or `doGenDecode`, respectively. There is one derived `EPPCommand` for each type of command defined in the general EPP Specification.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected java.util.Vector<EPPCodecComponent>` | `extensions` | Extension objects associated with the command.
    `static java.lang.String` | `OP_APPROVE` | command approve operation currently associated with a <transfer> command.
    `static java.lang.String` | `OP_CANCEL` | command cancel operation associated with a <transfer> command.
    `static java.lang.String` | `OP_QUERY` | command query operation associated with a <transfer> command.
    `static java.lang.String` | `OP_REJECT` | command reject operation associated with a <transfer> command.
    `static java.lang.String` | `OP_REQUEST` | command request operation associated with a <transfer> command.
    `protected java.lang.String` | `transId` | Client Transaction id associated with the command
    `static java.lang.String` | `TYPE_CHECK` | command type associated with the general EPP <check> command.
    `static java.lang.String` | `TYPE_CREATE` | command type associated with the general EPP <create> command.
    `static java.lang.String` | `TYPE_DELETE` | command type associated with the general EPP <delete> command.
    `static java.lang.String` | `TYPE_INFO` | command type associated with the general EPP <info> command.
    `static java.lang.String` | `TYPE_LOGIN` | command type associated with the general EPP <login> command.
    `static java.lang.String` | `TYPE_LOGOUT` | command type associated with the general EPP <logout> command.
    `static java.lang.String` | `TYPE_POLL` | command type associated with the general EPP <poll> command.
    `static java.lang.String` | `TYPE_RENEW` | command type associated with the general EPP <renew> command.
    `static java.lang.String` | `TYPE_TRANSFER` | command type associated with the general EPP <transfer> command.
    `static java.lang.String` | `TYPE_UPDATE` | command type associated with the general EPP <update> command.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `EPPCommand()` | Allocates a new `EPPCommand` with default attribute values.
    `EPPCommand​(java.lang.String aTransId)` | Allocates a new `EPPCommand` setting the client transaction id.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addExtension​(EPPCodecComponent aExtension)` | Adds a command extension object.
    `java.lang.Object` | `clone()` | Clone `EPPCommand`.
    `void` | `decode​(org.w3c.dom.Element aElement)` | decode `EPPCommand` from a DOM element tree.
    `protected abstract void` | `doGenDecode​(org.w3c.dom.Element aElement)` | Decodes the atributes of a general extension of `EPPCommand`.
    `protected abstract org.w3c.dom.Element` | `doGenEncode​(org.w3c.dom.Document aDocument)` | Encodes the atributes of a general extension of `EPPCommand`.
    `org.w3c.dom.Element` | `encode​(org.w3c.dom.Document aDocument)` | encode `EPPCommand` into a DOM element tree.
    `boolean` | `equals​(java.lang.Object aObject)` | implements a deep `EPPCommand` compare.
    `java.util.Set<java.lang.String>` | `findDuplicateExtNamespaces()` | Find the set of duplicate EPP extension XML namespaces based on the list of EPP extensions set in the command.
    `java.util.Set<java.lang.String>` | `findExtNamespaces​(java.util.List<java.lang.String> aFilterExtNamespaces)` | Find the set of unique EPP extension XML namespaces based on the list of EPP extensions set in the command.
    `java.util.Set<java.lang.String>` | `findExtNamespaceSuffixes​(java.util.List<java.lang.String> aFilterExtNamespaceSuffixes)` | Find the set of unique EPP extension XML namespace suffixes based on the list of EPP extensions set in the command and the optional use of a list of XML namespace suffixes to filter.
    `java.util.Set<java.lang.String>` | `findUnsupportedExtNamespaces​(java.util.List<java.lang.String> aSupportedExtNamespaces)` | Find the set of unsupported EPP extension XML namespaces based the passed in supported extension XML namespaces and on the list of EPP extensions set in the command.
    `java.util.Set<java.lang.String>` | `findUnsupportedExtNamespaceSuffixes​(java.util.List<java.lang.String> aSupportedExtNamespaceSuffixes)` | Find the set of unsupported EPP extensions based on passing the list of supported extension XML namespace suffixes and the list of EPP extensions set in the command.
    `EPPCodecComponent` | `getExtension​(java.lang.Class aExtensionClass)` | Gets the command extension object with the specified class.
    `EPPCodecComponent` | `getExtension​(java.lang.Class aExtensionClass, boolean aFailOnDuplicate)` | Gets the command extension object with the specified class with the option to fail when a duplicate extension is found.
    `java.util.Vector<EPPCodecComponent>` | `getExtensions()` | Gets the command extensions.
    `java.lang.String` | `getKey()` | Gets the key of the command object.
    `abstract java.lang.String` | `getNamespace()` | Gets the EPP namespace associated with the `EPPCommand`.
    `java.lang.String` | `getOp()` | Gets the string operation of the concrete `EPPCommand`.
    `java.lang.String` | `getTransId()` | Gets the Client Transaction Id associated with the `EPPCommand` .
    `abstract java.lang.String` | `getType()` | Gets command type of the `EPPCommand`.
    `boolean` | `hasExtension​(java.lang.Class aExtensionClass)` | Does the command have a command extension object of a specified class? If so, the command extension object can be retrieved with a call to `getExtensions(Class)`.
    `boolean` | `hasExtensions()` | Does the command have a command extension objects? If so, the command extension objects can be retrieved with a call to `getExtensions`.
    `boolean` | `hasKey()` | Has the key been set?
    `boolean` | `hasTransId()` | Does the command have a client transaction id? If so, the transaction id can be retrieved with a call to `getTransId`.
    `void` | `setExtension​(EPPCodecComponent aExtension)` | Deprecated. Replaced by `addExtension(EPPCodecComponent)`.
    `void` | `setExtensions​(java.util.Vector<EPPCodecComponent> aExtensions)` | Sets the command extension objects.
    `void` | `setTransId​(java.lang.String aTransId)` | Sets the Client Transaction Id associated with the EPPCommand.
    `java.lang.String` | `toString()` | Implementation of `Object.toString`, which will result in an indented XML `String` representation of the concrete `EPPCodecComponent`.

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### TYPE_LOGIN

          public static final java.lang.String TYPE_LOGIN

      command type associated with the general EPP <login> command.
      See Also:
        Constant Field Values

    - #### TYPE_LOGOUT

          public static final java.lang.String TYPE_LOGOUT

      command type associated with the general EPP <logout> command.
      See Also:
        Constant Field Values

    - #### TYPE_INFO

          public static final java.lang.String TYPE_INFO

      command type associated with the general EPP <info> command.
      See Also:
        Constant Field Values

    - #### TYPE_CHECK

          public static final java.lang.String TYPE_CHECK

      command type associated with the general EPP <check> command.
      See Also:
        Constant Field Values

    - #### TYPE_TRANSFER

          public static final java.lang.String TYPE_TRANSFER

      command type associated with the general EPP <transfer> command.
      See Also:
        Constant Field Values

    - #### TYPE_CREATE

          public static final java.lang.String TYPE_CREATE

      command type associated with the general EPP <create> command.
      See Also:
        Constant Field Values

    - #### TYPE_DELETE

          public static final java.lang.String TYPE_DELETE

      command type associated with the general EPP <delete> command.
      See Also:
        Constant Field Values

    - #### TYPE_RENEW

          public static final java.lang.String TYPE_RENEW

      command type associated with the general EPP <renew> command.
      See Also:
        Constant Field Values

    - #### TYPE_UPDATE

          public static final java.lang.String TYPE_UPDATE

      command type associated with the general EPP <update> command.
      See Also:
        Constant Field Values

    - #### TYPE_POLL

          public static final java.lang.String TYPE_POLL

      command type associated with the general EPP <poll> command.
      See Also:
        Constant Field Values

    - #### OP_APPROVE

          public static final java.lang.String OP_APPROVE

      command approve operation currently associated with a <transfer> command.
      See Also:
        Constant Field Values

    - #### OP_CANCEL

          public static final java.lang.String OP_CANCEL

      command cancel operation associated with a <transfer> command.
      See Also:
        Constant Field Values

    - #### OP_QUERY

          public static final java.lang.String OP_QUERY

      command query operation associated with a <transfer> command.
      See Also:
        Constant Field Values

    - #### OP_REJECT

          public static final java.lang.String OP_REJECT

      command reject operation associated with a <transfer> command.
      See Also:
        Constant Field Values

    - #### OP_REQUEST

          public static final java.lang.String OP_REQUEST

      command request operation associated with a <transfer> command.
      See Also:
        Constant Field Values

    - #### transId

          protected java.lang.String transId

      Client Transaction id associated with the command

    - #### extensions

          protected java.util.Vector<EPPCodecComponent> extensions

      Extension objects associated with the command. The extension object is associated with a unique XML Namespace, XML Schema, and can be any simple or complex object that implements the `EPPCodecComponent` interface.

  - ### Constructor Detail

    - #### EPPCommand

          public EPPCommand()

      Allocates a new `EPPCommand` with default attribute values. The defaults include the following:
      - transaction id is set to `null`. This attribute can be set using `setTransId` before invoking `encode`.

    - #### EPPCommand

          public EPPCommand​(java.lang.String aTransId)

      Allocates a new `EPPCommand` setting the client transaction id.
      Parameters:
        `aTransId` - Client Transaction id associated with the command.

  - ### Method Detail

    - #### hasTransId

          public boolean hasTransId()

      Does the command have a client transaction id? If so, the transaction id can be retrieved with a call to `getTransId`.
      Returns:
        `true` if this is a transaction id; `false` otherwise.

    - #### getTransId

          public java.lang.String getTransId()

      Gets the Client Transaction Id associated with the `EPPCommand` .
      Returns:
        `String` instance if defined; null otherwise.

    - #### setTransId

          public void setTransId​(java.lang.String aTransId)

      Sets the Client Transaction Id associated with the EPPCommand.
      Parameters:
        `aTransId` - Client Transaction Id `String`

    - #### getNamespace

          public abstract java.lang.String getNamespace()

      Gets the EPP namespace associated with the `EPPCommand`.
      Specified by:
        `getNamespace` in interface `EPPCodecComponent`
      Specified by:
        `getNamespace` in interface `EPPMessage`
      Returns:
        Namespace URI associated with the `EPPCommand`.

    - #### getType

          public abstract java.lang.String getType()

      Gets command type of the `EPPCommand`. Each command is associated with a single command type equal to one of the `EPPCommand.TYPE_` constants and optionally a command operation equal to one of the `EPPCommand.OP_` constants.
      Returns:
        Command type `String` (`EPPCommand.TYPE_`)

    - #### getOp

          public java.lang.String getOp()

      Gets the string operation of the concrete `EPPCommand`. The type should be equal to one of the `EPPCommand.OP_` constants, or null if there is no operation.
      Returns:
        Operation of concrete EPPCommand if exists; null otherwise.

    - #### hasKey

          public boolean hasKey()

      Has the key been set?
      Returns:
        `true` if the key has been set; `false` otherwise.

    - #### getKey

          public java.lang.String getKey()

      Gets the key of the command object. The key is used for lookup of the existing object, such as the domain name for the domain name object or the contact identifier for the contact object. The concrete commands that have a key need to override this method.
      Returns:
        The command object key if defined; `null` otherwise

    - #### hasExtension

          public boolean hasExtension​(java.lang.Class aExtensionClass)

      Does the command have a command extension object of a specified class? If so, the command extension object can be retrieved with a call to `getExtensions(Class)`.
      Parameters:
        `aExtensionClass` - Command extension class
      Returns:
        `true` if the extension object exists; `false` otherwise.

    - #### getExtension

          public EPPCodecComponent getExtension​(java.lang.Class aExtensionClass)

      Gets the command extension object with the specified class. The extension object is an unspecified element in the EPP Specifications. To create an extension object, an XML Schema for the extension object must exist with a unique XML Namespace. A custom `EPPExtensionFactory` must be created for the extension, which returns an instance of `EPPCodecComponent` for an instance of an extension object in the EPP Command.
      Parameters:
        `aExtensionClass` - of desired extension
      Returns:
        Concrete `EPPCodecComponent` associated with the command if exists; `null` otherwise.

    - #### getExtension

          public EPPCodecComponent getExtension​(java.lang.Class aExtensionClass,
                                                boolean aFailOnDuplicate)
                                         throws EPPDuplicateExtensionException

      Gets the command extension object with the specified class with the option to fail when a duplicate extension is found. The extension object is an unspecified element in the EPP Specifications. To create an extension object, an XML Schema for the extension object must exist with a unique XML Namespace. A custom `EPPExtensionFactory` must be created for the extension, which returns an instance of `EPPCodecComponent` for an instance of an extension object in the `EPPCommand`.
      Parameters:
        `aExtensionClass` - `Class` of desired extension
        `aFailOnDuplicate` - Throw `EPPDuplicateExtensionException` if `true` and a duplicate extension is found
      Returns:
        Concrete `EPPCodecComponent` associated with the command if exists; `null` otherwise.
      Throws:
        `EPPDuplicateExtensionException` - If a duplicate extension is found with the extension included in the extension

    - #### setExtension

          @Deprecated
          public void setExtension​(EPPCodecComponent aExtension)

      Deprecated.
      Replaced by `addExtension(EPPCodecComponent)`. This method will add the extension as is done in `addExtension(EPPCodecComponent)`.
      Sets a command extension object. The extension object is an unspecified element in the EPP Specifications. The unspecified element will be encoded under the <unspec> element of the EPP Command.
      Parameters:
        `aExtension` - command extension object associated with the command

    - #### addExtension

          public void addExtension​(EPPCodecComponent aExtension)

      Adds a command extension object. The extension object is an unspecified element in the EPP Specifications. The unspecified element will be encoded under the <unspec> element of the EPP Command.
      Parameters:
        `aExtension` - command extension object associated with the command

    - #### hasExtensions

          public boolean hasExtensions()

      Does the command have a command extension objects? If so, the command extension objects can be retrieved with a call to `getExtensions`.
      Returns:
        `true` if there are extension objects; `false` otherwise.

    - #### getExtensions

          public java.util.Vector<EPPCodecComponent> getExtensions()

      Gets the command extensions. The extension objects are an unspecified elements in the EPP Specification. To create an extension object, an XML Schema for the extension object must exist with a unique XML Namespace. A custom `EPPExtensionFactory` must be created for the extension, which returns an instance of `EPPCodecComponent` for an instance of an extension object in the EPP Command.
      Returns:
        `Vector` of concrete `EPPCodecComponent` associated with the command if exists; `null` otherwise.

    - #### setExtensions

          public void setExtensions​(java.util.Vector<EPPCodecComponent> aExtensions)

      Sets the command extension objects. The extension objects are an unspecified element in the EPP Specifications. The unspecified element will be encoded under the <unspec> element of the EPP Command.
      Parameters:
        `aExtensions` - command extension objects associated with the command

    - #### findDuplicateExtNamespaces

          public java.util.Set<java.lang.String> findDuplicateExtNamespaces()

      Find the set of duplicate EPP extension XML namespaces based on the list of EPP extensions set in the command.
      Returns:
        `Set` of duplicate EPP extension XML namespaces; `null` otherwise.

    - #### findUnsupportedExtNamespaces

          public java.util.Set<java.lang.String> findUnsupportedExtNamespaces​(java.util.List<java.lang.String> aSupportedExtNamespaces)

      Find the set of unsupported EPP extension XML namespaces based the passed in supported extension XML namespaces and on the list of EPP extensions set in the command.
      Parameters:
        `aSupportedExtNamespaces` - List of EPP extensions to scan for unsupported XML namespaces. Pass `null` for no supported extensions.
      Returns:
        `Set` of unsupported EPP extension XML namespaces; `null` otherwise.

    - #### findUnsupportedExtNamespaceSuffixes

          public java.util.Set<java.lang.String> findUnsupportedExtNamespaceSuffixes​(java.util.List<java.lang.String> aSupportedExtNamespaceSuffixes)

      Find the set of unsupported EPP extensions based on passing the list of supported extension XML namespace suffixes and the list of EPP extensions set in the command.
      Parameters:
        `aSupportedExtNamespaceSuffixes` - List of EPP extensions to scan for unsupported XML namespace suffixes. Pass `null` for no supported extensions.
      Returns:
        `Set` of unsupported EPP extension XML namespace suffixes; `null` otherwise.

    - #### findExtNamespaces

          public java.util.Set<java.lang.String> findExtNamespaces​(java.util.List<java.lang.String> aFilterExtNamespaces)

      Find the set of unique EPP extension XML namespaces based on the list of EPP extensions set in the command.
      Parameters:
        `aFilterExtNamespaces` - Filter extension namespaces from the returned set. Set to `null` for no filtering.
      Returns:
        `Set` of unique EPP extension XML namespaces.

    - #### findExtNamespaceSuffixes

          public java.util.Set<java.lang.String> findExtNamespaceSuffixes​(java.util.List<java.lang.String> aFilterExtNamespaceSuffixes)

      Find the set of unique EPP extension XML namespace suffixes based on the list of EPP extensions set in the command and the optional use of a list of XML namespace suffixes to filter.
      Parameters:
        `aFilterExtNamespaceSuffixes` - Filter extension namespace suffixes from the returned set. Set to `null` for no filtering.
      Returns:
        `Set` of unique EPP extension XML namespace suffixes.

    - #### encode

          public org.w3c.dom.Element encode​(org.w3c.dom.Document aDocument)
                                     throws EPPEncodeException

      encode `EPPCommand` into a DOM element tree. The <command> element is created and the attribute nodes are appending as children. This method is a Template Method in the Template Method Design Pattern.
      Specified by:
        `encode` in interface `EPPCodecComponent`
      Parameters:
        `aDocument` - DOCUMENT ME!
      Returns:
        <command> root element tree.
      Throws:
        `EPPEncodeException` - Error encoding the DOM element tree.

    - #### decode

          public void decode​(org.w3c.dom.Element aElement)
                      throws EPPDecodeException,
                             EPPComponentNotFoundException

      decode `EPPCommand` from a DOM element tree. The "command" element needs to be the value of the `aElement` argument. This method is a Template Method in the Template Method Design Pattern.
      Specified by:
        `decode` in interface `EPPCodecComponent`
      Parameters:
        `aElement` - <command> root element tree.
      Throws:
        `EPPDecodeException` - Error decoding the DOM element tree.
        `EPPComponentNotFoundException` - An extension component could not be found

    - #### equals

          public boolean equals​(java.lang.Object aObject)

      implements a deep `EPPCommand` compare.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `aObject` - `EPPCommand` instance to compare with
      Returns:
        DOCUMENT ME!

    - #### clone

          public java.lang.Object clone()
                                 throws java.lang.CloneNotSupportedException

      Clone `EPPCommand`.
      Specified by:
        `clone` in interface `EPPCodecComponent`
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        clone of `EPPCommand`
      Throws:
        `java.lang.CloneNotSupportedException` - standard Object.clone exception

    - #### toString

          public java.lang.String toString()

      Implementation of `Object.toString`, which will result in an indented XML `String` representation of the concrete `EPPCodecComponent`.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        Indented XML `String` if successful; `ERROR` otherwise.

    - #### doGenEncode

          protected abstract org.w3c.dom.Element doGenEncode​(org.w3c.dom.Document aDocument)
                                                      throws EPPEncodeException

      Encodes the atributes of a general extension of `EPPCommand`. An example of a general extension is `EPPCreateCmd`. `encode` is a Template Method and this method is a Primitive Operation within the Template Method Design Pattern.
      Parameters:
        `aDocument` - DOM document used as a factory of DOM objects.
      Returns:
        instance root DOM element along with attribute child nodes.
      Throws:
        `EPPEncodeException` - Error encoding the DOM element tree.

    - #### doGenDecode

          protected abstract void doGenDecode​(org.w3c.dom.Element aElement)
                                       throws EPPDecodeException

      Decodes the atributes of a general extension of `EPPCommand`. An example of a general extension is `EPPCreateCmd`. `decode` is a Template Method and this method is a Primitive Operation within the Template Method Design Pattern.
      Parameters:
        `aElement` - root DOM element associated with instance
      Throws:
        `EPPDecodeException` - Error decoding the DOM element tree.