Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import static de.ii.xtraplatform.cql.domain.In.ID_PLACEHOLDER;

import com.fasterxml.jackson.core.JsonParseException;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import dagger.assisted.Assisted;
import dagger.assisted.AssistedInject;
Expand Down Expand Up @@ -56,7 +55,6 @@
import de.ii.xtraplatform.features.domain.FeatureStreamImpl;
import de.ii.xtraplatform.features.domain.FeatureTokenDecoder;
import de.ii.xtraplatform.features.domain.FeatureTokenSource;
import de.ii.xtraplatform.features.domain.FeatureTokenTransformer;
import de.ii.xtraplatform.features.domain.FeatureTransactions;
import de.ii.xtraplatform.features.domain.FeatureTransactions.MutationResult.Builder;
import de.ii.xtraplatform.features.domain.FeatureTransactions.MutationResult.Type;
Expand Down Expand Up @@ -941,11 +939,6 @@ protected WkbDialect getWkbDialect() {
return WkbDialect.SQL_MM;
}

@Override
protected List<FeatureTokenTransformer> getDecoderTransformers() {
return ImmutableList.of(); // new FeatureTokenTransformerSorting());
}

@Override
public FeatureProviderSqlData getData() {
return (FeatureProviderSqlData) super.getData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ public void onFeatureStart(ModifiableContext<FeatureSchema, SchemaMapping> conte

downstream.onFeatureStart(newContext);
downstream.bufferStart();
downstream.next(0);

this.currentValueTransformerChain = valueTransformerChains.get(context.type());
}
Expand Down Expand Up @@ -203,95 +202,72 @@ private void applyTokenSliceTransformers(String type) {

@Override
public void onObjectStart(ModifiableContext<FeatureSchema, SchemaMapping> context) {
int pos = context.pos();
if (pos > -1) {
downstream.next(pos, context.parentPos());

if (context.schema().filter(schema -> schema.isObject() || schema.isSpatial()).isPresent()) {
FeatureSchema schema = context.schema().get();

downstream.onObjectStart(schema.getFullPath());
}
// emit for object/spatial properties but not the feature root itself: a path-less marker
// resolves to the root schema (an object), which the type check alone would not exclude
if (context
.schema()
.filter(schema -> (schema.isObject() || schema.isSpatial()) && !schema.isFeature())
.isPresent()) {
FeatureSchema schema = context.schema().get();

downstream.onObjectStart(schema.getFullPath());
}
}

@Override
public void onObjectEnd(ModifiableContext<FeatureSchema, SchemaMapping> context) {
int pos = context.pos();
if (pos > -1) {
downstream.next(pos, context.parentPos());

if (context.schema().filter(schema -> schema.isObject() || schema.isSpatial()).isPresent()) {
FeatureSchema schema = context.schema().get();
downstream.onObjectEnd(schema.getFullPath());
}
// not the feature root itself (see onObjectStart)
if (context
.schema()
.filter(schema -> (schema.isObject() || schema.isSpatial()) && !schema.isFeature())
.isPresent()) {
FeatureSchema schema = context.schema().get();
downstream.onObjectEnd(schema.getFullPath());
}
}

@Override
public void onArrayStart(ModifiableContext<FeatureSchema, SchemaMapping> context) {
int pos = context.pos();
if (pos > -1) {
downstream.next(pos, context.parentPos());

if (context.schema().filter(schema -> schema.isArray() || schema.isSpatial()).isPresent()) {
FeatureSchema schema = context.schema().get();
if (context.schema().filter(schema -> schema.isArray() || schema.isSpatial()).isPresent()) {
FeatureSchema schema = context.schema().get();

downstream.onArrayStart(schema.getFullPath());
}
downstream.onArrayStart(schema.getFullPath());
}
}

@Override
public void onArrayEnd(ModifiableContext<FeatureSchema, SchemaMapping> context) {
int pos = context.pos();
if (pos > -1) {
downstream.next(pos, context.parentPos());

if (context.schema().filter(schema -> schema.isArray() || schema.isSpatial()).isPresent()) {
FeatureSchema schema = context.schema().get();
downstream.onArrayEnd(schema.getFullPath());
}
if (context.schema().filter(schema -> schema.isArray() || schema.isSpatial()).isPresent()) {
FeatureSchema schema = context.schema().get();
downstream.onArrayEnd(schema.getFullPath());
}
}

@Override
public void onGeometry(ModifiableContext<FeatureSchema, SchemaMapping> context) {
int pos = context.pos();
if (pos > -1) {
downstream.next(pos, context.parentPos());

if (context.schema().filter(FeatureSchema::isSpatial).isPresent()) {
FeatureSchema schema = context.schema().get();
Geometry<?> geometry = context.geometry();
downstream.onGeometry(schema.getFullPath(), geometry);
}
if (context.schema().filter(FeatureSchema::isSpatial).isPresent()) {
FeatureSchema schema = context.schema().get();
Geometry<?> geometry = context.geometry();
downstream.onGeometry(schema.getFullPath(), geometry);
}
}

@Override
public void onValue(ModifiableContext<FeatureSchema, SchemaMapping> context) {
int pos = context.pos();
if (pos > -1) {
downstream.next(pos, context.parentPos());
if (context.schema().filter(FeatureSchema::isValue).isPresent()) {
FeatureSchema schema = context.schema().get();

if (context.schema().filter(FeatureSchema::isValue).isPresent()) {
FeatureSchema schema = context.schema().get();
Type valueType =
schema.isSpatial() ? context.valueType() : schema.getValueType().orElse(schema.getType());

Type valueType =
schema.isSpatial()
? context.valueType()
: schema.getValueType().orElse(schema.getType());
String path = schema.getFullPathAsString();
String value = context.value();

String path = schema.getFullPathAsString();
String value = context.value();

if (Objects.nonNull(value)) {
value = currentValueTransformerChain.transform(path, value);
}

downstream.onValue(schema.getFullPath(), value, valueType);
if (Objects.nonNull(value)) {
value = currentValueTransformerChain.transform(path, value);
}

downstream.onValue(schema.getFullPath(), value, valueType);
}
}
}
Loading
Loading