public class MongoDbMetadataHelper extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
ADD_TO_SET |
static com.mongodb.BasicDBObject |
ID_PROJECTION
Quick projection for ID Only
|
Modifier and Type | Method and Description |
---|---|
protected static com.mongodb.BasicDBObject |
addLink(MetadataDocument obj1,
fr.gouv.vitam.metadata.core.database.collections.VitamLinks relation,
MetadataDocument obj2)
Add a Link according to relation defined, where the relation is defined in obj1->obj2 way by default (even if
symmetric)
|
static Result |
createOneResult(BuilderToken.FILTERARGS type) |
static Result |
createOneResult(BuilderToken.FILTERARGS type,
Collection<String> set) |
static com.mongodb.client.result.DeleteResult |
delete(MetadataCollections collection,
org.bson.conversions.Bson condition,
int nb) |
static boolean |
exists(MetadataCollections col,
String id)
OK with native id for Results
|
static MetadataDocument |
findOne(MetadataCollections col,
String id)
Find the corresponding id in col collection if it exists.
|
static MetadataDocument |
findOne(MetadataCollections col,
String field,
String ref)
Calls getAfterLoad
|
static MetadataDocument |
findOneNoAfterLoad(MetadataCollections metadataCollections,
String ref)
Does not call getAfterLoad
|
static MetadataDocument |
loadFromDocument(MetadataCollections coll,
org.bson.Document obj)
Load a Document into MetadataDocument>.
|
static org.bson.conversions.Bson |
queryForAncestorsOrSame(Collection<String> targetIds,
Collection<String> ancestorIds)
Used to filter Units/OG according to some Units ancestors
|
static org.bson.conversions.Bson |
queryForImmediateAncestors(Collection<String> targetIds,
Collection<String> ancestorIds)
Used to filter Units/OG according to immediate Unit ancestors
|
static org.bson.conversions.Bson |
queryObjectGroupForAncestors(Collection<String> targetIds,
Collection<String> ancestorIds)
Used to filter Units according to some OG and some Units ancestors
|
static com.mongodb.client.FindIterable<?> |
select(MetadataCollections collection,
org.bson.conversions.Bson condition,
org.bson.conversions.Bson projection)
Does not call getAfterLoad.
|
static com.mongodb.client.FindIterable<?> |
select(MetadataCollections collection,
org.bson.conversions.Bson condition,
org.bson.conversions.Bson projection,
org.bson.conversions.Bson orderBy,
int offset,
int limit)
Does not call getAfterLoad.
|
static com.mongodb.client.FindIterable<?> |
selectFiltered(com.mongodb.client.FindIterable<?> find,
org.bson.conversions.Bson orderBy,
int offset,
int limit)
Aff orderBy and offset and limit if not null or not -1
|
static com.mongodb.client.result.UpdateResult |
update(MetadataCollections collection,
org.bson.conversions.Bson condition,
org.bson.conversions.Bson data,
int nb) |
protected static com.mongodb.BasicDBObject |
updateLink(MetadataDocument obj1,
MetadataDocument vtReloaded,
fr.gouv.vitam.metadata.core.database.collections.VitamLinks relation,
boolean src)
Update the link (1 link type)
|
protected static com.mongodb.BasicDBObject |
updateLinkset(MetadataDocument obj1,
MetadataDocument vtReloaded,
fr.gouv.vitam.metadata.core.database.collections.VitamLinks relation,
boolean src)
Update the linkset (N link type)
|
public static final com.mongodb.BasicDBObject ID_PROJECTION
protected static final String ADD_TO_SET
public static final MetadataDocument findOneNoAfterLoad(MetadataCollections metadataCollections, String ref)
metadataCollections
- (not results except if already hashed)ref
- the reference of MetadataDocument objectpublic static final MetadataDocument loadFromDocument(MetadataCollections coll, org.bson.Document obj) throws InstantiationException, IllegalAccessException
coll
- the working collectionobj
- the documentInstantiationException
- when collection class instantiation exception occurredIllegalAccessException
- when illegal access exception occurredpublic static final MetadataDocument findOne(MetadataCollections col, String field, String ref)
col
- metadata collection (not Results except if already hashed)field
- of collectionref
- reference of collection fieldpublic static final MetadataDocument findOne(MetadataCollections col, String id)
col
- (not results except if already hashed) the working collectionid
- the id value for searching in collection fieldpublic static final boolean exists(MetadataCollections col, String id)
col
- the working collectionid
- the id value for searching in collection fieldpublic static final com.mongodb.client.FindIterable<?> select(MetadataCollections collection, org.bson.conversions.Bson condition, org.bson.conversions.Bson projection)
collection
- domain of requestcondition
- where conditionprojection
- select conditionpublic static final com.mongodb.client.FindIterable<?> select(MetadataCollections collection, org.bson.conversions.Bson condition, org.bson.conversions.Bson projection, org.bson.conversions.Bson orderBy, int offset, int limit)
collection
- domain of requestcondition
- where conditionprojection
- select conditionorderBy
- orderBy conditionoffset
- offset (0 by default)limit
- limit (0 for no limit)public static final com.mongodb.client.FindIterable<?> selectFiltered(com.mongodb.client.FindIterable<?> find, org.bson.conversions.Bson orderBy, int offset, int limit)
find
- orderBy
- offset
- limit
- public static final com.mongodb.client.result.UpdateResult update(MetadataCollections collection, org.bson.conversions.Bson condition, org.bson.conversions.Bson data, int nb) throws MetaDataExecutionException
collection
- domain of requestcondition
- where conditiondata
- the update datanb
- number of item to updateMetaDataExecutionException
- if a mongo operation exception occurredpublic static final com.mongodb.client.result.DeleteResult delete(MetadataCollections collection, org.bson.conversions.Bson condition, int nb) throws MetaDataExecutionException
collection
- domain of requestcondition
- where conditionnb
- nb of item to deleteMetaDataExecutionException
- if a mongo operation exception occurredpublic static final org.bson.conversions.Bson queryObjectGroupForAncestors(Collection<String> targetIds, Collection<String> ancestorIds)
targetIds
- set of target idsancestorIds
- set of ancestor idspublic static final org.bson.conversions.Bson queryForImmediateAncestors(Collection<String> targetIds, Collection<String> ancestorIds)
targetIds
- set of target idancestorIds
- set of ancestor idpublic static final org.bson.conversions.Bson queryForAncestorsOrSame(Collection<String> targetIds, Collection<String> ancestorIds)
targetIds
- set of target idsancestorIds
- set of ancestor idsprotected static final com.mongodb.BasicDBObject addLink(MetadataDocument obj1, fr.gouv.vitam.metadata.core.database.collections.VitamLinks relation, MetadataDocument obj2)
obj1
- relation
- obj2
- BasicDBObject
that hold a possible update part (may be null) as { $addToSet : { field : value }
} or { field : value }protected static final com.mongodb.BasicDBObject updateLink(MetadataDocument obj1, MetadataDocument vtReloaded, fr.gouv.vitam.metadata.core.database.collections.VitamLinks relation, boolean src)
obj1
- vtReloaded
- relation
- src
- protected static final com.mongodb.BasicDBObject updateLinkset(MetadataDocument obj1, MetadataDocument vtReloaded, fr.gouv.vitam.metadata.core.database.collections.VitamLinks relation, boolean src)
obj1
- MetadataDocument objectvtReloaded
- the MetadataDocument object loadedrelation
- src
- public static Result createOneResult(BuilderToken.FILTERARGS type)
type
- of filterpublic static Result createOneResult(BuilderToken.FILTERARGS type, Collection<String> set)
type
- of filterset
- of collection for creating ResultCopyright © 2018 Vitam. All rights reserved.