@Override public void updateType(final SimpleFeatureType persistType) { for (final AttributeDescriptor attrDesc : persistType.getAttributeDescriptors()) { final Class<?> bindingClass = attrDesc.getType().getBinding(); if (TimeUtils.isTemporal(bindingClass)) { attrDesc.getUserData().put("time", Boolean.FALSE); } } if (startRangeName != null) { persistType.getDescriptor(startRangeName).getUserData().put("start", Boolean.TRUE); } if (endRangeName != null) { persistType.getDescriptor(endRangeName).getUserData().put("end", Boolean.TRUE); } if (timeName != null) { persistType.getDescriptor(timeName).getUserData().put("time", Boolean.TRUE); } }
for (final AttributeDescriptor attrDesc : persistType.getAttributeDescriptors()) { final Class<?> bindingClass = attrDesc.getType().getBinding(); if (TimeUtils.isTemporal(bindingClass)) { final Boolean isTime = (Boolean) attrDesc.getUserData().get("time"); if (isTime != null) {
if (TimeUtils.isTemporal(descriptor.getType().getBinding())) {
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; }