/** * Compose a time constraints. When the provided constraints do not fulfill the indexed * dimensions, compose constraints from statistics. * * @param featureType * @param timeDescriptors * @param statsMap * @param timeBoundsSet * @return */ public static Constraints composeTimeConstraints( final SimpleFeatureType featureType, final TimeDescriptors timeDescriptors, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap, final TemporalConstraintsSet timeBoundsSet) { final TemporalConstraints timeBounds = TimeUtils.getTemporalConstraintsForDescriptors(timeDescriptors, timeBoundsSet); return (timeBounds != null) && !timeBounds.isEmpty() ? ExplicitSpatialTemporalQuery.createConstraints(timeBounds, false) : new Constraints(getTimeConstraintsFromIndex(timeDescriptors, statsMap)); }
/** * If composed constraints matched statistics constraints, are empty or null, then return empty * constraint set. * * @param featureType * @param timeDescriptors * @param statsMap * @param timeBoundsSet * @return */ public static Constraints composeTimeBoundedConstraints( final SimpleFeatureType featureType, final TimeDescriptors timeDescriptors, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap, final TemporalConstraintsSet timeBoundsSet) { if ((timeBoundsSet == null) || timeBoundsSet.isEmpty() || !timeDescriptors.hasTime()) { return new Constraints(); } final TemporalConstraints boundsTemporalConstraints = TimeUtils.getTemporalConstraintsForDescriptors(timeDescriptors, timeBoundsSet); if (boundsTemporalConstraints.isEmpty()) { return new Constraints(); } final Constraints indexTimeConstraints = new Constraints(QueryIndexHelper.getTimeConstraintsFromIndex(timeDescriptors, statsMap)); final Constraints boundsTimeConstraints = ExplicitSpatialTemporalQuery.createConstraints(boundsTemporalConstraints, false); return (boundsTimeConstraints.matches(indexTimeConstraints)) ? new Constraints() : boundsTimeConstraints; }