private void putGeoJson(Map<String, Object> map, String geojson) { try { if (!Strings.isNullOrEmpty(geojson)) { map.put(fields.getGeoJSON(), mapper.readValue(geojson, mapLikeType)); } } catch (IOException e) { getMonitor().warn("Unable to persist geoJson", e); } }
private void processFeature(Map<String, Object> map, Base base, Feature f) { if (stopFeatures.contains(f.getName()) || stopFeatures.contains(f.getShortName())) { return; } try { convertFeature(map, base, f); } catch (Exception e) { getMonitor() .warn( "Couldn't output {} to map. Type '{}' isn't supported.", f.getName(), f.getRange().getShortName(), e); } }
private void convertFeature(Map<String, Object> map, Base base, Feature f) { if (f.getRange().isPrimitive()) { if (mapGeoJsonToObject && GEO_JSON.equals(f.getShortName())) { getMonitor().trace("Feature is GeoJSON - parsing to a database object"); putGeoJson(map, base.getFeatureValueAsString(f)); } else { getMonitor().trace("Converting primitive feature to an object"); map.put(ConsumerUtils.toCamelCase(f.getShortName()), FeatureUtils.featureToObject(f, base)); && f.getRange().getComponentType() != null && f.getRange().getComponentType().isPrimitive()) { getMonitor().trace("Converting primitive feature to an array"); map.put(ConsumerUtils.toCamelCase(f.getShortName()), FeatureUtils.featureToList(f, base)); } else { getMonitor() .trace("Feature is not a primitive type - will try to treat the feature as an entity"); if (f.getRange().isArray()) { getMonitor().trace("Feature is an array - attempting converstion to an array of entities"); FSArray fArr = (FSArray) base.getFeatureValue(f); if (fArr != null) { getMonitor().trace("Feature is singular - attempting conversion to a single entity"); FeatureStructure ent = base.getFeatureValue(f); if (ent == null) { map.put(ConsumerUtils.toCamelCase(f.getShortName()), ((Entity) ent).getExternalId()); } else { getMonitor().trace("Unable to persist feature {}", f.getShortName());