Package com.orchestranetworks.service

# Class ImportSpecMode

java.lang.Object
com.orchestranetworks.service.ImportSpecMode

public final class ImportSpecMode extends Object
Defines the possible modes for an XML import.

The complete specification of XML imports is available in XML Imports.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final ImportSpecMode`
  `INSERT`
  Insert mode: only record creations are allowed.
  `static final ImportSpecMode`
  `REPLACE`
  Replace (synchronization) mode: if a record with the same primary key exists in the target table, it is updated, otherwise, a new record is inserted; if a record is not present in the source, it is deleted.
  `static final ImportSpecMode`
  `UPDATE`
  Update mode: only modifications of existing records are allowed.
  `static final ImportSpecMode`
  `UPDATE_OR_INSERT`
  Update or insert mode: both record creations and modifications of existing records are allowed.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `format()`
  Returns a persistent identifier for this definition mode.
  `String`
  `getLabel()`
  Returns a human-readable label for this XML import mode.
  `boolean`
  `isInsert()`
  Returns `true` if this is `INSERT` mode.
  `boolean`
  `isReplace()`
  Returns `true` if this is `REPLACE` mode.
  `boolean`
  `isUpdate()`
  Returns `true` if this is `UPDATE` mode.
  `boolean`
  `isUpdateOrInsert()`
  Returns `true` if this is `UPDATE_OR_INSERT` mode.
  `static ImportSpecMode`
  `parse(String aFlag)`
  Returns the definition mode that corresponds to the string specified.
  `String`
  `toString()`

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

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### UPDATE

    public static final ImportSpecMode UPDATE
    Update mode: only modifications of existing records are allowed. If, in the target table, a record with the same primary key does not exist, an error is returned and the whole operation is cancelled.

  - ### INSERT

    public static final ImportSpecMode INSERT
    Insert mode: only record creations are allowed. If a record already exists in the target table with the same primary key as in the source, an error is returned and the whole operation is cancelled.

  - ### UPDATE_OR_INSERT

    public static final ImportSpecMode UPDATE_OR_INSERT
    Update or insert mode: both record creations and modifications of existing records are allowed. If a record with the same primary key exists in the target table, it is updated, otherwise, a new record is inserted.

  - ### REPLACE

    public static final ImportSpecMode REPLACE
    Replace (synchronization) mode: if a record with the same primary key exists in the target table, it is updated, otherwise, a new record is inserted; if a record is not present in the source, it is deleted.

- ## Method Details

  - ### isUpdate

    public boolean isUpdate()
    Returns `true` if this is `UPDATE` mode.

  - ### isInsert

    public boolean isInsert()
    Returns `true` if this is `INSERT` mode.

  - ### isUpdateOrInsert

    public boolean isUpdateOrInsert()
    Returns `true` if this is `UPDATE_OR_INSERT` mode.

  - ### isReplace

    public boolean isReplace()
    Returns `true` if this is `REPLACE` mode.

  - ### format

    public String format()
    Returns a persistent identifier for this definition mode.

    The `ImportSpecMode` can obtained by parsing the persistent identifier using the method `parse(String)`.

    See Also:
      - `parse(String)`

  - ### parse

    public static ImportSpecMode parse(String aFlag)
    Returns the definition mode that corresponds to the string specified.

    The specified string must have been generated by the method `format()`.

    Throws:
      `IllegalArgumentException` - if string specified is an invalid persistent identifier.
    See Also:
      - `format()`

  - ### getLabel

    public String getLabel()
    Returns a human-readable label for this XML import mode.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`