Class DbQuery
java.lang.Object
org.n52.sensorweb.server.db.old.dao.DbQuery
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<E> org.springframework.data.jpa.domain.Specification<E>addDetachedFilters(String datasetName) <E> org.springframework.data.jpa.domain.Specification<E>addDetachedFilters(String datasetName, jakarta.persistence.EntityManager entityManager) select DatasetEntity.id where (restrictions), thenouter.<datasetName>.id IN (subquery).<E> org.springframework.data.jpa.domain.Specification<E>addFilters(String datasetProperty) <E> org.springframework.data.jpa.domain.Specification<E>addFilters(String datasetProperty, jakarta.persistence.EntityManager entityManager) Dataset filters plus the services filter, both applied toroot.<datasetProperty>.<E extends org.n52.series.db.beans.DataEntity<?>>
org.springframework.data.jpa.domain.Specification<E><E> org.springframework.data.jpa.domain.Specification<E>jakarta.persistence.criteria.PredicatecreateIdFilter(Set<String> filterValues, jakarta.persistence.criteria.From<?, ?> from, jakarta.persistence.criteria.CriteriaBuilder cb) jakarta.persistence.criteria.PredicatecreateServiceFilter(jakarta.persistence.criteria.Path<?> from, jakarta.persistence.criteria.CriteriaBuilder cb) from.service.id IN (:services), or a conjunction when no services are requested.List<jakarta.persistence.criteria.Predicate>datasetAndSamplingRestrictions(jakarta.persistence.criteria.From<org.n52.series.db.beans.DatasetEntity, ?> dataset, jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.EntityManager entityManager) Only thedatasetsandsamplingsrequest filters, applied directly to a dataset root the caller already holds (no subquery).jakarta.persistence.criteria.PredicatedatasetFilterPredicate(jakarta.persistence.criteria.Path<?> datasetId, jakarta.persistence.criteria.AbstractQuery<?> query, jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.EntityManager entityManager) datasetId IN (select dataset.id where <request filters>), or a conjunction when the request sets none of the dataset filters.booleanorg.n52.io.request.FilterResolverorg.locationtech.jts.geom.GeometryFactoryorg.joda.time.IntervalgetLevel()org.n52.io.request.IoParametersorg.locationtech.jts.geom.Geometryorg.joda.time.IntervalbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanremoveAllOf(String... parameterNames) Creates a new instance and removes all given parameters.Creates a new instance and removes spatial filter parameters.replaceWith(String parameter, String... values) Create a new instance and replaces given parameter values.replaceWith(String parameter, Collection<String> values) voidsetComplexParent(boolean complex) voidsetDatabaseSridCode(String databaseSridCode) setIncludeHierarchy(boolean includeHierarchy) toString()withSubSelectFilter(String selection)
-
Field Details
-
PROPERTY_PARENTS
- See Also:
-
FEATURE_ALIAS
- See Also:
-
PROCEDURE_ALIAS
- See Also:
-
PHENOMENON_ALIAS
- See Also:
-
OFFERING_ALIAS
- See Also:
-
-
Constructor Details
-
DbQuery
public DbQuery(org.n52.io.request.IoParameters parameters)
-
-
Method Details
-
removeSpatialFilter
Creates a new instance and removes spatial filter parameters.- Returns:
- a new instance with spatial filters removed
-
getGeometryFactory
public org.locationtech.jts.geom.GeometryFactory getGeometryFactory() -
replaceWith
Create a new instance and replaces given parameter values.- Parameters:
parameter- the parameter which values to be replacedvalues- the new values- Returns:
- a new instance with containing the new parameter values
-
replaceWith
-
removeAllOf
Creates a new instance and removes all given parameters.- Parameters:
parameterNames- the parameters to remove- Returns:
- a new instance with given parameters removed
-
getDatabaseSridCode
-
setDatabaseSridCode
-
getHrefBase
-
getLocale
-
getLocaleForLabel
-
isDefaultLocal
public boolean isDefaultLocal() -
getSearchTerm
-
getTimespan
public org.joda.time.Interval getTimespan() -
getLastValueMatches
public org.joda.time.Interval getLastValueMatches() -
getLevel
-
getSpatialFilter
public org.locationtech.jts.geom.Geometry getSpatialFilter() -
isExpanded
public boolean isExpanded() -
isMatchDomainIds
public boolean isMatchDomainIds() -
setComplexParent
public void setComplexParent(boolean complex) -
isComplexParent
public boolean isComplexParent() -
isSetDatasetTypeFilter
public boolean isSetDatasetTypeFilter() -
isSetObservationTypeFilter
public boolean isSetObservationTypeFilter() -
isSetValueTypeFilter
public boolean isSetValueTypeFilter() -
getValueTypes
-
addTimespanTo
public <E> org.springframework.data.jpa.domain.Specification<E> addTimespanTo() -
addFilters
-
addFilters
public <E> org.springframework.data.jpa.domain.Specification<E> addFilters(String datasetProperty, jakarta.persistence.EntityManager entityManager) Dataset filters plus the services filter, both applied toroot.<datasetProperty>.- Type Parameters:
E- the root entity type- Parameters:
datasetProperty- the association from the root to the dataset, or empty if the root is the datasetentityManager- used to check whether the sampling model is mapped, may benull(the samplings filter is then skipped)- Returns:
- the specification
-
createServiceFilter
public jakarta.persistence.criteria.Predicate createServiceFilter(jakarta.persistence.criteria.Path<?> from, jakarta.persistence.criteria.CriteriaBuilder cb) from.service.id IN (:services), or a conjunction when no services are requested.- Parameters:
from- the dataset (or another entity with aserviceassociation)cb- the criteria builder- Returns:
- the predicate
-
addDetachedFilters
public <E> org.springframework.data.jpa.domain.Specification<E> addDetachedFilters(String datasetName) -
addDetachedFilters
public <E> org.springframework.data.jpa.domain.Specification<E> addDetachedFilters(String datasetName, jakarta.persistence.EntityManager entityManager) select DatasetEntity.id where (restrictions), thenouter.<datasetName>.id IN (subquery).- Type Parameters:
E- the root entity type- Parameters:
datasetName- the association from the root to the dataset, or empty if the root is the datasetentityManager- used to check whether the sampling model is mapped, may benull(the samplings filter is then skipped)- Returns:
- the specification
-
datasetFilterPredicate
public jakarta.persistence.criteria.Predicate datasetFilterPredicate(jakarta.persistence.criteria.Path<?> datasetId, jakarta.persistence.criteria.AbstractQuery<?> query, jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.EntityManager entityManager) datasetId IN (select dataset.id where <request filters>), or a conjunction when the request sets none of the dataset filters.Takes the dataset id path rather than an association name, so callers can apply it to a dataset join they already hold (for example inside their own subquery) instead of joining the dataset a second time.
- Parameters:
datasetId- the path to the dataset id to restrictquery- the (sub)query to create the filter subquery incb- the criteria builderentityManager- used to check whether the sampling model is mapped, may benull(the samplings filter is then skipped)- Returns:
- the predicate
-
datasetAndSamplingRestrictions
public List<jakarta.persistence.criteria.Predicate> datasetAndSamplingRestrictions(jakarta.persistence.criteria.From<org.n52.series.db.beans.DatasetEntity, ?> dataset, jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.EntityManager entityManager) Only thedatasetsandsamplingsrequest filters, applied directly to a dataset root the caller already holds (no subquery). Meant for callers whose dataset subquery already appliesDatasetQuerySpecifications.matchFilters(), which covers the other dataset filters.- Parameters:
dataset- the dataset root to restrictcb- the criteria builderentityManager- used to check whether the sampling model is mapped, may benull(the samplings filter is then skipped)- Returns:
- the active restrictions, empty if neither filter is set
-
createIdFilter
-
addResultTimeFilter
public <E extends org.n52.series.db.beans.DataEntity<?>> org.springframework.data.jpa.domain.Specification<E> addResultTimeFilter() -
getParameters
public org.n52.io.request.IoParameters getParameters() -
getFilterResolver
public org.n52.io.request.FilterResolver getFilterResolver() -
toString
-
withoutFieldsFilter
-
withoutSelectFilter
-
withSubSelectFilter
-
expandWithNextValuesBeyondInterval
public boolean expandWithNextValuesBeyondInterval() -
isIncludeHierarchy
public boolean isIncludeHierarchy()- Returns:
- the includeHierarchy
-
setIncludeHierarchy
- Parameters:
includeHierarchy- the includeHierarchy to set- Returns:
- this
-
getSelectOriginal
-
isFormatToUnixTime
public boolean isFormatToUnixTime() -
getNumberFormat
-