Interface GraphComputeService
-
- All Superinterfaces:
java.lang.AutoCloseable
,VitamAutoCloseable
,VitamCache<java.lang.String,org.bson.Document>
- All Known Implementing Classes:
GraphComputeServiceImpl
public interface GraphComputeService extends VitamCache<java.lang.String,org.bson.Document>, VitamAutoCloseable
This class get units where calculated data are modified Zip generated files and store the zipped file in the offer.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
$_INC
static java.lang.String
$_SET
static java.lang.String
$_UNSET
static java.lang.Integer
concurrencyLevel
static java.util.concurrent.ExecutorService
executor
static int
START_DEPTH
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
bulkElasticsearch(MetadataCollections metaDaCollection, java.util.List<org.bson.Document> collection)
Bulk save in elasticsearchvoid
bulkElasticsearch(MetadataCollections metaDaCollection, java.util.Set<java.lang.String> collection)
Bulk save in elasticsearchvoid
bulkUpdateMongo(MetadataCollections metaDaCollection, java.util.List<com.mongodb.client.model.WriteModel<org.bson.Document>> collection)
Bulk write in mongodbGraphComputeResponse
computeGraph(com.fasterxml.jackson.databind.JsonNode queryDSL)
If workflow of compute graph in progress, do not execute this method Should be exposed in the APIdefault void
computeGraph(MetadataCollections metadataCollections, java.util.List<org.bson.Document> documents, boolean invalidateComputedInheritedRules)
Generic method to calculate graph for unit and object groupGraphComputeResponse
computeGraph(MetadataCollections metadataCollections, java.util.Set<java.lang.String> unitsId, boolean computeObjectGroupGraph, boolean invalidateComputedInheritedRules)
Compute graph for unit/got from all parentsdefault void
computeObjectGroupGraph(java.util.Set<java.lang.String> originatingAgencies, java.util.Set<java.lang.String> unitParents, java.util.List<java.lang.String> up)
For ObjectGroup, we only get graph data (sps) from only unit represents (up) We do not loop over all parent of parent until root units As not concurrence expected, no problem of inconsistency, Else, if parallel compute is needed, then, we have to loop over all units (until root units) or to implements optimistic lock on _glpddefault com.mongodb.client.model.UpdateOneModel<org.bson.Document>
computeObjectGroupGraph(org.bson.Document document)
Create update model for ObjectGroupdefault com.mongodb.client.model.UpdateOneModel<org.bson.Document>
computeUnitGraph(org.bson.Document document, boolean invalidateComputedInheritedRules)
Create update model for Unitdefault void
computeUnitGraphUsingDirectParents(java.util.List<GraphRelation> graphRels, java.lang.String unitId, java.util.List<java.lang.String> up, int currentDepth)
Recursive method that compute graph using only _up With global (by reference variable graphRels, we get all needed informations from all parent of the given unit unitId.boolean
isInProgress()
default void
preLoadCache(java.util.List<org.bson.Document> documents)
Get data from database and pre-populate unitCache-
Methods inherited from interface fr.gouv.vitam.common.model.VitamAutoCloseable
close
-
Methods inherited from interface fr.gouv.vitam.common.cache.VitamCache
getCache
-
-
-
-
Field Detail
-
$_SET
static final java.lang.String $_SET
- See Also:
- Constant Field Values
-
$_INC
static final java.lang.String $_INC
- See Also:
- Constant Field Values
-
$_UNSET
static final java.lang.String $_UNSET
- See Also:
- Constant Field Values
-
START_DEPTH
static final int START_DEPTH
- See Also:
- Constant Field Values
-
concurrencyLevel
static final java.lang.Integer concurrencyLevel
-
executor
static final java.util.concurrent.ExecutorService executor
-
-
Method Detail
-
computeGraph
GraphComputeResponse computeGraph(com.fasterxml.jackson.databind.JsonNode queryDSL) throws MetaDataException
If workflow of compute graph in progress, do not execute this method Should be exposed in the API- Returns:
- the map of collection:number of treated documents
- Throws:
MetaDataException
-
computeGraph
GraphComputeResponse computeGraph(MetadataCollections metadataCollections, java.util.Set<java.lang.String> unitsId, boolean computeObjectGroupGraph, boolean invalidateComputedInheritedRules)
Compute graph for unit/got from all parents- Parameters:
metadataCollections
- the collection concerned by the build of the graphunitsId
- the collection of units subject of computing graphcomputeObjectGroupGraph
- true mean compute graphinvalidateComputedInheritedRules
-- Returns:
- The collection of object group treated or to be treated bu an other process. This collection contains got's id of concerning units. Empty collection is returned if computeGraph of object group.
-
preLoadCache
default void preLoadCache(java.util.List<org.bson.Document> documents) throws MetaDataException
Get data from database and pre-populate unitCache- Parameters:
documents
-- Throws:
MetaDataException
-
computeGraph
default void computeGraph(MetadataCollections metadataCollections, java.util.List<org.bson.Document> documents, boolean invalidateComputedInheritedRules) throws MetaDataException
Generic method to calculate graph for unit and object group- Parameters:
metadataCollections
- the type the collection (Unit or ObjectGroup)documents
- the concerning collection of documentsinvalidateComputedInheritedRules
-- Throws:
MetaDataException
-
computeUnitGraph
default com.mongodb.client.model.UpdateOneModel<org.bson.Document> computeUnitGraph(org.bson.Document document, boolean invalidateComputedInheritedRules) throws VitamRuntimeException
Create update model for Unit- Parameters:
document
-- Returns:
- UpdateOneModel for Unit
- Throws:
MetaDataException
VitamRuntimeException
-
computeObjectGroupGraph
default com.mongodb.client.model.UpdateOneModel<org.bson.Document> computeObjectGroupGraph(org.bson.Document document) throws VitamRuntimeException
Create update model for ObjectGroup- Parameters:
document
-- Returns:
- UpdateOneModel for ObjectGroup
- Throws:
MetaDataException
VitamRuntimeException
-
computeUnitGraphUsingDirectParents
default void computeUnitGraphUsingDirectParents(java.util.List<GraphRelation> graphRels, java.lang.String unitId, java.util.List<java.lang.String> up, int currentDepth) throws VitamRuntimeException
Recursive method that compute graph using only _up With global (by reference variable graphRels, we get all needed informations from all parent of the given unit unitId.- Parameters:
graphRels
-unitId
-up
-currentDepth
- the current depth, initially equals to 1- Throws:
java.util.concurrent.ExecutionException
VitamRuntimeException
-
computeObjectGroupGraph
default void computeObjectGroupGraph(java.util.Set<java.lang.String> originatingAgencies, java.util.Set<java.lang.String> unitParents, java.util.List<java.lang.String> up) throws VitamRuntimeException
For ObjectGroup, we only get graph data (sps) from only unit represents (up) We do not loop over all parent of parent until root units As not concurrence expected, no problem of inconsistency, Else, if parallel compute is needed, then, we have to loop over all units (until root units) or to implements optimistic lock on _glpd- Parameters:
originatingAgencies
-unitParents
-up
-- Throws:
VitamRuntimeException
-
bulkUpdateMongo
void bulkUpdateMongo(MetadataCollections metaDaCollection, java.util.List<com.mongodb.client.model.WriteModel<org.bson.Document>> collection) throws DatabaseException
Bulk write in mongodb- Parameters:
metaDaCollection
-collection
-- Throws:
DatabaseException
-
bulkElasticsearch
void bulkElasticsearch(MetadataCollections metaDaCollection, java.util.Set<java.lang.String> collection) throws DatabaseException
Bulk save in elasticsearch- Parameters:
metaDaCollection
-collection
- of id of documents- Throws:
DatabaseException
-
bulkElasticsearch
void bulkElasticsearch(MetadataCollections metaDaCollection, java.util.List<org.bson.Document> collection) throws DatabaseException
Bulk save in elasticsearch- Parameters:
metaDaCollection
-collection
- of documents- Throws:
DatabaseException
-
isInProgress
boolean isInProgress()
-
-