Package org.mapfish.print.output
Class Values
- java.lang.Object
-
- org.mapfish.print.output.Values
-
public final class Values extends java.lang.Object
Values that go into a processor from previous processors in the processor processing graph.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLIENT_HTTP_REQUEST_FACTORY_KEY
The key that is used to storeMfClientHttpRequestFactoryProvider
.static java.lang.String
LOCALE_KEY
The key for the locale.static java.lang.String
MDC_CONTEXT_KEY
The key for the MDC context of the current print job.static java.lang.String
OUTPUT_FORMAT_KEY
The key for the output format.static java.lang.String
PDF_CONFIG_KEY
The key for the values object for thePDFConfig
object.static java.lang.String
SUBREPORT_DIR_KEY
The key for the values object for the subreport directory.static java.lang.String
TASK_DIRECTORY_KEY
The key that is used to store the task directory in the values map.static java.lang.String
TEMPLATE_KEY
The key that is used to storeTemplate
.static java.lang.String
VALUES_KEY
The key for the values object of it self.
-
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()
-
-
-
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
-
CLIENT_HTTP_REQUEST_FACTORY_KEY
public static final java.lang.String CLIENT_HTTP_REQUEST_FACTORY_KEY
The key that is used to storeMfClientHttpRequestFactoryProvider
.- See Also:
- Constant Field Values
-
TEMPLATE_KEY
public static final java.lang.String TEMPLATE_KEY
The key that is used to storeTemplate
.- See Also:
- Constant Field Values
-
PDF_CONFIG_KEY
public static final java.lang.String PDF_CONFIG_KEY
The key for the values object for thePDFConfig
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 contextrequestData
- the json request datatemplate
- the templatetaskDirectory
- the temporary directory for this printing task.httpRequestFactory
- a factory for making http requests.jasperTemplateBuild
- the directory where the jasper templates are compiled tohttpRequestMaxNumberFetchRetry
- the maximum number of times to retry fetching a resourcehttpRequestFetchRetryIntervalMillis
- 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 contextrequestData
- the json request datatemplate
- the templatetaskDirectory
- the temporary directory for this printing task.httpRequestFactory
- a factory for making http requests.jasperTemplateBuild
- the directory where the jasper templates are compiled tooutputFormat
- the output formathttpRequestMaxNumberFetchRetry
- the maximum number of times to retry fetching a resourcehttpRequestFetchRetryIntervalMillis
- 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 objectrequestJsonAttributes
- 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 classjava.lang.Object
-
-