FeatureTransformerHtml implements FeatureTransformer2 { protected void writeField(FeatureProperty featureProperty, String value) { if (featureProperty.isId()) { currentFeature.id = new PropertyDTO(); currentFeature.id.addValue(value); currentFeature.id.itemProp = "url"; } PropertyDTO property = new PropertyDTO(); property.name = featureProperty.getName(); property.addValue(value); if (currentFeature.name != null) { int pos = currentFeature.name.indexOf("{{" + property.name + "}}"); if (pos > -1) { currentFeature.name = currentFeature.name.substring(0, pos) + value + currentFeature.name.substring(pos); } } String tkey = featureProperty.getName() .replaceAll("\\[[^\\]]+?\\]", "[]"); if (transformations.containsKey(tkey)) { Optional<ValueDTO> transformedProperty = property.values.size()>0 ? transformations.get(tkey) .transform(property.values.get(0), featureProperty) : Optional.empty(); if (transformedProperty.isPresent()) { if (transformedProperty.get().property.name.equals(featureProperty.getName()) && featureSchema.isPresent()) { String propertyName = featureProperty.getName().replace("[]", ""); FeatureSchema schema = featureSchema.get() .getProperties() .stream() .filter(prop -> prop.getName().equals(propertyName)) .findAny() .orElse(null); if (schema!=null) { transformedProperty.get().property.name = schema.getLabel().orElse(schema.getName()); } } property.values.set(0,transformedProperty.get()); currentFeature.addChild(property); } } else { if (featureSchema.isPresent()) { String propertyName = featureProperty.getName().replace("[]", ""); FeatureSchema schema = featureSchema.get() .getProperties() .stream() .filter(prop -> prop.getName().equals(propertyName)) .findAny() .orElse(null); if (schema!=null) { property.name = schema.getLabel().orElse(schema.getName()); } } currentFeature.addChild(property); } } FeatureTransformerHtml(FeatureTransformationContextHtml transformationContext, HttpClient httpClient); @Override String getTargetFormat(); @Override void onStart(OptionalLong numberReturned, OptionalLong numberMatched); @Override void onEnd(); @Override void onFeatureStart(FeatureType featureType); @Override void onFeatureEnd(); @Override void onPropertyStart(FeatureProperty featureProperty, List<Integer> multiplicities); @Override void onPropertyText(String text); @Override void onPropertyEnd(); @Override void onGeometryStart(FeatureProperty featureProperty, SimpleFeatureGeometry type,
                                Integer dimension); @Override void onGeometryNestedStart(); @Override void onGeometryCoordinates(String text); @Override void onGeometryNestedEnd(); @Override void onGeometryEnd();  }
@Test public void testWriteField() { String input = "Abc|\n---|\n1|"; String actual = StringTemplateFilters.applyFilterMarkdown(input); LOGGER.info(actual); }