Package fr.gouv.vitam.ihmdemo.core
Class DslQueryHelper
- java.lang.Object
-
- fr.gouv.vitam.ihmdemo.core.DslQueryHelper
-
public class DslQueryHelper extends java.lang.Object
Helper class to create DSL queries
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROJECTION_DSL
the projection part of DSL
-
Constructor Summary
Constructors Constructor Description DslQueryHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.fasterxml.jackson.databind.JsonNode
createGetByIdDSLSelectMultipleQuery(java.util.Map<java.lang.String,java.lang.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(java.util.Map<java.lang.String,java.lang.Object> options)
com.fasterxml.jackson.databind.JsonNode
createSelectAndUpdateDSLQuery(java.util.Map<java.lang.String,java.lang.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(java.util.Map<java.lang.String,java.lang.String> searchCriteriaMap)
com.fasterxml.jackson.databind.JsonNode
createSelectElasticsearchDSLQuery(java.util.Map<java.lang.String,java.lang.Object> searchCriteriaMap)
com.fasterxml.jackson.databind.JsonNode
createSingleQueryDSL(java.util.Map<java.lang.String,java.lang.Object> searchCriteriaMap)
generate the DSL query after receiving the search criteriacom.fasterxml.jackson.databind.JsonNode
createUpdateByIdDSLQuery(java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> searchCriteriaMap, java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> updateRules)
UpdateMultiQuery
getFullMetadataActionQuery(com.fasterxml.jackson.databind.JsonNode metadataModifications)
static DslQueryHelper
getInstance()
-
-
-
Field Detail
-
PROJECTION_DSL
public static final java.lang.String PROJECTION_DSL
the projection part of DSL- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static DslQueryHelper getInstance()
-
createSingleQueryDSL
public com.fasterxml.jackson.databind.JsonNode createSingleQueryDSL(java.util.Map<java.lang.String,java.lang.Object> searchCriteriaMap) throws InvalidParseOperationException, InvalidCreateOperationException
generate 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(java.util.Map<java.lang.String,java.lang.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(java.util.Map<java.lang.String,java.lang.String> projectionCriteriaMap) throws InvalidParseOperationException, InvalidCreateOperationException
Create 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(java.util.Map<java.lang.String,java.lang.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(java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> searchCriteriaMap, java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> updateRules) throws InvalidParseOperationException, InvalidCreateOperationException
- 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(java.util.Map<java.lang.String,java.lang.Object> options) throws InvalidCreateOperationException
- Throws:
InvalidCreateOperationException
-
createSelectAndUpdateDSLQuery
public com.fasterxml.jackson.databind.JsonNode createSelectAndUpdateDSLQuery(java.util.Map<java.lang.String,java.lang.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
-
-