Class Values


  • public final class Values
    extends java.lang.Object
    Values that go into a processor from previous processors in the processor processing graph.
    • Constructor Summary

      Constructors 
      Constructor Description
      Values()
      Constructor.
      Values​(java.util.Map<java.lang.String,​java.lang.Object> values)
      Constructor.
      Values​(java.util.Map<java.lang.String,​java.lang.String> mdcContext, PJsonObject requestData, Template template, java.io.File taskDirectory, MfClientHttpRequestFactoryImpl httpRequestFactory, java.io.File jasperTemplateBuild, int httpRequestMaxNumberFetchRetry, int httpRequestFetchRetryIntervalMillis)
      Construct from the json request body and the associated template.
      Values​(java.util.Map<java.lang.String,​java.lang.String> mdcContext, PJsonObject requestData, Template template, java.io.File taskDirectory, MfClientHttpRequestFactoryImpl httpRequestFactory, java.io.File jasperTemplateBuild, java.lang.String outputFormat, int httpRequestMaxNumberFetchRetry, int httpRequestFetchRetryIntervalMillis)
      Construct from the json request body and the associated template.
      Values​(Values values)
      Create a new instance and copy the required elements from the other values object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRequiredValues​(Values sourceValues)
      Add the elements that all values objects require from the provided values object.
      java.util.Map<java.lang.String,​java.lang.Object> asMap()
      Get all parameters.
      boolean containsKey​(java.lang.String key)
      Return true if the identified value is present in this values.
      <T> java.util.Map<java.lang.String,​T> find​(java.lang.Class<T> valueTypeToFind)
      Find all the values of the requested type.
      java.lang.Boolean getBoolean​(java.lang.String key)
      Get a boolean value from the values or null.
      java.lang.Double getDouble​(java.lang.String key)
      Get a value as a double.
      java.lang.Integer getInteger​(java.lang.String key)
      Get a value as a integer.
      <V> V getObject​(java.lang.String key, java.lang.Class<V> type)
      Get a value as a object.
      java.lang.String getString​(java.lang.String key)
      Get a value as a string.
      java.util.Map<java.lang.String,​java.lang.String> getStringMap​(java.lang.String key)
      Get a value as a Map from String to String.
      void populateFromAttributes​(Template template, java.util.Map<java.lang.String,​Attribute> attributes, PObject requestJsonAttributes)
      Process the requestJsonAttributes using the attributes and the MapfishParser and add all resulting values to this values object.
      void put​(java.lang.String key, java.lang.Object value)
      Put a new value in map.
      void remove​(java.lang.String key)
      Remove a value from this object.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • TASK_DIRECTORY_KEY

        public static final java.lang.String TASK_DIRECTORY_KEY
        The key that is used to store the task directory in the values map.
        See Also:
        Constant Field Values
      • PDF_CONFIG_KEY

        public static final java.lang.String PDF_CONFIG_KEY
        The key for the values object for the PDFConfig object.
        See Also:
        Constant Field Values
      • OUTPUT_FORMAT_KEY

        public static final java.lang.String OUTPUT_FORMAT_KEY
        The key for the output format.
        See Also:
        Constant Field Values
      • SUBREPORT_DIR_KEY

        public static final java.lang.String SUBREPORT_DIR_KEY
        The key for the values object for the subreport directory.
        See Also:
        Constant Field Values
      • MDC_CONTEXT_KEY

        public static final java.lang.String MDC_CONTEXT_KEY
        The key for the MDC context of the current print job.
        See Also:
        Constant Field Values
      • VALUES_KEY

        public static final java.lang.String VALUES_KEY
        The key for the values object of it self.
        See Also:
        Constant Field Values
      • LOCALE_KEY

        public static final java.lang.String LOCALE_KEY
        The key for the locale.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Values

        public Values​(java.util.Map<java.lang.String,​java.lang.Object> values)
        Constructor.
        Parameters:
        values - initial values.
      • Values

        public Values()
        Constructor.
      • Values

        public Values​(@Nonnull
                      java.util.Map<java.lang.String,​java.lang.String> mdcContext,
                      PJsonObject requestData,
                      Template template,
                      java.io.File taskDirectory,
                      MfClientHttpRequestFactoryImpl httpRequestFactory,
                      java.io.File jasperTemplateBuild,
                      int httpRequestMaxNumberFetchRetry,
                      int httpRequestFetchRetryIntervalMillis)
        Construct from the json request body and the associated template.
        Parameters:
        mdcContext - the MDC context
        requestData - the json request data
        template - the template
        taskDirectory - the temporary directory for this printing task.
        httpRequestFactory - a factory for making http requests.
        jasperTemplateBuild - the directory where the jasper templates are compiled to
        httpRequestMaxNumberFetchRetry - the maximum number of times to retry fetching a resource
        httpRequestFetchRetryIntervalMillis - the interval between retries
      • Values

        public Values​(@Nonnull
                      java.util.Map<java.lang.String,​java.lang.String> mdcContext,
                      PJsonObject requestData,
                      Template template,
                      java.io.File taskDirectory,
                      MfClientHttpRequestFactoryImpl httpRequestFactory,
                      java.io.File jasperTemplateBuild,
                      java.lang.String outputFormat,
                      int httpRequestMaxNumberFetchRetry,
                      int httpRequestFetchRetryIntervalMillis)
        Construct from the json request body and the associated template.
        Parameters:
        mdcContext - the MDC context
        requestData - the json request data
        template - the template
        taskDirectory - the temporary directory for this printing task.
        httpRequestFactory - a factory for making http requests.
        jasperTemplateBuild - the directory where the jasper templates are compiled to
        outputFormat - the output format
        httpRequestMaxNumberFetchRetry - the maximum number of times to retry fetching a resource
        httpRequestFetchRetryIntervalMillis - the interval between retries
      • Values

        public Values​(@Nonnull
                      Values values)
        Create a new instance and copy the required elements from the other values object. (IE working directory, http client factory, etc...)
        Parameters:
        values - the values containing the required elements
    • Method Detail

      • populateFromAttributes

        public void populateFromAttributes​(@Nonnull
                                           Template template,
                                           @Nonnull
                                           java.util.Map<java.lang.String,​Attribute> attributes,
                                           @Nonnull
                                           PObject requestJsonAttributes)
        Process the requestJsonAttributes using the attributes and the MapfishParser and add all resulting values to this values object.
        Parameters:
        template - the template of the current request.
        attributes - the attributes that will be used to add values to this values object
        requestJsonAttributes - the json data for populating the attribute values
      • addRequiredValues

        public void addRequiredValues​(@Nonnull
                                      Values sourceValues)
        Add the elements that all values objects require from the provided values object.
        Parameters:
        sourceValues - the values object containing the required elements
      • put

        public void put​(java.lang.String key,
                        java.lang.Object value)
        Put a new value in map.
        Parameters:
        key - id of the value for looking up.
        value - the value.
      • asMap

        public java.util.Map<java.lang.String,​java.lang.Object> asMap()
        Get all parameters.
      • getString

        public java.lang.String getString​(java.lang.String key)
        Get a value as a string.
        Parameters:
        key - the key for looking up the value.
      • getDouble

        public java.lang.Double getDouble​(java.lang.String key)
        Get a value as a double.
        Parameters:
        key - the key for looking up the value.
      • getInteger

        public java.lang.Integer getInteger​(java.lang.String key)
        Get a value as a integer.
        Parameters:
        key - the key for looking up the value.
      • getObject

        public <V> V getObject​(java.lang.String key,
                               java.lang.Class<V> type)
        Get a value as a object.
        Type Parameters:
        V - the type
        Parameters:
        key - the key for looking up the value.
        type - the type of the object
      • getStringMap

        public java.util.Map<java.lang.String,​java.lang.String> getStringMap​(java.lang.String key)
        Get a value as a Map from String to String.
        Parameters:
        key - the key for looking up the value.
      • containsKey

        public boolean containsKey​(java.lang.String key)
        Return true if the identified value is present in this values.
        Parameters:
        key - the key to check for.
      • getBoolean

        @Nullable
        public java.lang.Boolean getBoolean​(@Nonnull
                                            java.lang.String key)
        Get a boolean value from the values or null.
        Parameters:
        key - the look up key of the value
      • remove

        public void remove​(java.lang.String key)
        Remove a value from this object.
        Parameters:
        key - key of entry to remove.
      • find

        public <T> java.util.Map<java.lang.String,​T> find​(java.lang.Class<T> valueTypeToFind)
        Find all the values of the requested type.
        Type Parameters:
        T - the type of the value to find.
        Parameters:
        valueTypeToFind - the type of the value to return.
        Returns:
        the key, value pairs found.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object