Class InvokeServiceCmd

    • Method Detail

      • validateParameters

        protected void validateParameters()
      • createValidateAndCompleteServiceInvocationInputDataMap

        protected java.util.Map<java.lang.String,​java.lang.Object> createValidateAndCompleteServiceInvocationInputDataMap​(ServiceDefinitionModel serviceDefinitionModel,
                                                                                                                                ServiceOperation serviceOperation,
                                                                                                                                com.fasterxml.jackson.databind.ObjectMapper objectMapper,
                                                                                                                                org.flowable.common.engine.impl.el.ExpressionManager expressionManager)
        Creates, validates and completes the service invocation data according the input parameter definition of the service.
        Parameters:
        serviceDefinitionModel - the service definition model the invocation is based on
        serviceOperation - the service operation representing the service to be invoked
        objectMapper - the object mapper used for creating and initializing variable values in JSON
        expressionManager - the expression manager used for evaluating default values for input parameters
        Returns:
        the initialized and validated variable data map
        Throws:
        org.flowable.common.engine.api.FlowableIllegalArgumentException - if the input parameter validation failed (e.g. a required parameter value was missing)
      • processAndValidateInputParameter

        protected void processAndValidateInputParameter​(ServiceDefinitionModel serviceDefinitionModel,
                                                        ServiceInputParameter inputParameter,
                                                        java.util.Map<java.lang.String,​java.lang.Object> serviceInvocationInputData,
                                                        com.fasterxml.jackson.databind.ObjectMapper objectMapper,
                                                        org.flowable.common.engine.impl.el.ExpressionManager expressionManager)
        Internal method to process a single input parameter by looking at its definition and checking its value. If a required input parameters value is missing and no default one is provided, it will throw an exception.
        Parameters:
        serviceDefinitionModel - the service definition model the invocation is based on
        inputParameter - the input parameter to be processed
        serviceInvocationInputData - the service invocation input data map to be validated and completed for the given parameter
        objectMapper - the object mapper used for creating and initializing variable values in JSON
        expressionManager - the expression manager used for evaluating default values for input parameters
        Throws:
        org.flowable.common.engine.api.FlowableIllegalArgumentException - if the input parameter validation failed (e.g. a required parameter value was missing)
      • getServiceDefinition

        protected ServiceDefinitionEntity getServiceDefinition​(java.lang.String tenantId,
                                                               org.flowable.common.engine.impl.interceptor.CommandContext commandContext)
      • resolveServiceDefinitionByReferenceKey

        protected ServiceDefinitionEntity resolveServiceDefinitionByReferenceKey​(java.lang.String tenantId,
                                                                                 ServiceDefinitionEntityManager serviceDefinitionEntityManager,
                                                                                 org.flowable.common.engine.impl.interceptor.CommandContext commandContext)
      • getServiceInvoker

        protected ServiceInvoker getServiceInvoker​(ServiceDefinitionModel serviceDefinitionModel,
                                                   org.flowable.common.engine.impl.interceptor.CommandContext commandContext)
      • handleOutputParameterValues

        protected java.util.Map<java.lang.String,​java.lang.Object> handleOutputParameterValues​(ServiceInvocationResponse invocationResponse,
                                                                                                     ServiceDefinitionModel serviceDefinitionModel,
                                                                                                     ServiceOperation serviceOperation,
                                                                                                     ServiceInvocationContext context,
                                                                                                     org.flowable.common.engine.impl.el.ExpressionManager expressionManager,
                                                                                                     com.fasterxml.jackson.databind.ObjectMapper objectMapper)
        Verifies and handles output values according the output paramter definition of the service (specially missing and null-value output).
        Parameters:
        invocationResponse - the response returned by the invoker
        serviceDefinitionModel - the service model
        serviceOperation - the operation which was invoked
        context - the context within which the service was invoked
        expressionManager - the expression manager used to resolve default value expressions
        objectMapper - the object mapper used to manipulate the output JSON object (if JSON based and not map based)
      • hasMissingValue

        protected boolean hasMissingValue​(ServiceInvocationResponse invocationResponse,
                                          java.lang.String parameterName)
      • hasNullValue

        protected boolean hasNullValue​(ServiceInvocationResponse invocationResponse,
                                       java.lang.String parameterName)
      • getDefaultValue

        protected java.lang.Object getDefaultValue​(ServiceOutputParameter outputParameter,
                                                   java.lang.String defaultValue,
                                                   ServiceInvocationContext context,
                                                   org.flowable.common.engine.impl.el.ExpressionManager expressionManager,
                                                   com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      • getValue

        protected java.lang.Object getValue​(ServiceInvocationResponse invocationResponse,
                                            java.lang.String parameterName,
                                            java.lang.String parameterType,
                                            com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      • getLookupId

        protected java.lang.Object getLookupId​(ServiceDefinitionModel serviceDefinitionModel,
                                               ServiceInvocationResponse invocationResponse)
        Search for the lookup id value in the response according the mapping in the service definition and do proper handling of the response type (e.g. JSON vs map).
        Parameters:
        serviceDefinitionModel - the service definition model where the lookup id mapping is taken from
        invocationResponse - the invocation response containing the lookup id field and its value
        Returns:
        the lookup id value, if available, null otherwise