Package org.n52.io.request
Class IoParameters
- java.lang.Object
-
- org.n52.io.request.IoParameters
-
- All Implemented Interfaces:
Parameters
public final class IoParameters extends Object implements Parameters
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.n52.io.request.Parameters
Parameters.HttpHeader
-
-
Field Summary
-
Fields inherited from interface org.n52.io.request.Parameters
AGGREGATION, BASE_64, BBOX, BOM, CACHE, CATEGORIES, COMPLEX_PARENT, CRS, DATASETS, DEFAULT_BASE_64, DEFAULT_EXPANDED, DEFAULT_FORCE_LATEST_VALUE, DEFAULT_FORCE_XY, DEFAULT_FORMAT, DEFAULT_GENERALIZE, DEFAULT_GRID, DEFAULT_HEIGHT, DEFAULT_LEGEND, DEFAULT_LIMIT, DEFAULT_MATCH_DOMAIN_IDS, DEFAULT_OFFSET, DEFAULT_OUTPUT_TIMEZONE, DEFAULT_RENDERING_TRIGGER, DEFAULT_SHOW_TIME_INTERVALS, DEFAULT_SHOW_VERTICAL_INTERVALS, DEFAULT_TIME_FORMAT, DEFAULT_WIDTH, EXPAND_WITH_NEXT_VALUES_BEYOND_INTERVAL, EXPANDED, FEATURES, FILTER_DATASET_TYPES, FILTER_FIELDS, FILTER_INSITU, FILTER_MOBILE, FILTER_OBSERVATION_TYPES, FILTER_OBSERVED_GEOMETRIES, FILTER_PLATFORM_GEOMETRIES, FILTER_VALUE_TYPES, FORCE_LATEST_VALUE, FORCE_XY, FORMAT, GENERALIZE, GEOMETRY_TYPES, GRID, HANDLE_AS_VALUE_TYPE, HEIGHT, HREF_BASE, LAST_VALUE_MATCHES, LEGEND, LEVEL, LIMIT, LOCALE, MATCH_DOMAIN_IDS, MEASURING_PROGRAMS, NEAR, ODATA_FILTER, OFFERINGS, OFFSET, OUTPUT_TIMEZONE, PHENOMENA, PLATFORMS, PROCEDURES, RAW_FORMAT, RENDERING_TRIGGER, RESULT_TIMES_VALUE_ALL, RESULTTIMES, SAMPLINGS, SEARCH_TERM, SEARCH_TYPES, SELECT, SERVICES, SHOW_TIME_INTERVALS, SHOW_VERTICAL_INTERVALS, STATIONS, STYLE, STYLES, TAGS, TIME_FORMAT, TIMESERIES, TIMESPAN, TOKEN_SEPARATOR, UNIX_TIME, WIDTH, ZIP
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedIoParameters()protectedIoParameters(Map<String,com.fasterxml.jackson.databind.JsonNode> queryParameters)protectedIoParameters(Map<String,com.fasterxml.jackson.databind.JsonNode> queryParameters, File defaults)protectedIoParameters(IoParameters other)protectedIoParameters(org.springframework.util.MultiValueMap<String,com.fasterxml.jackson.databind.JsonNode> queryParameters)protectedIoParameters(org.springframework.util.MultiValueMap<String,com.fasterxml.jackson.databind.JsonNode> queryParameters, File defaults)
-
Method Summary
-
-
-
Constructor Detail
-
IoParameters
protected IoParameters()
-
IoParameters
protected IoParameters(IoParameters other)
-
IoParameters
protected IoParameters(Map<String,com.fasterxml.jackson.databind.JsonNode> queryParameters)
-
IoParameters
protected IoParameters(Map<String,com.fasterxml.jackson.databind.JsonNode> queryParameters, File defaults)
-
IoParameters
protected IoParameters(org.springframework.util.MultiValueMap<String,com.fasterxml.jackson.databind.JsonNode> queryParameters)
-
-
Method Detail
-
shallBehaveBackwardsCompatible
public boolean shallBehaveBackwardsCompatible()
-
setParseExceptionHandle
public IoParameters setParseExceptionHandle(BiConsumer<String,IoParseException> handle)
-
getOffset
public int getOffset()
- Returns:
- the value of "offset" parameter. If not present, the default -1 is returned.
- Throws:
IoParseException- if parameter could not be parsed.
-
getLimit
public int getLimit()
- Returns:
- the value of "limit" parameter. If not present, the default -1 is returned.
- Throws:
IoParseException- if parameter could not be parsed.
-
getWidth
public int getWidth()
- Returns:
- the requested chart width in pixels or the default 800.
- Throws:
IoParseException- if parsing parameter fails.
-
getHeight
public int getHeight()
Returns the requested chart height in pixels.- Returns:
- the requested chart height in pixels or the default 500.
- Throws:
IoParseException- if parsing parameter fails.
-
isBase64
public boolean isBase64()
Indicates if rendered chart shall be returned as Base64 encoded string.- Returns:
- the value of parameter "base64" or the default false.
- Throws:
IoParseException- if parsing parameter fails.
-
isGrid
public boolean isGrid()
- Returns:
trueif timeseries chart shall include a background grid.- Throws:
IoParseException- if parsing parameter fails.
-
isGeneralize
public boolean isGeneralize()
- Returns:
trueif timeseries data shall be generalized.- Throws:
IoParseException- if parsing parameter fails.
-
isLegend
public boolean isLegend()
- Returns:
trueif a legend shall be included when rendering a chart,falseotherwise.- Throws:
IoParseException- if parsing parameter fails.
-
getLocale
public String getLocale()
- Returns:
- the value of "locale" parameter.
- Throws:
IoParseException- if parsing parameter fails.
-
isDefaultLocal
public boolean isDefaultLocal()
-
getDefaultLocale
public String getDefaultLocale()
-
setDefaultLocale
public IoParameters setDefaultLocale(String defaultLocale)
-
getSingleStyle
public StyleProperties getSingleStyle()
- Returns:
- the value of "style" parameter. If not present, the default styles are returned.
- Throws:
IoParseException- if parsing parameter fails.
-
getReferencedStyles
public Map<String,StyleProperties> getReferencedStyles()
- Returns:
- the value of "styles" parameter.
- Throws:
IoParseException- if parsing parameter fails.
-
hasStyles
public boolean hasStyles()
- Returns:
- in case of either
stylefor single orstylesfor multiple datasets are available.
-
getFormat
public String getFormat()
-
isSetRawFormat
public boolean isSetRawFormat()
-
getRawFormat
public String getRawFormat()
-
getTimeFormat
public String getTimeFormat()
-
getTimespan
public IntervalWithTimeZone getTimespan()
- Returns:
- the value of "timespan" parameter. If not present, the default timespan is returned.
- Throws:
IoParseException- if timespan could not be parsed.
-
getNormalizedTimespan
protected String getNormalizedTimespan(org.joda.time.format.DateTimeFormatter dateFormat)
-
getNormalizedTimespan
protected String getNormalizedTimespan(org.joda.time.format.DateTimeFormatter dateFormat, String parameter)
-
createDefaultTimespan
public static IntervalWithTimeZone createDefaultTimespan()
-
createTimespan
public static IntervalWithTimeZone createTimespan(org.joda.time.DateTime from, org.joda.time.DateTime to)
-
getOutputTimezone
public String getOutputTimezone()
-
getLastValueMatches
public IntervalWithTimeZone getLastValueMatches()
-
getResultTime
public org.joda.time.Instant getResultTime()
-
shallClassifyByResultTimes
public boolean shallClassifyByResultTimes()
-
isAllResultTimes
public boolean isAllResultTimes()
-
getResultTimes
public Set<String> getResultTimes()
parses csv parameterParameters.RESULTTIMESto a set of values. Validates each result time value after removing special valueall. UseisAllResultTimes()to check if client requests all result times available.- Returns:
- a (probably empty) set of result times.
-
getODataFilter
public Optional<org.n52.shetland.ogc.filter.Filter<?>> getODataFilter()
-
getMobile
public String getMobile()
-
getInsitu
public String getInsitu()
-
hasSelect
public boolean hasSelect()
-
getFilterResolver
public FilterResolver getFilterResolver()
-
getSpatialFilter
public BoundingBox getSpatialFilter()
Creates aBoundingBoxinstance from given spatial request parameters. The resulting bounding box is the merged extent of all spatial filters given. For example if "near" and "bbox" exist, the returned bounding box includes both extents.- Returns:
- a spatial filter created from given spatial parameters.
- Throws:
IoParseException- if parsing parameters fails, or if a requested "crs" object could not be created.
-
getCrs
public String getCrs()
- Returns:
- the requested reference context, or the default ("CRS:84") which will be interpreted as lon/lat ordered axes).
-
isForceXY
public boolean isForceXY()
-
isMatchDomainIds
public boolean isMatchDomainIds()
-
isExpanded
public boolean isExpanded()
- Returns:
- the value of "expanded" parameter.
- Throws:
IoParseException- if parameter could not be parsed.
-
isForceLatestValueRequests
public boolean isForceLatestValueRequests()
-
getHrefBase
public String getHrefBase()
-
isShowTimeIntervals
public boolean isShowTimeIntervals()
-
isShowVerticalIntervals
public boolean isShowVerticalIntervals()
-
containsParameter
public boolean containsParameter(String parameter)
-
getAsInteger
public int getAsInteger(String parameter, int defaultValue)
-
getAsInteger
public int getAsInteger(String parameter)
- Parameters:
parameter- the parameter to parse to anintvalue.- Returns:
- an integer value.
- Throws:
IoParseException- if parsing tointfails.
-
getAsBoolean
public boolean getAsBoolean(String parameter, boolean defaultValue)
-
getAsBoolean
public boolean getAsBoolean(String parameter)
- Parameters:
parameter- the parameter to parse toboolean.- Returns:
trueorfalseasboolean.- Throws:
IoParseException- if parsing tobooleanfails.
-
getJsonNodeFrom
public static com.fasterxml.jackson.databind.JsonNode getJsonNodeFrom(Object object)
-
removeAllOf
public IoParameters removeAllOf(String key)
Creates a new instance based on the current one and removes given parameter with the all its values. As a new instance is created the current one stays unchanged (unmutable instance) and can be reused as is.- Parameters:
key- the name of the parameter to remove all its values- Returns:
- a new instance with extended key/values
-
extendWith
public IoParameters extendWith(String key, String... values)
Creates a new instance based on the current one and adds parameter with the given values. As a new instance is created the current one stays unchanged (unmutable instance) and can be reused as is.- Parameters:
key- the parameter namevalues- the parameter values- Returns:
- a new instance with extended key/values
-
extendWith
public IoParameters extendWith(String key, Collection<String> values)
-
replaceWith
public IoParameters replaceWith(String key, String... values)
-
replaceWith
public IoParameters replaceWith(String key, Collection<String> values)
-
convertValuesToJsonNodes
protected static Map<String,com.fasterxml.jackson.databind.JsonNode> convertValuesToJsonNodes(Map<String,String> queryParameters)
-
convertToJsonNodes
protected static org.springframework.util.MultiValueMap<String,com.fasterxml.jackson.databind.JsonNode> convertToJsonNodes(org.springframework.util.MultiValueMap<String,String> queryParameters)
-
mergeToLowerCasedKeys
protected Map<String,com.fasterxml.jackson.databind.JsonNode> mergeToLowerCasedKeys(Map<String,com.fasterxml.jackson.databind.JsonNode> parameters)
-
mergeToLowerCasedKeys
protected org.springframework.util.MultiValueMap<String,com.fasterxml.jackson.databind.JsonNode> mergeToLowerCasedKeys(org.springframework.util.MultiValueMap<String,com.fasterxml.jackson.databind.JsonNode> parameters)
-
createDefaults
public static IoParameters createDefaults()
-
createDefaults
public static IoParameters createDefaults(File defaultConfig)
-
createFromMultiValueMap
public static IoParameters createFromMultiValueMap(org.springframework.util.MultiValueMap<String,String> query)
-
createFromSingleValueMap
public static IoParameters createFromSingleValueMap(Map<String,String> query)
-
createFromSingleJsonValueMap
static IoParameters createFromSingleJsonValueMap(Map<String,com.fasterxml.jackson.databind.JsonNode> query)
-
respectBackwardsCompatibility
public IoParameters respectBackwardsCompatibility()
-
isPureStationaryInsituQuery
public boolean isPureStationaryInsituQuery()
-
isExpandWithNextValuesBeyondInterval
public boolean isExpandWithNextValuesBeyondInterval()
-
hasCache
public boolean hasCache()
-
getCache
public Optional<com.fasterxml.jackson.databind.JsonNode> getCache()
-
formatToUnixTime
public boolean formatToUnixTime()
-
getLevel
public Integer getLevel()
-
isSelected
public boolean isSelected(String selection)
-
withoutSelectFilter
public IoParameters withoutSelectFilter()
-
withSubSelectFilter
public IoParameters withSubSelectFilter(String selection)
-
-