Class 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 criteria
      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)  
      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 Detail

      • PROJECTION_DSL

        public static final java.lang.String PROJECTION_DSL
        the projection part of DSL
        See Also:
        Constant Field Values
    • Constructor Detail

      • DslQueryHelper

        public DslQueryHelper()
    • Method Detail

      • 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 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)
      • 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