Package fr.gouv.vitam.metadata.core.database.collections

# Class MetadataDocument<E>

java.lang.Object
org.bson.Document
fr.gouv.vitam.common.database.server.mongodb.VitamDocument<E>
fr.gouv.vitam.metadata.core.database.collections.MetadataDocument<E>

Type Parameters:
  `E` - Class associated with this Document

All Implemented Interfaces:
  `Serializable`, `Map<String,Object>`, `org.bson.conversions.Bson`

Direct Known Subclasses:
  `ObjectGroup`, `Unit`

public abstract class MetadataDocument<E> extends VitamDocument<E>
The default Vitam Type object to be stored in the database (MongoDb/ElasticSearch mode)

See Also:
  - Serialized Form

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface java.util.Map

  `Map.Entry<K,V>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `APPROXIMATE_CREATION_DATE`
  Approximate creation date of Unit / Object Group
  `static final String`
  `APPROXIMATE_UPDATE_DATE`
  Approximate update date of Unit / Object Group
  `static final String`
  `ATOMIC_VERSION`
  Internal version of the document: Incremented for each update (including computed fields)
  `static final String`
  `BATCH_ID`
  `static final String`
  `ERRORS`
  Validation errors
  `static final String`
  `GRAPH_LAST_PERSISTED_DATE`
  Last persisted date of Unit / Object Group
  `static final String`
  `MANAGEMENT_CONTRACT_ID`
  Management contract Id
  `static final String`
  `NBCHILD`
  Number of copies or
  Number of Immediate child (Unit)
  `static final String`
  `OG`
  ObjectGroup link (Unit to ObjectGroup)
  `static final String`
  `OPI`
  Initial Operation (both Unit and ObjectGroup)
  `static final String`
  `OPS`
  Array of operations (both Unit and ObjectGroup)
  `static final String`
  `ORIGINATING_AGENCIES`
  ORIGINATING_AGENCIES : list of all originating agencies for unit
  `static final String`
  `ORIGINATING_AGENCY`
  ORIGINATING_AGENCy : Principal originating agency for unit
  `static final String`
  `QUALIFIERS`
  Object Type (text, audio, video, document, image, ...) Unit Type (facture, paye, ...)
  `static final String`
  `TYPE`
  Object Type (text, audio, video, document, image, ...) Unit Type (facture, paye, ...)
  `static final String`
  `UNITUPS`
  All unit parents
  `static final String`
  `UP`
  Parents link (Units or ObjectGroup to parent Units)
  `static final String`
  `UPLOAD_PATH`

  ### Fields inherited from class fr.gouv.vitam.common.database.server.mongodb.VitamDocument

  `ES_FILTER_OUT, ID, IMPLEMENTATIONVERSION, SCORE, SEDAVERSION, TENANT_ID, VERSION`

  ### Fields inherited from interface org.bson.conversions.Bson

  `DEFAULT_CODEC_REGISTRY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MetadataDocument()`
  Empty constructor
  `MetadataDocument(com.fasterxml.jackson.databind.JsonNode content)`
  Constructor from Json
  `MetadataDocument(String content)`
  Constructor from Json as text
  `MetadataDocument(org.bson.Document content)`
  Constructor from Document

- ## Method Summary

  Modifier and Type
  Method
  Description
  `MetadataDocument<E>`
  `checkId()`
  Create a new ID
  `Integer`
  `getAtomicVersion()`
  `protected abstract com.mongodb.client.MongoCollection<E>`
  `getCollection()`
  `<T> Collection<T>`
  `getCollectionOrEmpty(String name)`
  `final String`
  `getId()`
  `<V> Map<String,V>`
  `getMapOrEmpty(String name)`
  `protected abstract MetadataCollections`
  `getMetadataCollections()`
  `String`
  `getSp()`
  `Collection<String>`
  `getUp()`
  `void`
  `setApproximateCreationDate(LocalDateTime creationDate)`
  `void`
  `setApproximateUpdateDate(LocalDateTime lastUpdate)`
  `String`
  `toStringDebug()`
  `String`
  `toStringDirect()`

  ### Methods inherited from class fr.gouv.vitam.common.database.server.mongodb.VitamDocument

  `getConcernedDiffLines, getOriginalDiffLines, getTenantId, getUnifiedDiff, getVersion, newInstance, toString`

  ### Methods inherited from class org.bson.Document

  `append, clear, containsKey, containsValue, entrySet, equals, get, get, get, getBoolean, getBoolean, getDate, getDouble, getEmbedded, getEmbedded, getInteger, getInteger, getList, getList, getLong, getObjectId, getString, hashCode, isEmpty, keySet, parse, parse, put, putAll, remove, size, toBsonDocument, toJson, toJson, toJson, toJson, values`

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

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.bson.conversions.Bson

  `toBsonDocument`

  ### Methods inherited from interface java.util.Map

  `compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll`

- ## Field Details

  - ### ATOMIC_VERSION

    public static final String ATOMIC_VERSION
    Internal version of the document: Incremented for each update (including computed fields)
    See Also:
      - Constant Field Values

  - ### QUALIFIERS

    public static final String QUALIFIERS
    Object Type (text, audio, video, document, image, ...) Unit Type (facture, paye, ...)
    See Also:
      - Constant Field Values

  - ### NBCHILD

    public static final String NBCHILD
    Number of copies or
    Number of Immediate child (Unit)
    See Also:
      - Constant Field Values

  - ### MANAGEMENT_CONTRACT_ID

    public static final String MANAGEMENT_CONTRACT_ID
    Management contract Id
    See Also:
      - Constant Field Values

  - ### TYPE

    public static final String TYPE
    Object Type (text, audio, video, document, image, ...) Unit Type (facture, paye, ...)
    See Also:
      - Constant Field Values

  - ### UP

    public static final String UP
    Parents link (Units or ObjectGroup to parent Units)
    See Also:
      - Constant Field Values

  - ### OG

    public static final String OG
    ObjectGroup link (Unit to ObjectGroup)
    See Also:
      - Constant Field Values

  - ### OPS

    public static final String OPS
    Array of operations (both Unit and ObjectGroup)
    See Also:
      - Constant Field Values

  - ### OPI

    public static final String OPI
    Initial Operation (both Unit and ObjectGroup)
    See Also:
      - Constant Field Values

  - ### ORIGINATING_AGENCY

    public static final String ORIGINATING_AGENCY
    ORIGINATING_AGENCy : Principal originating agency for unit
    See Also:
      - Constant Field Values

  - ### ORIGINATING_AGENCIES

    public static final String ORIGINATING_AGENCIES
    ORIGINATING_AGENCIES : list of all originating agencies for unit
    See Also:
      - Constant Field Values

  - ### UNITUPS

    public static final String UNITUPS
    All unit parents
    See Also:
      - Constant Field Values

  - ### GRAPH_LAST_PERSISTED_DATE

    public static final String GRAPH_LAST_PERSISTED_DATE
    Last persisted date of Unit / Object Group
    See Also:
      - Constant Field Values

  - ### APPROXIMATE_CREATION_DATE

    public static final String APPROXIMATE_CREATION_DATE
    Approximate creation date of Unit / Object Group
    See Also:
      - Constant Field Values

  - ### APPROXIMATE_UPDATE_DATE

    public static final String APPROXIMATE_UPDATE_DATE
    Approximate update date of Unit / Object Group
    See Also:
      - Constant Field Values

  - ### BATCH_ID

    public static final String BATCH_ID
    See Also:
      - Constant Field Values

  - ### UPLOAD_PATH

    public static final String UPLOAD_PATH
    See Also:
      - Constant Field Values

  - ### ERRORS

    public static final String ERRORS
    Validation errors
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### MetadataDocument

    public MetadataDocument()
    Empty constructor

  - ### MetadataDocument

    public MetadataDocument(com.fasterxml.jackson.databind.JsonNode content)
    Constructor from Json
    Parameters:
      `content` - in JsonNode format for building MetadataDocument

  - ### MetadataDocument

    public MetadataDocument(org.bson.Document content)
    Constructor from Document
    Parameters:
      `content` - in Document format for building MetadataDocument

  - ### MetadataDocument

    public MetadataDocument(String content)
    Constructor from Json as text
    Parameters:
      `content` - in String format for building MetadataDocument

- ## Method Details

  - ### checkId

    public MetadataDocument<E> checkId()
    Create a new ID
    Overrides:
      `checkId` in class `VitamDocument<E>`
    Returns:
      this MetadataDocument

  - ### getId

    public final String getId()
    Overrides:
      `getId` in class `VitamDocument<E>`
    Returns:
      the ID

  - ### getCollection

    protected abstract com.mongodb.client.MongoCollection<E> getCollection()
    Returns:
      the associated collection

  - ### getMetadataCollections

    protected abstract MetadataCollections getMetadataCollections()
    Returns:
      the associated VitamCollection

  - ### toStringDirect

    public String toStringDirect()
    Overrides:
      `toStringDirect` in class `VitamDocument<E>`
    Returns:
      the bypass toString

  - ### toStringDebug

    public String toStringDebug()
    Returns:
      the toString for Debug mode

  - ### getCollectionOrEmpty

    public <T> Collection<T> getCollectionOrEmpty(String name)

  - ### getMapOrEmpty

    public <V> Map<String,V> getMapOrEmpty(String name)

  - ### getSp

    public String getSp()

  - ### getUp

    public Collection<String> getUp()

  - ### getAtomicVersion

    public Integer getAtomicVersion()

  - ### setApproximateCreationDate

    public void setApproximateCreationDate(LocalDateTime creationDate)

  - ### setApproximateUpdateDate

    public void setApproximateUpdateDate(LocalDateTime lastUpdate)