E
- Class associated with this Documentpublic abstract class MetadataDocument<E> extends VitamDocument<E>
Modifier and Type | Field and Description |
---|---|
static String[] |
ES_PROJECTION
Quick projection for ID and ObjectGroup Only
|
static String |
NBCHILD
Number of copies or
Number of Immediate child (Unit) |
static String |
OG
ObjectGroup link (Unit to ObjectGroup)
|
static String |
OPI
Initial Operation (both Unit and ObjectGroup)
|
static String |
OPS
Array of operations (both Unit and ObjectGroup)
|
static String |
ORIGINATING_AGENCIES
ORIGINATING_AGENCIES : list of all originating agencies for unit
|
static String |
ORIGINATING_AGENCY
ORIGINATING_AGENCy : Principal originating agency for unit
|
static String |
QUALIFIERS
Object Type (text, audio, video, document, image, ...) Unit Type (facture, paye, ...)
|
static String |
TYPE
Object Type (text, audio, video, document, image, ...) Unit Type (facture, paye, ...)
|
static String |
UNUSED
Unused field
|
static String |
UP
Parents link (Units or ObjectGroup to parent Units)
|
ES_FILTER_OUT, ID, SCORE, TENANT_ID, VERSION
Constructor and Description |
---|
MetadataDocument()
Empty constructor
|
MetadataDocument(org.bson.Document content)
Constructor from Document
|
MetadataDocument(com.fasterxml.jackson.databind.JsonNode content)
Constructor from Json
|
MetadataDocument(String content)
Constructor from Json as text
|
Modifier and Type | Method and Description |
---|---|
MetadataDocument<E> |
checkId()
Create a new ID
|
MetadataDocument<E> |
delete()
Delete the current object
|
abstract MetadataDocument<E> |
getAfterLoad()
To be called after any automatic load or loadFromJson to update HashMap values.
|
protected abstract com.mongodb.client.MongoCollection<E> |
getCollection() |
int |
getDomainId() |
static int |
getGUIDObjectTypeId() |
String |
getId() |
protected abstract MetadataCollections |
getMetadataCollections() |
protected MetadataDocument<E> |
insert()
Insert the document (only for new): should not be called elsewhere
|
abstract boolean |
load()
load the object from the database, ignoring any previous data, except ID
|
MetadataDocument<E> |
load(String json)
Load from a JSON String
|
abstract MetadataDocument<E> |
putBeforeSave()
To be called before any collection.insert() or update if HashMap values is changed.
|
abstract MetadataDocument<E> |
save()
Save the object.
|
String |
toStringDebug() |
String |
toStringDirect() |
MetadataDocument<E> |
update(org.bson.conversions.Bson update)
Update the object to the database
|
protected abstract boolean |
updated()
try to update the object if necessary (difference from the current value in the database)
|
getConcernedDiffLines, getTenantId, getUnifiedDiff, getVersion, newInstance, toString
append, clear, containsKey, containsValue, entrySet, equals, get, get, getBoolean, getBoolean, getDate, getDouble, getInteger, getInteger, getLong, getObjectId, getString, hashCode, isEmpty, keySet, parse, parse, put, putAll, remove, size, toBsonDocument, toJson, toJson, toJson, toJson, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public static final String QUALIFIERS
public static final String NBCHILD
public static final String TYPE
public static final String UP
public static final String UNUSED
public static final String OG
public static final String OPS
public static final String OPI
public static final String ORIGINATING_AGENCY
public static final String ORIGINATING_AGENCIES
public static final String[] ES_PROJECTION
public MetadataDocument()
public MetadataDocument(com.fasterxml.jackson.databind.JsonNode content)
content
- in JsonNode format for building MetadataDocumentpublic MetadataDocument(org.bson.Document content)
content
- in Document format for building MetadataDocumentpublic MetadataDocument(String content)
content
- in String format for building MetadataDocumentpublic static int getGUIDObjectTypeId()
public MetadataDocument<E> checkId()
checkId
in class VitamDocument<E>
public final String getId()
getId
in class VitamDocument<E>
public final int getDomainId()
public final MetadataDocument<E> load(String json)
json
- in String format for building MetadataDocumentpublic abstract MetadataDocument<E> getAfterLoad()
public abstract MetadataDocument<E> putBeforeSave()
protected abstract com.mongodb.client.MongoCollection<E> getCollection()
protected abstract MetadataCollections getMetadataCollections()
public abstract MetadataDocument<E> save() throws MetaDataExecutionException
MetaDataExecutionException
- if an exception on insert/update operations occurredpublic MetadataDocument<E> update(org.bson.conversions.Bson update) throws MetaDataExecutionException
update
- data of update operationMetaDataExecutionException
- if mongo exception query or illegal argument of query for update operationprotected abstract boolean updated() throws MetaDataExecutionException
MetaDataExecutionException
public abstract boolean load()
protected final MetadataDocument<E> insert() throws MetaDataExecutionException
MetaDataExecutionException
- if mongo exception query or illegal argument of querypublic final MetadataDocument<E> delete() throws MetaDataExecutionException
MetadataDocument
MetaDataExecutionException
- if mongo exception delete request on collectionpublic String toStringDirect()
toStringDirect
in class VitamDocument<E>
public String toStringDebug()
Copyright © 2018 Vitam. All rights reserved.