Package com.verisign.epp.codec.domain

## Class EPPDomainAddRemove

- java.lang.Object
- - com.verisign.epp.codec.domain.EPPDomainAddRemove

- All Implemented Interfaces:
    `EPPCodecComponent`, `java.io.Serializable`, `java.lang.Cloneable`

      public class EPPDomainAddRemove
      extends java.lang.Object
      implements EPPCodecComponent

  Represents attributes to add, remove or change with a `EPPDomainUpdateCmd`. In `EPPDomainUpdateCmd`, an instance of `EPPDomainAddRemove` is used to specify the attributes to add; an instance of `EPPDomainAddRemove` is used to specify the attributes to remove, and an instance of `EPPDomainAddRemove` is used to specify the attributes to change
  The Domain Mapping Specification describes the following attributes:
  - Zero or more <domain:ns> elements that contain the fully qualified host name of a known host object. Use `getServers` and `setServers` to get and set the element.
  - Zero or more <domain:contact> elements that contain the registrant, administrative, technical, and billing contact identifiers to be associated with the domain. Use `getContacts` and `setContacts` to get and set the element. This attribute will only be allowed if the Contact Mapping is supported.
  - One or two <domain:status> elements that contain status values to be applied to or removed from the domain object. Use `getStatuses` and `setStatuses` to get and set the element.
  - For `change` only, A <domain:registrant> element that contains the identifier for the human or organizational social information (contact) object to be associated with the domain object as the object registrant. This object identifier MUST be known to the server before the contact object can be associated with the domain object. Use `getRegistrant` and `setRegistrant` to get and set the element.
  It is important to note that the maximum number of domain attribute elements is subject to the number of values currently associated with the domain object. `EPPDomainAddRemove` will delegate the validation of the cardinality of the domain attributes elements to the EPP Server.
  See Also:
    `EPPDomainUpdateCmd`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static short` | `MODE_ADD` | mode of `EPPDomainAddRemove` is to add attributes.
    `static short` | `MODE_REMOVE` | mode of `EPPDomainAddRemove` is to remove attributes.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `EPPDomainAddRemove()` | Default constructor for `EPPDomainAddRemove`.
    `EPPDomainAddRemove​(java.lang.String aRegistrant, EPPAuthInfo aAuthInfo)` | Constructor for `EPPDomainAddRemove` that includes the attributes as arguments.
    `EPPDomainAddRemove​(java.util.Vector<?> aServers, java.util.Vector<EPPDomainContact> aContacts, java.util.Vector<EPPDomainStatus> aStatuses)` | Constructor for `EPPDomainAddRemove` that includes the attributes as arguments.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addContact​(EPPDomainContact aContact)` | Add a contact to the list of contacts.
    `void` | `addServer​(EPPHostAttr aServer)` | Add a name server host attribute to the list of name servers.
    `void` | `addServer​(java.lang.String aServer)` | Add a name server to the list of name servers.
    `void` | `addStatus​(EPPDomainStatus aStatus)` | Add a status to the list of statuses.
    `java.lang.Object` | `clone()` | Clone `EPPDomainAddRemove`.
    `boolean` | `contactsSupported()` | Return if Domain Contacts is supported.
    `void` | `decode​(org.w3c.dom.Element aElement)` | Decode the `EPPDomainAddRemove` attributes from the aElement DOM Element tree.
    `org.w3c.dom.Element` | `encode​(org.w3c.dom.Document aDocument)` | Encode a DOM Element tree from the attributes of the `EPPDomainAddRemove` instance.
    `boolean` | `equals​(java.lang.Object aObject)` | implements a deep `EPPDomainAddRemove` compare.
    `EPPAuthInfo` | `getAuthInfo()` | Get authorization information for the change mode
    `java.util.Vector<EPPDomainContact>` | `getContacts()` | Gets the contacts to add or remove.
    `java.lang.String` | `getNamespace()` | Returns the XML namespace associated with the `EPPCodecComponent`.
    `java.lang.String` | `getRegistrant()` | Get registrant for the change mode
    `java.util.Vector<?>` | `getServers()` | Gets the name servers.
    `java.util.Vector<EPPDomainStatus>` | `getStatuses()` | Gets the statuses to add or remove.
    `boolean` | `hasAuthInfo()` | Is the authorization information set?
    `boolean` | `hasContacts()` | Are contacts set?
    `boolean` | `hasRegistrant()` | is the registrant set?
    `boolean` | `hasServers()` | Are name servers set?
    `boolean` | `hasStatuses()` | Are statuses set?
    `boolean` | `isEmpty()` | Is the `EPPDomainAddRemove` empty?
    `void` | `setAuthInfo​(EPPAuthInfo aAuthInfo)` | Set authorization information for the change mode
    `void` | `setContacts​(java.util.Vector<EPPDomainContact> aContacts)` | Sets the contacts to add or remove.
    `void` | `setRegistrant​(java.lang.String aRegistrant)` | Set registrant for the change mode.
    `void` | `setServers​(java.util.Vector<?> aServers)` | Sets the name servers.
    `void` | `setStatuses​(java.util.Vector<EPPDomainStatus> aStatuses)` | Sets the statuses to add or remove.
    `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

    - #### MODE_ADD

          public static final short MODE_ADD

      mode of `EPPDomainAddRemove` is to add attributes.
      See Also:
        Constant Field Values

    - #### MODE_REMOVE

          public static final short MODE_REMOVE

      mode of `EPPDomainAddRemove` is to remove attributes.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### EPPDomainAddRemove

          public EPPDomainAddRemove()

      Default constructor for `EPPDomainAddRemove`. All of the attribute default to `null` to indicate no modification.

    - #### EPPDomainAddRemove

          public EPPDomainAddRemove​(java.util.Vector<?> aServers,
                                    java.util.Vector<EPPDomainContact> aContacts,
                                    java.util.Vector<EPPDomainStatus> aStatuses)

      Constructor for `EPPDomainAddRemove` that includes the attributes as arguments.
      Parameters:
        `aServers` - Vector of Name Server that are either name server `String` or `EPPHostAttr` objects. Is `null` or empty for no modifications.
        `aContacts` - Vector of `EPPDomainContact` instances. Is `null` or empty for no modifications. If the Contact Mapping is not supported, this value should be `null`.
        `aStatuses` - Vector of `EPPDomainStatus` instances. Is `null` or empty for no modifications.

    - #### EPPDomainAddRemove

          public EPPDomainAddRemove​(java.lang.String aRegistrant,
                                    EPPAuthInfo aAuthInfo)

      Constructor for `EPPDomainAddRemove` that includes the attributes as arguments.
      Parameters:
        `aRegistrant` - `String` registrant for the change mode
        `aAuthInfo` - `EPPAuthInfo` authorization information for the change mode

  - ### Method Detail

    - #### hasServers

          public boolean hasServers()

      Are name servers set?
      Returns:
        `true` if name servers are set; `false` otherwise.

    - #### addServer

          public void addServer​(java.lang.String aServer)

      Add a name server to the list of name servers.
      Parameters:
        `aServer` - Name server to add

    - #### addServer

          public void addServer​(EPPHostAttr aServer)

      Add a name server host attribute to the list of name servers.
      Parameters:
        `aServer` - Name server to add

    - #### getServers

          public java.util.Vector<?> getServers()

      Gets the name servers. The name servers can either be `String` instances containing the fully qualified name of a known name server host object, or `EPPHostAttr` instances containing the fully qualified name of a host and optionally the host IP addresses.
      Returns:
        `Vector` of name server `String` instances for host object references or `EPPHostAttr` instances for host attribute values if exists; `null` otherwise.

    - #### setServers

          public void setServers​(java.util.Vector<?> aServers)

      Sets the name servers. The name servers can either be `String` instances containing the fully qualified name of a known name server host object, or `EPPHostAttr` instances containing the fully qualified name of a host and optionally the host IP addresses.
      Parameters:
        `aServers` - `Vector` of name server `String` instances for host object references or `EPPHostAttr` instances for host attribute values.

    - #### hasContacts

          public boolean hasContacts()

      Are contacts set?
      Returns:
        `true` if contacts are set; `false` otherwise.

    - #### addContact

          public void addContact​(EPPDomainContact aContact)

      Add a contact to the list of contacts.
      Parameters:
        `aContact` - Contact to add

    - #### getContacts

          public java.util.Vector<EPPDomainContact> getContacts()

      Gets the contacts to add or remove.
      Returns:
        Vector of `EPPDomainContact` instances if set; `null` otherwise.

    - #### setContacts

          public void setContacts​(java.util.Vector<EPPDomainContact> aContacts)

      Sets the contacts to add or remove.
      Parameters:
        `aContacts` - The contacts to add or remove.

    - #### hasStatuses

          public boolean hasStatuses()

      Are statuses set?
      Returns:
        `true` if statuses are set; `false` otherwise.

    - #### addStatus

          public void addStatus​(EPPDomainStatus aStatus)

      Add a status to the list of statuses.
      Parameters:
        `aStatus` - Status to add

    - #### getStatuses

          public java.util.Vector<EPPDomainStatus> getStatuses()

      Gets the statuses to add or remove.
      Returns:
        Vector of status `EPPDomainStatus` instances if set; `null` otherwise.

    - #### setStatuses

          public void setStatuses​(java.util.Vector<EPPDomainStatus> aStatuses)

      Sets the statuses to add or remove.
      Parameters:
        `aStatuses` - Vector of status `EPPDomainStatus` instances.

    - #### contactsSupported

          public boolean contactsSupported()

      Return if Domain Contacts is supported.
      Returns:
        `true` if contacts are supported; `false` otherwise.

    - #### encode

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

      Encode a DOM Element tree from the attributes of the `EPPDomainAddRemove` instance.
      Specified by:
        `encode` in interface `EPPCodecComponent`
      Parameters:
        `aDocument` - DOM Document that is being built. Used as an Element factory.
      Returns:
        Root DOM Element representing the `EPPDomainAddRemove` instance.
      Throws:
        `EPPEncodeException` - Unable to encode `EPPDomainAddRemove` instance.

    - #### decode

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

      Decode the `EPPDomainAddRemove` attributes from the aElement DOM Element tree.
      Specified by:
        `decode` in interface `EPPCodecComponent`
      Parameters:
        `aElement` - Root DOM Element to decode `EPPDomainAddRemove` from.
      Throws:
        `EPPDecodeException` - Unable to decode aElement.

    - #### equals

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

      implements a deep `EPPDomainAddRemove` compare.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `aObject` - `EPPDomainAddRemove` instance to compare with
      Returns:
        `true` when equal; `false` otherwise.

    - #### clone

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

      Clone `EPPDomainAddRemove`.
      Specified by:
        `clone` in interface `EPPCodecComponent`
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        clone of `EPPDomainAddRemove`
      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.

    - #### hasAuthInfo

          public boolean hasAuthInfo()

      Is the authorization information set?
      Returns:
        `true` if the authorization information is set; `false` otherwise.

    - #### getAuthInfo

          public EPPAuthInfo getAuthInfo()

      Get authorization information for the change mode
      Returns:
        `EPPAuthInfo` if set; `null` otherwise.

    - #### setAuthInfo

          public void setAuthInfo​(EPPAuthInfo aAuthInfo)

      Set authorization information for the change mode
      Parameters:
        `aAuthInfo` - `EPPAuthInfo` instance. Pass `null` to unset it.

    - #### hasRegistrant

          public boolean hasRegistrant()

      is the registrant set?
      Returns:
        `true` if the registrant is set; `false` otherwise.

    - #### getRegistrant

          public java.lang.String getRegistrant()

      Get registrant for the change mode
      Returns:
        Registrant if set; `null` otherwise.

    - #### setRegistrant

          public void setRegistrant​(java.lang.String aRegistrant)

      Set registrant for the change mode.
      Parameters:
        `aRegistrant` - Registrant to set. Pass `null` to unset it.

    - #### isEmpty

          public boolean isEmpty()

      Is the `EPPDomainAddRemove` empty?
      Returns:
        `true` if all of the attributes are not set; `false` otherwise.

    - #### getNamespace

          public java.lang.String getNamespace()

      Returns the XML namespace associated with the `EPPCodecComponent`.
      Specified by:
        `getNamespace` in interface `EPPCodecComponent`
      Returns:
        XML namespace for the `EPPCodecComponent`.