public ExtractTimeFilterVisitor(final TimeDescriptors timeDescriptors) { if (timeDescriptors.hasTime() && (timeDescriptors.getStartRange() != null) && (timeDescriptors.getEndRange() != null)) { addRangeVariables( timeDescriptors.getStartRange().getLocalName(), timeDescriptors.getEndRange().getLocalName()); } }
descMap.put(type, desc); if ((desc.getStartRange() != null) && (desc.getEndRange() != null)) { final Object start = entry.getAttribute(desc.getStartRange().getName()); final Object end = entry.getAttribute(desc.getStartRange().getName()); if ((start == null) || (end == null)) { LOGGER.warn("start or end value is null, ignoring feature");
/** * Compose temporal constraints given the constraint set and the descriptors for the index. * * @param timeDescriptors * @param constraintsSet * @return null if the constraints does not have the fields required by the time descriptors */ public static TemporalConstraints composeRangeTemporalConstraints( final TimeDescriptors timeDescriptors, final TemporalConstraintsSet constraintsSet) { if ((timeDescriptors.getEndRange() != null) && (timeDescriptors.getStartRange() != null)) { final String ename = timeDescriptors.getEndRange().getLocalName(); final String sname = timeDescriptors.getStartRange().getLocalName(); if (constraintsSet.hasConstraintsForRange(sname, ename)) { return constraintsSet.getConstraintsForRange(sname, ename); } } else if ((timeDescriptors.getTime() != null) && constraintsSet.hasConstraintsFor(timeDescriptors.getTime().getLocalName())) { return constraintsSet.getConstraintsFor(timeDescriptors.getTime().getLocalName()); } return new TemporalConstraints(); }
final TimeDescriptors timeDescriptors = TimeUtils.inferTimeAttributeDescriptor(featureType); if ((timeDescriptors.getStartRange() != null) && (timeDescriptors.getEndRange() != null)) { new FeatureAttributeHandler(timeDescriptors.getStartRange()); final FeatureAttributeHandler fah_endRange = new FeatureAttributeHandler(timeDescriptors.getEndRange()); final FieldVisibilityHandler<SimpleFeature, Object> visibilityHandler = config.getManager().createVisibilityHandler( timeDescriptors.getStartRange().getLocalName(), fieldVisiblityHandler, config.getAttributeName());
public static TemporalConstraints getTemporalConstraintsForDescriptors( final TimeDescriptors timeDescriptors, final TemporalConstraintsSet timeBoundsSet) { if ((timeBoundsSet == null) || timeBoundsSet.isEmpty()) { return new TemporalConstraints(); } if ((timeDescriptors.getStartRange() != null) && (timeDescriptors.getEndRange() != null)) { return composeRangeTemporalConstraints(timeDescriptors, timeBoundsSet); } else if ((timeDescriptors.getTime() != null) && timeBoundsSet.hasConstraintsFor(timeDescriptors.getTime().getLocalName())) { return timeBoundsSet.getConstraintsFor(timeDescriptors.getTime().getLocalName()); } return new TemporalConstraints(); }
final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> stats) { if ((timeDescriptors.getEndRange() != null) || (timeDescriptors.getStartRange() != null)) { final FeatureTimeRangeStatistics endRange = (timeDescriptors.getEndRange() != null) : null; final FeatureTimeRangeStatistics startRange = (timeDescriptors.getStartRange() != null) ? ((FeatureTimeRangeStatistics) stats.get( VectorStatisticsQueryBuilder.newBuilder().factory().timeRange().fieldName( timeDescriptors.getStartRange().getLocalName()).build().getId())) : null;
public static String getTimeField(final DataStorePluginOptions dataStore, final String typeName) { final PersistentAdapterStore adapterStore = dataStore.createAdapterStore(); final InternalAdapterStore internalAdapterStore = dataStore.createInternalAdapterStore(); final DataTypeAdapter<?> adapter = adapterStore.getAdapter(internalAdapterStore.getAdapterId(typeName)).getAdapter(); if ((adapter != null) && (adapter instanceof GeotoolsFeatureDataAdapter)) { final GeotoolsFeatureDataAdapter gtAdapter = (GeotoolsFeatureDataAdapter) adapter; final SimpleFeatureType featureType = gtAdapter.getFeatureType(); final TimeDescriptors timeDescriptors = gtAdapter.getTimeDescriptors(); // If not indexed, try to find a time field if ((timeDescriptors == null) || !timeDescriptors.hasTime()) { for (final AttributeDescriptor attrDesc : featureType.getAttributeDescriptors()) { final Class<?> bindingClass = attrDesc.getType().getBinding(); if (TimeUtils.isTemporal(bindingClass)) { return attrDesc.getLocalName(); } } } else { if (timeDescriptors.getTime() != null) { return timeDescriptors.getTime().getLocalName(); } else if (timeDescriptors.getStartRange() != null) { // give back start|stop string return timeDescriptors.getStartRange().getLocalName() + "|" + timeDescriptors.getEndRange().getLocalName(); } } } return null; }
protected static Filter getFilter( final GeotoolsFeatureDataAdapter adapter, final QueryConstraints delegateConstraints) { final List<MultiDimensionalNumericData> constraints = delegateConstraints.getIndexConstraints(new TemporalIndexBuilder().createIndex()); if (adapter.getTimeDescriptors().getTime() != null) { return constraintsToFilter( constraints, data -> TimeUtils.toDuringFilter( (long) data.getMinValuesPerDimension()[0], (long) data.getMaxValuesPerDimension()[0], adapter.getTimeDescriptors().getTime().getLocalName())); } else if ((adapter.getTimeDescriptors().getStartRange() != null) && (adapter.getTimeDescriptors().getEndRange() != null)) { return constraintsToFilter( constraints, data -> TimeUtils.toFilter( (long) data.getMinValuesPerDimension()[0], (long) data.getMaxValuesPerDimension()[0], adapter.getTimeDescriptors().getStartRange().getLocalName(), adapter.getTimeDescriptors().getEndRange().getLocalName())); } return null; }
if ((timeDescriptors.getEndRange() != null) && (timeDescriptors.getStartRange() != null)) { final String ename = timeDescriptors.getEndRange().getLocalName(); final String sname = timeDescriptors.getStartRange().getLocalName(); if (constraintsSet.hasConstraintsForRange(sname, ename)) { final TemporalRange statsStartRange = getStatsRange(statsMap, timeDescriptors.getStartRange()); final TemporalRange statsEndRange = getStatsRange(statsMap, timeDescriptors.getEndRange()); final TemporalRange fullRange =
attrs.remove(timeDesc.getLocalName()); final AttributeDescriptor startDesc = timeDescriptors.getStartRange(); if (startDesc != null) { attrs.remove(startDesc.getLocalName());