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:
  • Field Details

  • 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)