Class DbRequest
java.lang.Object
fr.gouv.vitam.metadata.core.database.collections.DbRequest
DB Request using MongoDB only
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaggregateUnitDepths
(Collection<String> ids, int relativeDepth) Aggregate Unit Depths according to parent relative Depthvoid
clearEsScrollId
(String scrollId) void
deleteObjectGroups
(List<String> documentsToDelete) Delete object groupsvoid
deleteUnits
(List<String> documentsToDelete) Delete unitsprotected Result<MetadataDocument<?>>
exactDepthUnitQuery
(Query realQuery, Result<MetadataDocument<?>> previous, int exactDepth, Integer tenantId, List<co.elastic.clients.elasticsearch._types.SortOptions> sorts, int offset, int limit, Map<String, co.elastic.clients.elasticsearch._types.aggregations.Aggregation> facets, String scrollId, Integer scrollTimeout, DynamicParserTokens parserTokens, boolean trackTotalHits) Execute one Unit Query using exact Depthvoid
execInsertObjectGroupRequests
(List<InsertParserMultiple> requestParsers) Inserts an object groupvoid
execInsertUnitRequest
(InsertParserMultiple requestParser) Deprecated.void
execInsertUnitRequests
(List<InsertParserMultiple> requests) Inserts a unitexecRequest
(RequestParserMultiple requestParser, List<OntologyModel> ontologies) The request should be already analyzed.execRuleRequest
(String documentId, RuleActions ruleActions, Map<String, DurationData> bindRuleToDuration, OntologyValidator ontologyValidator, UnitValidator unitValidator, List<OntologyModel> ontologyModels) Execute rule action on unitexecUpdateRequest
(List<RequestById> bulkRequests, MetadataCollections metadataCollection, OntologyValidator ontologyValidator, UnitValidator unitValidator, List<OntologyModel> ontologyModels, boolean forceUpdate, boolean refreshElasticIndexPostBulkIndexing) protected Result<MetadataDocument<?>>
executeQuery
(RequestParserMultiple requestParser, RequestToAbstract requestToMongodb, int rank, Result<MetadataDocument<?>> previous, DynamicParserTokens parserTokens) Execute one requestprotected Result<MetadataDocument<?>>
lastDeleteFilterProjection
(DeleteToMongodb requestToMongodb, Result<MetadataDocument<?>> last) Finalize the queries with last True Deleteprotected Result<MetadataDocument<?>>
lastSelectFilterProjection
(SelectToMongodb requestToMongodb, Result<MetadataDocument<?>> last, boolean checkConsistency) Finalize the queries with last True Selectprotected Result<MetadataDocument<?>>
objectGroupQuery
(Query realQuery, Result<MetadataDocument<?>> previous, Integer tenantId, List<co.elastic.clients.elasticsearch._types.SortOptions> sorts, int offset, int limit, String scrollId, Integer scrollTimeout, Map<String, co.elastic.clients.elasticsearch._types.aggregations.Aggregation> facets, DynamicParserTokens parserTokens, boolean trackTotalHits) Execute one relative Depth ObjectGroup Queryprotected Result<MetadataDocument<?>>
relativeDepthUnitQuery
(Query realQuery, Result<MetadataDocument<?>> previous, int relativeDepth, Integer tenantId, List<co.elastic.clients.elasticsearch._types.SortOptions> sorts, int offset, int limit, Map<String, co.elastic.clients.elasticsearch._types.aggregations.Aggregation> facets, String scrollId, Integer scrollTimeout, DynamicParserTokens parserTokens, boolean trackTotalHits) Execute one relative Depth Unit Queryprotected Result<MetadataDocument<?>>
sameDepthUnitQuery
(Query realQuery, Result<MetadataDocument<?>> previous, Integer tenantId, List<co.elastic.clients.elasticsearch._types.SortOptions> sorts, int offset, int limit, Map<String, co.elastic.clients.elasticsearch._types.aggregations.Aggregation> facets, String scrollId, Integer scrollTimeout, DynamicParserTokens parserTokens, boolean trackTotalHits) Execute one relative Depth Unit Query
-
Constructor Details
-
DbRequest
public DbRequest()
-
-
Method Details
-
execRuleRequest
public UpdatedDocument execRuleRequest(String documentId, RuleActions ruleActions, Map<String, DurationData> bindRuleToDuration, OntologyValidator ontologyValidator, UnitValidator unitValidator, List<OntologyModel> ontologyModels) throws InvalidParseOperationException, MetaDataExecutionException, InvalidCreateOperationException, MetaDataNotFoundException, MetadataValidationExceptionExecute rule action on unit- Parameters:
ontologyModels
-documentId
- the unitIdruleActions
- the list of ruleAction (by category)- Throws:
InvalidParseOperationException
MetaDataExecutionException
InvalidCreateOperationException
MetaDataNotFoundException
MetadataValidationException
-
execRequest
public Result<MetadataDocument<?>> execRequest(RequestParserMultiple requestParser, List<OntologyModel> ontologies) throws MetaDataExecutionException, InvalidParseOperationException, BadRequestException, VitamDBException The request should be already analyzed.- Parameters:
requestParser
- the RequestParserMultiple to execute- Returns:
- the Result
- Throws:
MetaDataExecutionException
- when select/update/delete on metadata collection exception occurredInvalidParseOperationException
- when json data exception occurredBadRequestException
VitamDBException
-
execUpdateRequest
public List<UpdatedDocument> execUpdateRequest(List<RequestById> bulkRequests, MetadataCollections metadataCollection, OntologyValidator ontologyValidator, UnitValidator unitValidator, List<OntologyModel> ontologyModels, boolean forceUpdate, boolean refreshElasticIndexPostBulkIndexing) throws MetaDataExecutionException, InvalidParseOperationException, MetaDataNotFoundException -
executeQuery
protected Result<MetadataDocument<?>> executeQuery(RequestParserMultiple requestParser, RequestToAbstract requestToMongodb, int rank, Result<MetadataDocument<?>> previous, DynamicParserTokens parserTokens) throws MetaDataExecutionException, InvalidParseOperationException, BadRequestException Execute one request- Parameters:
requestToMongodb
-rank
- current rank queryprevious
- previous Result from previous level (except in level == 0 where it is the subset of valid roots)- Returns:
- the new Result from this request
- Throws:
MetaDataExecutionException
InvalidParseOperationException
BadRequestException
-
exactDepthUnitQuery
protected Result<MetadataDocument<?>> exactDepthUnitQuery(Query realQuery, Result<MetadataDocument<?>> previous, int exactDepth, Integer tenantId, List<co.elastic.clients.elasticsearch._types.SortOptions> sorts, int offset, int limit, Map<String, co.elastic.clients.elasticsearch._types.aggregations.Aggregation> facets, String scrollId, Integer scrollTimeout, DynamicParserTokens parserTokens, boolean trackTotalHits) throws InvalidParseOperationException, MetaDataExecutionException, BadRequestExceptionExecute one Unit Query using exact Depth- Parameters:
realQuery
-previous
-exactDepth
-tenantId
-sorts
-offset
-limit
-facets
-trackTotalHits
-- Returns:
- the associated Result
- Throws:
InvalidParseOperationException
MetaDataExecutionException
BadRequestException
-
relativeDepthUnitQuery
protected Result<MetadataDocument<?>> relativeDepthUnitQuery(Query realQuery, Result<MetadataDocument<?>> previous, int relativeDepth, Integer tenantId, List<co.elastic.clients.elasticsearch._types.SortOptions> sorts, int offset, int limit, Map<String, co.elastic.clients.elasticsearch._types.aggregations.Aggregation> facets, String scrollId, Integer scrollTimeout, DynamicParserTokens parserTokens, boolean trackTotalHits) throws InvalidParseOperationException, MetaDataExecutionException, BadRequestExceptionExecute one relative Depth Unit Query- Parameters:
realQuery
-previous
-relativeDepth
-tenantId
-sorts
-offset
-limit
-facets
-trackTotalHits
-- Returns:
- the associated Result
- Throws:
InvalidParseOperationException
MetaDataExecutionException
BadRequestException
-
aggregateUnitDepths
Aggregate Unit Depths according to parent relative Depth- Parameters:
ids
-relativeDepth
-- Returns:
- the aggregate set of multi level parents for this relativeDepth
-
sameDepthUnitQuery
protected Result<MetadataDocument<?>> sameDepthUnitQuery(Query realQuery, Result<MetadataDocument<?>> previous, Integer tenantId, List<co.elastic.clients.elasticsearch._types.SortOptions> sorts, int offset, int limit, Map<String, co.elastic.clients.elasticsearch._types.aggregations.Aggregation> facets, String scrollId, Integer scrollTimeout, DynamicParserTokens parserTokens, boolean trackTotalHits) throws InvalidParseOperationException, MetaDataExecutionException, BadRequestExceptionExecute one relative Depth Unit Query- Parameters:
realQuery
-previous
-tenantId
-sorts
-offset
-limit
-facets
-trackTotalHits
-- Returns:
- the associated Result
- Throws:
InvalidParseOperationException
MetaDataExecutionException
BadRequestException
-
objectGroupQuery
protected Result<MetadataDocument<?>> objectGroupQuery(Query realQuery, Result<MetadataDocument<?>> previous, Integer tenantId, List<co.elastic.clients.elasticsearch._types.SortOptions> sorts, int offset, int limit, String scrollId, Integer scrollTimeout, Map<String, co.elastic.clients.elasticsearch._types.aggregations.Aggregation> facets, DynamicParserTokens parserTokens, boolean trackTotalHits) throws InvalidParseOperationException, MetaDataExecutionException, BadRequestExceptionExecute one relative Depth ObjectGroup Query- Parameters:
realQuery
-previous
- units, Note: only immediate Unit parents are allowedtenantId
-sorts
-offset
-limit
-trackTotalHits
-- Returns:
- the associated Result
- Throws:
InvalidParseOperationException
MetaDataExecutionException
BadRequestException
-
lastSelectFilterProjection
protected Result<MetadataDocument<?>> lastSelectFilterProjection(SelectToMongodb requestToMongodb, Result<MetadataDocument<?>> last, boolean checkConsistency) throws InvalidParseOperationException, VitamDBException Finalize the queries with last True Select- Parameters:
requestToMongodb
-last
-- Returns:
- the final Result
- Throws:
InvalidParseOperationException
VitamDBException
-
execInsertUnitRequest
@Deprecated public void execInsertUnitRequest(InsertParserMultiple requestParser) throws MetaDataExecutionException, MetaDataNotFoundException Deprecated.Inserts a unit- Parameters:
requestParser
- the InsertParserMultiple to execute- Throws:
MetaDataExecutionException
- when insert on metadata collection exception occurredMetaDataNotFoundException
- when metadata not found exception
-
execInsertObjectGroupRequests
public void execInsertObjectGroupRequests(List<InsertParserMultiple> requestParsers) throws MetaDataExecutionException, InvalidParseOperationException Inserts an object group- Parameters:
requestParsers
- the list of InsertParserMultiple to execute- Throws:
MetaDataExecutionException
- when insert on metadata collection exception occurredInvalidParseOperationException
- when json data exception occurredMetaDataAlreadyExistException
- when insert metadata exception
-
lastDeleteFilterProjection
protected Result<MetadataDocument<?>> lastDeleteFilterProjection(DeleteToMongodb requestToMongodb, Result<MetadataDocument<?>> last) throws MetaDataExecutionException Finalize the queries with last True Delete- Parameters:
requestToMongodb
-last
-- Returns:
- the final Result
- Throws:
InvalidParseOperationException
MetaDataExecutionException
-
execInsertUnitRequests
public void execInsertUnitRequests(List<InsertParserMultiple> requests) throws MetaDataExecutionException, MetaDataNotFoundException Inserts a unit- Parameters:
requests
- list of unit insert requests- Throws:
MetaDataExecutionException
- when insert on metadata collection exception occurredMetaDataNotFoundException
- when metadata not found exception
-
deleteUnits
Delete units- Throws:
MetaDataExecutionException
-
deleteObjectGroups
Delete object groups- Throws:
MetaDataExecutionException
-
clearEsScrollId
-