Class GraphComputeServiceImpl
- java.lang.Object
-
- fr.gouv.vitam.metadata.core.graph.GraphComputeServiceImpl
-
- All Implemented Interfaces:
VitamCache<java.lang.String,org.bson.Document>
,VitamAutoCloseable
,GraphComputeService
,java.lang.AutoCloseable
public class GraphComputeServiceImpl extends java.lang.Object implements GraphComputeService
This class compute graph for unit and object group Should only be called from GraphFactory
-
-
Field Summary
-
Fields inherited from interface fr.gouv.vitam.metadata.core.graph.api.GraphComputeService
$_INC, $_SET, $_UNSET, concurrencyLevel, executor, START_DEPTH
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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 mongodbvoid
close()
GraphComputeResponse
computeGraph(com.fasterxml.jackson.databind.JsonNode queryDSL)
If workflow of compute graph in progress, do not execute this method Should be exposed in the APIGraphComputeResponse
computeGraph(MetadataCollections metadataCollections, java.util.Set<java.lang.String> documentsId, boolean computeObjectGroupGraph, boolean invalidateComputedInheritedRules)
Compute graph for unit/got from all parentscom.google.common.cache.LoadingCache<java.lang.String,org.bson.Document>
getCache()
static GraphComputeService
getInstance()
static GraphComputeService
initialize(VitamRepositoryProvider vitamRepositoryProvider, MetaDataImpl metaData, VitamCache<java.lang.String,org.bson.Document> cache, java.util.List<java.lang.Integer> tenants, ElasticsearchMetadataIndexManager indexManager)
static GraphComputeService
initialize(VitamRepositoryProvider vitamRepositoryProvider, MetaDataImpl metaData, ElasticsearchMetadataIndexManager indexManager)
boolean
isInProgress()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface fr.gouv.vitam.metadata.core.graph.api.GraphComputeService
computeGraph, computeObjectGroupGraph, computeObjectGroupGraph, computeUnitGraph, computeUnitGraphUsingDirectParents, preLoadCache
-
-
-
-
Method Detail
-
initialize
public static GraphComputeService initialize(VitamRepositoryProvider vitamRepositoryProvider, MetaDataImpl metaData, VitamCache<java.lang.String,org.bson.Document> cache, java.util.List<java.lang.Integer> tenants, ElasticsearchMetadataIndexManager indexManager)
- Parameters:
vitamRepositoryProvider
-metaData
-tenants
-indexManager
-- Returns:
- GraphComputeServiceImpl
-
initialize
public static GraphComputeService initialize(VitamRepositoryProvider vitamRepositoryProvider, MetaDataImpl metaData, ElasticsearchMetadataIndexManager indexManager)
- Parameters:
vitamRepositoryProvider
-metaData
-indexManager
-- Returns:
- GraphComputeServiceImpl
-
getInstance
public static GraphComputeService getInstance()
-
computeGraph
public GraphComputeResponse computeGraph(com.fasterxml.jackson.databind.JsonNode queryDSL) throws MetaDataException
Description copied from interface:GraphComputeService
If workflow of compute graph in progress, do not execute this method Should be exposed in the API- Specified by:
computeGraph
in interfaceGraphComputeService
- Returns:
- the map of collection:number of treated documents
- Throws:
MetaDataException
-
computeGraph
public GraphComputeResponse computeGraph(MetadataCollections metadataCollections, java.util.Set<java.lang.String> documentsId, boolean computeObjectGroupGraph, boolean invalidateComputedInheritedRules)
Description copied from interface:GraphComputeService
Compute graph for unit/got from all parents- Specified by:
computeGraph
in interfaceGraphComputeService
- Parameters:
metadataCollections
- the collection concerned by the build of the graphdocumentsId
- the collection of units subject of computing graphcomputeObjectGroupGraph
- true mean compute graph- 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.
-
bulkUpdateMongo
public void bulkUpdateMongo(MetadataCollections metaDaCollection, java.util.List<com.mongodb.client.model.WriteModel<org.bson.Document>> collection) throws DatabaseException
Description copied from interface:GraphComputeService
Bulk write in mongodb- Specified by:
bulkUpdateMongo
in interfaceGraphComputeService
- Throws:
DatabaseException
-
bulkElasticsearch
public void bulkElasticsearch(MetadataCollections metaDaCollection, java.util.Set<java.lang.String> collection) throws DatabaseException
Description copied from interface:GraphComputeService
Bulk save in elasticsearch- Specified by:
bulkElasticsearch
in interfaceGraphComputeService
collection
- of id of documents- Throws:
DatabaseException
-
bulkElasticsearch
public void bulkElasticsearch(MetadataCollections metaDaCollection, java.util.List<org.bson.Document> collection) throws DatabaseException
Description copied from interface:GraphComputeService
Bulk save in elasticsearch- Specified by:
bulkElasticsearch
in interfaceGraphComputeService
collection
- of documents- Throws:
DatabaseException
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceVitamAutoCloseable
-
isInProgress
public boolean isInProgress()
- Specified by:
isInProgress
in interfaceGraphComputeService
-
getCache
public com.google.common.cache.LoadingCache<java.lang.String,org.bson.Document> getCache()
- Specified by:
getCache
in interfaceVitamCache<java.lang.String,org.bson.Document>
-
-