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:
java.io.Serializable
,java.util.Map<java.lang.String,java.lang.Object>
,org.bson.conversions.Bson
- Direct Known Subclasses:
AccessContract
,AccessionRegisterDetail
,AccessionRegisterSummary
,AccessionRegisterSymbolic
,Agencies
,ArchiveUnitProfile
,Context
,FileFormat
,FileRules
,Griffin
,IngestContract
,LogbookLifeCycle
,LogbookOperation
,ManagementContract
,MetadataDocument
,Ontology
,PreservationScenario
,Profile
,SecurityProfile
,VitamSequence
public abstract class VitamDocument<E> extends org.bson.Document
Vitam Document MongoDb abstract- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]
ES_FILTER_OUT
Filter ES outstatic java.lang.String
ID
ID of each line: different for each sub typestatic java.lang.String
IMPLEMENTATIONVERSION
Current Vitam Versionstatic java.lang.String
SCORE
Scorestatic java.lang.String
SEDAVERSION
Current Seda Versionstatic java.lang.String
TENANT_ID
TenantIdstatic java.lang.String
VERSION
Version of the document: Incremented for each main updates (excluding computed fields)
-
Constructor Summary
Constructors Constructor Description VitamDocument()
Empty constructorVitamDocument(com.fasterxml.jackson.databind.JsonNode content)
Constructor from JsonVitamDocument(java.lang.String content)
Constructor from JsonVitamDocument(org.bson.Document content)
Constructor from Document
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected VitamDocument<E>
checkId()
check if Id is validstatic java.util.List<java.lang.String>
getConcernedDiffLines(java.util.List<java.lang.String> diff)
Retrieve only + and - lines on diff (for logbook lifecycle) regexp = line started by + or - with at least one space after and any characterjava.lang.String
getId()
static java.util.List<java.lang.String>
getOriginalDiffLines(java.lang.String diff)
java.lang.Integer
getTenantId()
static java.util.List<java.lang.String>
getUnifiedDiff(java.lang.String original, java.lang.String revised)
Get unified diffjava.lang.Integer
getVersion()
abstract VitamDocument<E>
newInstance(com.fasterxml.jackson.databind.JsonNode content)
Make a new instance of the document with the given jsonjava.lang.String
toString()
java.lang.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
-
-
-
-
Field Detail
-
ID
public static final java.lang.String ID
ID of each line: different for each sub type- See Also:
- Constant Field Values
-
VERSION
public static final java.lang.String VERSION
Version of the document: Incremented for each main updates (excluding computed fields)- See Also:
- Constant Field Values
-
TENANT_ID
public static final java.lang.String TENANT_ID
TenantId- See Also:
- Constant Field Values
-
SCORE
public static final java.lang.String SCORE
Score- See Also:
- Constant Field Values
-
SEDAVERSION
public static final java.lang.String SEDAVERSION
Current Seda Version- See Also:
- Constant Field Values
-
IMPLEMENTATIONVERSION
public static final java.lang.String IMPLEMENTATIONVERSION
Current Vitam Version- See Also:
- Constant Field Values
-
ES_FILTER_OUT
public static final java.lang.String[] ES_FILTER_OUT
Filter ES out
-
-
Constructor Detail
-
VitamDocument
public VitamDocument()
Empty constructor
-
VitamDocument
public VitamDocument(java.lang.String content)
Constructor from Json- Parameters:
content
- String- Throws:
java.lang.IllegalArgumentException
- if Id is not a GUID
-
VitamDocument
public VitamDocument(com.fasterxml.jackson.databind.JsonNode content)
Constructor from Json- Parameters:
content
- as JsonNode- Throws:
java.lang.IllegalArgumentException
- if Id is not a GUID
-
VitamDocument
public VitamDocument(org.bson.Document content)
Constructor from Document- Parameters:
content
- Document- Throws:
java.lang.IllegalArgumentException
- if Id is not a GUID
-
-
Method Detail
-
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:
java.lang.IllegalArgumentException
- if Id is not a GUID
-
getId
public java.lang.String getId()
- Returns:
- the ID
-
getTenantId
public final java.lang.Integer getTenantId()
- Returns:
- the TenantId
-
getVersion
public final java.lang.Integer getVersion()
- Returns:
- the version
-
toStringDirect
public java.lang.String toStringDirect()
- Returns:
- the bypass toString
-
toString
public java.lang.String toString()
- Overrides:
toString
in classorg.bson.Document
-
getUnifiedDiff
public static java.util.List<java.lang.String> getUnifiedDiff(java.lang.String original, java.lang.String revised)
Get unified diff- Parameters:
original
- the original valuerevised
- the revisited value- Returns:
- unified diff (each list entry is a diff line)
-
getConcernedDiffLines
public static java.util.List<java.lang.String> getConcernedDiffLines(java.util.List<java.lang.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 java.util.List<java.lang.String> getOriginalDiffLines(java.lang.String diff)
-
-