Package fr.gouv.vitam.common.database.server.mongodb

# Class VitamDocument<E>

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

Type Parameters:
  `E` - Class used to implement the Document

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

Direct Known Subclasses:
  `AccessContract`, `AccessionRegisterDetail`, `AccessionRegisterSummary`, `AccessionRegisterSymbolic`, `Agencies`, `ArchiveUnitProfile`, `Context`, `FileFormat`, `FileRules`, `Griffin`, `IngestContract`, `LogbookLifeCycle`, `LogbookOperation`, `ManagementContract`, `MetadataDocument`, `MetadataSnapshot`, `Ontology`, `PreservationScenario`, `Profile`, `Schema`, `SecurityProfile`, `VitamSequence`

public abstract class VitamDocument<E> extends org.bson.Document
Vitam Document MongoDb abstract

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[]`
  `ES_FILTER_OUT`
  Filter ES out
  `static final String`
  `ID`
  ID of each line: different for each sub type
  `static final String`
  `IMPLEMENTATIONVERSION`
  Current Vitam Version
  `static final String`
  `SCORE`
  Score
  `static final String`
  `SEDAVERSION`
  Current Seda Version
  `static final String`
  `TENANT_ID`
  TenantId
  `static final String`
  `VERSION`
  Version of the document: Incremented for each main updates (excluding computed fields)

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

  `DEFAULT_CODEC_REGISTRY`

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected VitamDocument<E>`
  `checkId()`
  check if Id is valid
  `static List<String>`
  `getConcernedDiffLines(List<String> diff)`
  Retrieve only + and - lines on diff (for logbook lifecycle) regexp = line started by + or - with at least one space after and any character
  `String`
  `getId()`
  `static List<String>`
  `getOriginalDiffLines(String diff)`
  `final Integer`
  `getTenantId()`
  `static List<String>`
  `getUnifiedDiff(String original, String revised)`
  Get unified diff
  `final Integer`
  `getVersion()`
  `abstract VitamDocument<E>`
  `newInstance(com.fasterxml.jackson.databind.JsonNode content)`
  Make a new instance of the document with the given json
  `String`
  `toString()`
  `String`
  `toStringDirect()`

  ### 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

  - ### ID

    public static final String ID
    ID of each line: different for each sub type
    See Also:
      - Constant Field Values

  - ### VERSION

    public static final String VERSION
    Version of the document: Incremented for each main updates (excluding computed fields)
    See Also:
      - Constant Field Values

  - ### TENANT_ID

    public static final String TENANT_ID
    TenantId
    See Also:
      - Constant Field Values

  - ### SCORE

    public static final String SCORE
    Score
    See Also:
      - Constant Field Values

  - ### SEDAVERSION

    public static final String SEDAVERSION
    Current Seda Version
    See Also:
      - Constant Field Values

  - ### IMPLEMENTATIONVERSION

    public static final String IMPLEMENTATIONVERSION
    Current Vitam Version
    See Also:
      - Constant Field Values

  - ### ES_FILTER_OUT

    public static final String[] ES_FILTER_OUT
    Filter ES out

- ## Constructor Details

  - ### VitamDocument

    public VitamDocument()
    Empty constructor

  - ### VitamDocument

    public VitamDocument(String content)
    Constructor from Json
    Parameters:
      `content` - String
    Throws:
      `IllegalArgumentException` - if Id is not a GUID

  - ### VitamDocument

    public VitamDocument(com.fasterxml.jackson.databind.JsonNode content)
    Constructor from Json
    Parameters:
      `content` - as JsonNode
    Throws:
      `IllegalArgumentException` - if Id is not a GUID

  - ### VitamDocument

    public VitamDocument(org.bson.Document content)
    Constructor from Document
    Parameters:
      `content` - Document
    Throws:
      `IllegalArgumentException` - if Id is not a GUID

- ## Method Details

  - ### newInstance

    public abstract VitamDocument<E> newInstance(com.fasterxml.jackson.databind.JsonNode content)
    Make a new instance of the document with the given json
    Parameters:
      `content` - document structure as json
    Returns:
      new document with the json as content

  - ### checkId

    protected VitamDocument<E> checkId()
    check if Id is valid
    Returns:
      this
    Throws:
      `IllegalArgumentException` - if Id is not a GUID

  - ### getId

    public String getId()
    Returns:
      the ID

  - ### getTenantId

    public final Integer getTenantId()
    Returns:
      the TenantId

  - ### getVersion

    public final Integer getVersion()
    Returns:
      the version

  - ### toStringDirect

    public String toStringDirect()
    Returns:
      the bypass toString

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `org.bson.Document`

  - ### getUnifiedDiff

    public static List<String> getUnifiedDiff(String original, String revised)
    Get unified diff
    Parameters:
      `original` - the original value
      `revised` - the revisited value
    Returns:
      unified diff (each list entry is a diff line)

  - ### getConcernedDiffLines

    public static List<String> getConcernedDiffLines(List<String> diff)
    Retrieve only + and - lines on diff (for logbook lifecycle) regexp = line started by + or - with at least one space after and any character
    Parameters:
      `diff` - the unified diff
    Returns:
      + and - lines for logbook lifecycle

  - ### getOriginalDiffLines

    public static List<String> getOriginalDiffLines(String diff)