public class Unit extends MetadataDocument<Unit>
Modifier and Type | Field and Description |
---|---|
static String |
ACCESSEND |
static String |
ACCESSRULE
Access Rule
|
static String |
ACCESSRULES |
static String |
APPRAISALEND |
static String |
APPRAISALRULE
Appraisal Rule
|
static String |
APPRAISALRULES |
static String |
CLASSIFICATIONEND |
static String |
CLASSIFICATIONRULE
Classification Rule
|
static String |
CLASSIFICATIONRULES |
static String |
DISSEMINATIONEND |
static String |
DISSEMINATIONRULE
Dissemination Rule
|
static String |
DISSEMINATIONRULES |
static String |
END
Rule end date (computed)
|
static String |
MANAGEMENT
Management : { various rules per themes }
|
static String |
MAXDEPTH
MAXDEPTH : max
|
static String |
MINDEPTH
MINDEPTH : min
|
static String |
REUSEEND |
static String |
REUSERULE
Reuse Rule
|
static String |
REUSERULES |
static String |
RULE
Rule
|
static String |
STORAGEEND |
static String |
STORAGERULE
Storage Rule
|
static String |
STORAGERULES |
static com.mongodb.BasicDBObject |
UNIT_ES_PROJECTION
Es projection (no UPS)
|
static com.mongodb.BasicDBObject |
UNIT_OBJECTGROUP_PROJECTION
Quick projection for ID and ObjectGroup Only
|
static String |
UNIT_TYPE
UnitType : normal or holding scheme
|
static com.mongodb.BasicDBObject |
UNIT_VITAM_MANAGEMENT_PROJECTION
Unit Id, Vitam and Management fields Only projection (no content)
|
static com.mongodb.BasicDBObject |
UNIT_VITAM_PROJECTION
Unit Id, Vitam fields Only projection (no content nor management)
|
static String |
UNITDEPTHS
UNITDEPTHS : { UUID1 : depth2, UUID2 : depth2 }
|
static String |
UNITDEPTHS_POINT |
static String |
UNITUPS
UNITUPS : [ UUID1, UUID2 ]
|
ES_PROJECTION, NBCHILD, OG, OPI, OPS, ORIGINATING_AGENCIES, ORIGINATING_AGENCY, QUALIFIERS, TYPE, UNUSED, UP
ES_FILTER_OUT, ID, SCORE, TENANT_ID, VERSION
Constructor and Description |
---|
Unit()
Empty constructor
|
Unit(org.bson.Document content)
Constructor from Document
|
Unit(com.fasterxml.jackson.databind.JsonNode content)
Constructor from Json
|
Unit(String content)
Constructor from Json as Text
|
Modifier and Type | Method and Description |
---|---|
protected static void |
addIndexes() |
Unit |
addObjectGroup(ObjectGroup data)
Add the link 1-N between Unit and ObjectGroup (update both Unit and ObjectGroup)
|
Unit |
addUnit(Unit unit)
Add the link (N)-N between this Unit and sub Unit (update only subUnit)
|
Unit |
addUnits(List<Unit> units)
Add the link (N)-N between Unit and List of sub Units (update only subUnits)
|
void |
cleanStructure(boolean all)
Used in loop operation to clean the object
|
protected static void |
dropIndexes() |
Unit |
getAfterLoad()
To be called after any automatic load or loadFromJson to update HashMap values.
|
List<String> |
getChildrenUnitIdsFromParent() |
protected com.mongodb.client.MongoCollection<Unit> |
getCollection() |
Map<String,Integer> |
getDepths() |
List<String> |
getFathersUnitIds(boolean remove) |
static int |
getGUIDObjectTypeId() |
int |
getMaxDepth() |
protected MetadataCollections |
getMetadataCollections() |
int |
getMinDepth() |
String |
getObjectGroupId(boolean remove) |
List<org.bson.conversions.Bson> |
getSubDepthList()
Used in ingest (get the next uds including itself with depth +1 for all)
|
List<org.bson.conversions.Bson> |
getSubDepthList(List<Unit> units)
Used in ingest (get the next uds including itself with depth +1 for all)
|
List<String> |
getSubUnitUps()
Used in ingest (get the next ups including itself)
|
boolean |
isImmediateParent(String other)
Check if the current Unit has other Unit as immediate parent
|
boolean |
load()
load the object from the database, ignoring any previous data, except ID
|
MetadataDocument<Unit> |
newInstance(com.fasterxml.jackson.databind.JsonNode content)
Make a new instance of the document with the given json
|
Unit |
putBeforeSave()
To be called before any collection.insert() or update if HashMap values is changed.
|
Unit |
save()
Save the object.
|
protected boolean |
updated()
try to update the object if necessary (difference from the current value in the database)
|
checkId, delete, getDomainId, getId, insert, load, toStringDebug, toStringDirect, update
getConcernedDiffLines, getTenantId, getUnifiedDiff, getVersion, 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 UNITDEPTHS
public static final String UNITDEPTHS_POINT
public static final String UNITUPS
public static final String MINDEPTH
public static final String MAXDEPTH
public static final String MANAGEMENT
public static final String UNIT_TYPE
public static final com.mongodb.BasicDBObject UNIT_OBJECTGROUP_PROJECTION
public static final com.mongodb.BasicDBObject UNIT_ES_PROJECTION
public static final com.mongodb.BasicDBObject UNIT_VITAM_PROJECTION
public static final com.mongodb.BasicDBObject UNIT_VITAM_MANAGEMENT_PROJECTION
public static final String STORAGERULE
public static final String APPRAISALRULE
public static final String ACCESSRULE
public static final String DISSEMINATIONRULE
public static final String REUSERULE
public static final String CLASSIFICATIONRULE
public static final String RULE
public static final String END
public static final String STORAGERULES
public static final String STORAGEEND
public static final String APPRAISALRULES
public static final String APPRAISALEND
public static final String ACCESSRULES
public static final String ACCESSEND
public static final String DISSEMINATIONRULES
public static final String DISSEMINATIONEND
public static final String REUSERULES
public static final String REUSEEND
public static final String CLASSIFICATIONRULES
public static final String CLASSIFICATIONEND
public Unit()
public Unit(com.fasterxml.jackson.databind.JsonNode content)
content
- of type JsonNode for building Unitpublic Unit(org.bson.Document content)
content
- of type Document for building Unitpublic Unit(String content)
content
- of type String for building Unitpublic MetadataDocument<Unit> newInstance(com.fasterxml.jackson.databind.JsonNode content)
VitamDocument
newInstance
in class VitamDocument<Unit>
content
- document structure as jsonpublic static final int getGUIDObjectTypeId()
protected com.mongodb.client.MongoCollection<Unit> getCollection()
getCollection
in class MetadataDocument<Unit>
protected MetadataCollections getMetadataCollections()
getMetadataCollections
in class MetadataDocument<Unit>
public Unit save() throws MetaDataExecutionException
MetadataDocument
save
in class MetadataDocument<Unit>
MetaDataExecutionException
- if an exception on insert/update operations occurredprotected boolean updated() throws MetaDataExecutionException
MetadataDocument
updated
in class MetadataDocument<Unit>
MetaDataExecutionException
public boolean load()
MetadataDocument
load
in class MetadataDocument<Unit>
public Unit getAfterLoad()
MetadataDocument
getAfterLoad
in class MetadataDocument<Unit>
public Unit putBeforeSave()
MetadataDocument
putBeforeSave
in class MetadataDocument<Unit>
public List<org.bson.conversions.Bson> getSubDepthList()
public List<org.bson.conversions.Bson> getSubDepthList(List<Unit> units)
units
- the list of unit to addpublic List<String> getSubUnitUps()
public int getMaxDepth()
public int getMinDepth()
public Unit addUnit(Unit unit) throws MetaDataExecutionException
unit
- for adding the linkMetaDataExecutionException
- when adding exception occurredpublic Unit addUnits(List<Unit> units) throws MetaDataExecutionException
units
- list of units for adding the linkMetaDataExecutionException
- when adding exception occurredpublic List<String> getChildrenUnitIdsFromParent()
public List<String> getFathersUnitIds(boolean remove)
remove
- if remove the link between unitspublic Unit addObjectGroup(ObjectGroup data) throws MetaDataExecutionException
data
- the objectgroup for adding linkMetaDataExecutionException
- when adding exception occurredpublic String getObjectGroupId(boolean remove)
remove
- if remove the linkpublic boolean isImmediateParent(String other)
other
- a unit that could be immediate parent of current unitpublic final void cleanStructure(boolean all)
all
- If true, all items are cleanedprotected static void addIndexes()
protected static void dropIndexes()
Copyright © 2018 Vitam. All rights reserved.