Package fr.gouv.vitam.ihmdemo.core
Class DslQueryHelper
java.lang.Object
fr.gouv.vitam.ihmdemo.core.DslQueryHelper
Helper class to create DSL queries
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.JsonNode
createGetByIdDSLSelectMultipleQuery
(Map<String, String> projectionCriteriaMap) Create GetById Select Multiple Query Dsl request that contains only projection.com.fasterxml.jackson.databind.node.ObjectNode
createMassiveUpdateDSLBaseQuery
(com.fasterxml.jackson.databind.JsonNode modifiedFields) com.fasterxml.jackson.databind.JsonNode
createSearchQueryAccessionRegister
(Map<String, Object> options) com.fasterxml.jackson.databind.JsonNode
createSelectAndUpdateDSLQuery
(Map<String, Object> optionsMap) Create a JsonNode similar to a composed Select/Update DSL query
Input: {parentId: 'id', childId: 'id', action: 'ADD'} (action can be DELETE)
Output: [{ "$query": [ { "$eq": { "#id": "childId" } } ], "$action": [ { "$add": { (action can be $pull if input ask for DELETE) "#up": ["parentId"] } } ] }]com.fasterxml.jackson.databind.JsonNode
createSelectDSLQuery
(Map<String, String> searchCriteriaMap) com.fasterxml.jackson.databind.JsonNode
createSelectElasticsearchDSLQuery
(Map<String, Object> searchCriteriaMap) com.fasterxml.jackson.databind.JsonNode
createSingleQueryDSL
(Map<String, Object> searchCriteriaMap) generate the DSL query after receiving the search criteriacom.fasterxml.jackson.databind.JsonNode
createUpdateByIdDSLQuery
(Map<String, com.fasterxml.jackson.databind.JsonNode> searchCriteriaMap, Map<String, com.fasterxml.jackson.databind.JsonNode> updateRules) getFullMetadataActionQuery
(com.fasterxml.jackson.databind.JsonNode metadataModifications) static DslQueryHelper
-
Field Details
-
PROJECTION_DSL
the projection part of DSL- See Also:
-
-
Constructor Details
-
DslQueryHelper
public DslQueryHelper()
-
-
Method Details
-
getInstance
-
createSingleQueryDSL
public com.fasterxml.jackson.databind.JsonNode createSingleQueryDSL(Map<String, Object> searchCriteriaMap) throws InvalidParseOperationException, InvalidCreateOperationExceptiongenerate the DSL query after receiving the search criteria- Parameters:
searchCriteriaMap
- the map containing the criteria- Returns:
- DSL request
- Throws:
InvalidParseOperationException
- if a parse exception is encounteredInvalidCreateOperationException
- if an Invalid create operation is encountered
-
createSelectDSLQuery
public com.fasterxml.jackson.databind.JsonNode createSelectDSLQuery(Map<String, String> searchCriteriaMap) throws InvalidParseOperationException, InvalidCreateOperationException- Parameters:
searchCriteriaMap
- Criteria received from The IHM screen Empty Keys or Value is not allowed- Returns:
- the JSONDSL File
- Throws:
InvalidParseOperationException
- thrown when an error occurred during parsingInvalidCreateOperationException
- thrown when an error occurred during creation
-
createGetByIdDSLSelectMultipleQuery
public com.fasterxml.jackson.databind.JsonNode createGetByIdDSLSelectMultipleQuery(Map<String, String> projectionCriteriaMap) throws InvalidParseOperationException, InvalidCreateOperationExceptionCreate GetById Select Multiple Query Dsl request that contains only projection.- Parameters:
projectionCriteriaMap
- the given projection parameters- Returns:
- request with projection
- Throws:
InvalidParseOperationException
- null key or value parametersInvalidCreateOperationException
- queryDsl create operation
-
createSelectElasticsearchDSLQuery
public com.fasterxml.jackson.databind.JsonNode createSelectElasticsearchDSLQuery(Map<String, Object> searchCriteriaMap) throws InvalidParseOperationException, InvalidCreateOperationException- Parameters:
searchCriteriaMap
- Criteria received from The IHM screen Empty Keys or Value is not allowed- Returns:
- the JSONDSL File
- Throws:
InvalidParseOperationException
- thrown when an error occurred during parsingInvalidCreateOperationException
- thrown when an error occurred during creation
-
createUpdateByIdDSLQuery
public com.fasterxml.jackson.databind.JsonNode createUpdateByIdDSLQuery(Map<String, com.fasterxml.jackson.databind.JsonNode> searchCriteriaMap, Map<String, throws InvalidParseOperationException, InvalidCreateOperationExceptioncom.fasterxml.jackson.databind.JsonNode> updateRules) - Parameters:
searchCriteriaMap
- Criteria received from The IHM screen Empty Keys or Value is not allowedupdateRules
- rules that must be updated in the AU.- Returns:
- the JSONDSL File
- Throws:
InvalidParseOperationException
- thrown when an error occurred during parsingInvalidCreateOperationException
- thrown when an error occurred during creation
-
createMassiveUpdateDSLBaseQuery
public com.fasterxml.jackson.databind.node.ObjectNode createMassiveUpdateDSLBaseQuery(com.fasterxml.jackson.databind.JsonNode modifiedFields) -
getFullMetadataActionQuery
public UpdateMultiQuery getFullMetadataActionQuery(com.fasterxml.jackson.databind.JsonNode metadataModifications) throws InvalidParseOperationException, InvalidCreateOperationException -
createSearchQueryAccessionRegister
public com.fasterxml.jackson.databind.JsonNode createSearchQueryAccessionRegister(Map<String, Object> options) throws InvalidCreateOperationException- Throws:
InvalidCreateOperationException
-
createSelectAndUpdateDSLQuery
public com.fasterxml.jackson.databind.JsonNode createSelectAndUpdateDSLQuery(Map<String, Object> optionsMap) Create a JsonNode similar to a composed Select/Update DSL query
Input: {parentId: 'id', childId: 'id', action: 'ADD'} (action can be DELETE)
Output: [{ "$query": [ { "$eq": { "#id": "childId" } } ], "$action": [ { "$add": { (action can be $pull if input ask for DELETE) "#up": ["parentId"] } } ] }]- Parameters:
optionsMap
- input options given by frontend application- Returns:
- jsonQuery for adminClient
-