Class InstanceServiceParameters

java.lang.Object
com.aquima.interactions.framework.service.instance.InstanceServiceParameters
Direct Known Subclasses:
InstanceCreateParameters, InstanceUpdateParameters

public abstract class InstanceServiceParameters extends Object
Base class for parsing parameters for services which create or update entity instances. It provides logic for parsing the service parameters from the service context and determining and validating the basic parameters.
Since:
9.6
Author:
Radu Batori
  • Field Details

  • Constructor Details

    • InstanceServiceParameters

      public InstanceServiceParameters(IServiceContext context)
      Constructs an instance based on the service context.
      Parameters:
      context - The service context. Used to retrieve information about the service call.
  • Method Details

    • getEntityName

      public String getEntityName()
      Returns:
      The value of the "Entity" parameter.
    • getAttributes

      Returns:
      The attributes sent as parameter in form of a Map. The keys are the attribute names and the values the values of the evaluated expressions.
    • getRelations

      Returns:
      The relations sent as parameter in form of a Map. The keys are the attribute names of the relations and the values the values of the evaluated expressions.
    • getAttributeRelations

      public List<InstanceServiceParameters.ExpressionEntry> getAttributeRelations()
      Returns:
      The attributes and relations sent as parameter in form of a Map. The keys are the attribute/relation names, the values the values of the evaluated expressions and an ExpressionEntryType containing the type, if it is and Attribute or Relation.
    • getMandatoryParameterValue

      protected String getMandatoryParameterValue(IServiceContext context, String parameterName)
      Gets a mandatory parameter as an XML attribute of a node.
      Parameters:
      context - the context
      parameterName - the parameter name
      Returns:
      the parameter value
      Throws:
      IllegalArgumentException - if the attribute is empty/not set.
    • getOptionalParameterValue

      protected String getOptionalParameterValue(String parameterName)
      Gets an optional parameter as an XML attribute of a node.
      Parameters:
      parameterName - the parameter name
      Returns:
      NULL if parameter not set.
    • getBoolean

      protected boolean getBoolean(String parameterName, boolean defaultValue)
    • getOptionalExpressionMapParameter

      protected List<InstanceServiceParameters.ExpressionEntry> getOptionalExpressionMapParameter(IServiceContext context, String parameterName, String keyName, String valueName, boolean checkType)
      Maps an XML structure of the form:
       
       <parameterName>
         <child keyName="[key]" valueName="[value]"/>
         ...
       </parameterName>
       
      to a List<ExpressionEntry> of [key] -> IExpression([value])

      Note that the value may be null if no expression is specified.

      Parameters:
      context - the context
      parameterName - the parameter name
      keyName - the key name
      valueName - the value name
      checkType - the check type
      Returns:
      list of expression entries