Package fr.gouv.vitam.ihmdemo.core

# Class DslQueryHelper

java.lang.Object
fr.gouv.vitam.ihmdemo.core.DslQueryHelper

public class DslQueryHelper extends Object
Helper class to create DSL queries

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `PROJECTION_DSL`
  the projection part of DSL

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DslQueryHelper()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `com.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 criteria
  `com.fasterxml.jackson.databind.JsonNode`
  `createUpdateByIdDSLQuery(Map<String,com.fasterxml.jackson.databind.JsonNode> searchCriteriaMap, Map<String,com.fasterxml.jackson.databind.JsonNode> updateRules)`
  `UpdateMultiQuery`
  `getFullMetadataActionQuery(com.fasterxml.jackson.databind.JsonNode metadataModifications)`
  `static DslQueryHelper`
  `getInstance()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### PROJECTION_DSL

    public static final String PROJECTION_DSL
    the projection part of DSL
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### DslQueryHelper

    public DslQueryHelper()

- ## Method Details

  - ### getInstance

    public static DslQueryHelper getInstance()

  - ### createSingleQueryDSL

    public com.fasterxml.jackson.databind.JsonNode createSingleQueryDSL(Map<String,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 encountered
      `InvalidCreateOperationException` - 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 parsing
      `InvalidCreateOperationException` - thrown when an error occurred during creation

  - ### createGetByIdDSLSelectMultipleQuery

    public com.fasterxml.jackson.databind.JsonNode createGetByIdDSLSelectMultipleQuery(Map<String,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 parameters
      `InvalidCreateOperationException` - 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 parsing
      `InvalidCreateOperationException` - 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,com.fasterxml.jackson.databind.JsonNode> updateRules) throws InvalidParseOperationException, InvalidCreateOperationException
    Parameters:
      `searchCriteriaMap` - Criteria received from The IHM screen Empty Keys or Value is not allowed
      `updateRules` - rules that must be updated in the AU.
    Returns:
      the JSONDSL File
    Throws:
      `InvalidParseOperationException` - thrown when an error occurred during parsing
      `InvalidCreateOperationException` - 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
    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