Class FESCriterionGenerator
- java.lang.Object
-
- org.n52.sensorweb.server.db.old.dao.FESCriterionGenerator
-
- Direct Known Subclasses:
DataFESCriterionGenerator,DatasetFESCriterionGenerator
public abstract class FESCriterionGenerator extends Object
TODO JavaDoc
-
-
Constructor Summary
Constructors Constructor Description FESCriterionGenerator(org.hibernate.Criteria criteria, boolean unsupportedIsTrue, boolean matchDomainIds, boolean complexParent)Creates a newFESCriterionGenerator.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected StringaddAlias(String property)Add a alias for the specified property to the criteria.org.hibernate.criterion.Criterioncreate(org.n52.shetland.ogc.filter.Filter<?> filter)Create aCriterionfor the suppliedFilter.protected org.hibernate.criterion.CriterioncreateComparison(org.n52.shetland.ogc.filter.ComparisonFilter filter)Create aCriterionfor the supplied operator, property and value.protected org.hibernate.criterion.CriterioncreateComparison(org.n52.shetland.ogc.filter.ComparisonFilter filter, Object value)Create aCriterionfor the supplied filter.protected abstract org.hibernate.criterion.CriterioncreateDataCriterion(org.hibernate.criterion.Criterion criterion)Create aCriterionfor a property of the associated data entity.protected abstract org.hibernate.criterion.CriterioncreateDatasetCriterion(String property, org.n52.shetland.ogc.filter.ComparisonFilter filter)Create aCriterionfor a property of the associated data set.protected abstract org.hibernate.criterion.CriterioncreateDatasetCriterion(String property, org.n52.shetland.ogc.filter.SpatialFilter filter)Create aCriterionfor a property of the associated data set.protected abstract org.hibernate.criterion.CriterioncreateResultCriterion(org.n52.shetland.ogc.filter.ComparisonFilter filter)Create aCriterionfor the specified result filter.protected org.hibernate.criterion.CriterioncreateSpatialFilterCriterion(org.n52.shetland.ogc.filter.SpatialFilter filter)Create a spatial filter criterion for the supplied filter.protected org.hibernate.CriteriagetCriteria()Get the criteria this generator creates criterions for.protected Stream<org.hibernate.criterion.DetachedCriteria>getResultSubqueries(org.n52.shetland.ogc.filter.ComparisonFilter filter)Create a stream of subqueries that apply the comparison filter to the result value of the data entity.protected booleanisComplexParent()If the queries should result in the parent observation and hide the child observations.protected booleanisMatchDomainIds()Ff filter on observation parameters like feature, offering or procedure should match on their respective domain identifiers or on the primary keys in the databaseprotected booleanisUnsupportedIsTrue()If the generator encounters a filter expression it could not translate it may generate a criterion that is alwaystrueor alwaysfalsedepending on this flagstatic Optional<BigDecimal>parseBigDecimal(String value)Trys to parsevalueas aBigDecimal.static Optional<Boolean>parseBoolean(String value)Trys to parsevalueas aboolean.static Optional<Double>parseDouble(String value)Trys to parsevalueas adouble.static Optional<Integer>parseInt(String value)Trys to parsevalueas aint.static Optional<Long>parseLong(String value)Trys to parsevalueas along.static org.n52.shetland.ogc.gml.time.TimeparseTime(String value)Parse thevalueeither as aTimeInstantor as aTimePeriod.protected org.hibernate.criterion.CriterionunparsableTime(String value, IllegalArgumentException ex)Creates a criterion for an unparsable date time value.protected org.hibernate.criterion.Criterionunsupported(Enum<?> filter)Creates a criterion for an unsupported filter.protected org.hibernate.criterion.Criterionunsupported(Object o)Creates a criterion for an unsupported filter.protected org.hibernate.criterion.Criterionunsupported(org.n52.shetland.ogc.filter.Filter<?> filter)Creates a criterion for an unsupported filter.
-
-
-
Constructor Detail
-
FESCriterionGenerator
public FESCriterionGenerator(org.hibernate.Criteria criteria, boolean unsupportedIsTrue, boolean matchDomainIds, boolean complexParent)Creates a newFESCriterionGenerator.- Parameters:
criteria- the criteriaunsupportedIsTrue- if the generator encounters a filter expression it could not translate it may generate a criterion that is alwaystrueor alwaysfalsedepending on this flagmatchDomainIds- if filter on observation parameters like feature, offering or procedure should match on their respective domain identifiers or on the primary keys in the databasecomplexParent- if the queries should result in the parent observation and hide the child observations
-
-
Method Detail
-
getCriteria
protected org.hibernate.Criteria getCriteria()
Get the criteria this generator creates criterions for.- Returns:
- the criteria
-
isUnsupportedIsTrue
protected boolean isUnsupportedIsTrue()
If the generator encounters a filter expression it could not translate it may generate a criterion that is alwaystrueor alwaysfalsedepending on this flag- Returns:
- the flag
-
isMatchDomainIds
protected boolean isMatchDomainIds()
Ff filter on observation parameters like feature, offering or procedure should match on their respective domain identifiers or on the primary keys in the database- Returns:
- if domain identifiers should be matched
-
isComplexParent
protected boolean isComplexParent()
If the queries should result in the parent observation and hide the child observations.- Returns:
- if the queries should result in the parent observation and hide the child observations
-
addAlias
protected String addAlias(String property)
Add a alias for the specified property to the criteria.- Parameters:
property- the property- Returns:
- the alias
-
create
public org.hibernate.criterion.Criterion create(org.n52.shetland.ogc.filter.Filter<?> filter)
Create aCriterionfor the suppliedFilter.- Parameters:
filter- the filter- Returns:
- the criterion
-
createSpatialFilterCriterion
protected org.hibernate.criterion.Criterion createSpatialFilterCriterion(org.n52.shetland.ogc.filter.SpatialFilter filter)
Create a spatial filter criterion for the supplied filter.- Parameters:
filter- the filter- Returns:
- the criterion
-
createComparison
protected org.hibernate.criterion.Criterion createComparison(org.n52.shetland.ogc.filter.ComparisonFilter filter)
Create aCriterionfor the supplied operator, property and value.- Parameters:
filter- the filter- Returns:
- the criterion
-
createComparison
protected org.hibernate.criterion.Criterion createComparison(org.n52.shetland.ogc.filter.ComparisonFilter filter, Object value)Create aCriterionfor the supplied filter.valuemay hold a typed value to be used instead of the filter's string value.- Parameters:
filter- the filtervalue- a optional object to be used instead of the filter's string value- Returns:
- the criterion
-
unsupported
protected org.hibernate.criterion.Criterion unsupported(org.n52.shetland.ogc.filter.Filter<?> filter)
Creates a criterion for an unsupported filter.- Parameters:
filter- the filter- Returns:
- the restriction
-
unsupported
protected org.hibernate.criterion.Criterion unsupported(Enum<?> filter)
Creates a criterion for an unsupported filter.- Parameters:
filter- the filter- Returns:
- the restriction
-
unsupported
protected org.hibernate.criterion.Criterion unsupported(Object o)
Creates a criterion for an unsupported filter.- Parameters:
o- the unsupported object- Returns:
- the restriction
-
unparsableTime
protected org.hibernate.criterion.Criterion unparsableTime(String value, IllegalArgumentException ex)
Creates a criterion for an unparsable date time value.- Parameters:
value- the valueex- the causing exception- Returns:
- the criterion
-
getResultSubqueries
protected Stream<org.hibernate.criterion.DetachedCriteria> getResultSubqueries(org.n52.shetland.ogc.filter.ComparisonFilter filter)
Create a stream of subqueries that apply the comparison filter to the result value of the data entity. No projection is applied to the subqueries, this should be done in the calling method.- Parameters:
filter- the filter- Returns:
- a stream of subqueries for the data entity
-
createResultCriterion
protected abstract org.hibernate.criterion.Criterion createResultCriterion(org.n52.shetland.ogc.filter.ComparisonFilter filter)
Create aCriterionfor the specified result filter.- Parameters:
filter- the filter- Returns:
- the criterion
-
createDatasetCriterion
protected abstract org.hibernate.criterion.Criterion createDatasetCriterion(String property, org.n52.shetland.ogc.filter.ComparisonFilter filter)
Create aCriterionfor a property of the associated data set.- Parameters:
property- the property of the data set to apply the filter tofilter- the comparison filter- Returns:
- the criterion
-
createDatasetCriterion
protected abstract org.hibernate.criterion.Criterion createDatasetCriterion(String property, org.n52.shetland.ogc.filter.SpatialFilter filter)
Create aCriterionfor a property of the associated data set.- Parameters:
property- the property of the data set to apply the filter tofilter- the spatial filter- Returns:
- the criterion
-
createDataCriterion
protected abstract org.hibernate.criterion.Criterion createDataCriterion(org.hibernate.criterion.Criterion criterion)
Create aCriterionfor a property of the associated data entity.- Parameters:
criterion- the criterion- Returns:
- the criterion
-
parseTime
public static org.n52.shetland.ogc.gml.time.Time parseTime(String value) throws IllegalArgumentException
Parse thevalueeither as aTimeInstantor as aTimePeriod.- Parameters:
value- the string value- Returns:
- the time
- Throws:
IllegalArgumentException- if thevaluedoes not represent a valud time instant or period
-
parseLong
public static Optional<Long> parseLong(String value)
Trys to parsevalueas along.- Parameters:
value- the value- Returns:
- the parsed value or
Optional.empty()
-
parseInt
public static Optional<Integer> parseInt(String value)
Trys to parsevalueas aint.- Parameters:
value- the value- Returns:
- the parsed value or
Optional.empty()
-
parseDouble
public static Optional<Double> parseDouble(String value)
Trys to parsevalueas adouble.- Parameters:
value- the value- Returns:
- the parsed value or
Optional.empty()
-
parseBigDecimal
public static Optional<BigDecimal> parseBigDecimal(String value)
Trys to parsevalueas aBigDecimal.- Parameters:
value- the value- Returns:
- the parsed value or
Optional.empty()
-
-