public void serialize(final JsonGenerator jgen, final Geospatial value) throws IOException { if (value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeographyCollection) || value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) { final int yIdx = value.getEdmPrimitiveTypeKind().name().indexOf('y'); final String itemType = value.getEdmPrimitiveTypeKind().name().substring(yIdx + 1); jgen.writeStringField(Constants.ATTR_TYPE, itemType); switch (value.getEdmPrimitiveTypeKind()) { case GeographyPoint: case GeometryPoint: if (value.getSrid() != null && value.getSrid().isNotDefault()) { srid(jgen, value.getSrid());
json.writeStringField(Constants.ATTR_TYPE, geoValueTypeToJsonName.get(geoValue.getGeoType())); json.writeFieldName(geoValue.getGeoType() == Geospatial.Type.GEOSPATIALCOLLECTION ? Constants.JSON_GEOMETRIES : Constants.JSON_COORDINATES); json.writeStartArray(); switch (geoValue.getGeoType()) { case POINT: writeGeoPoint(json, (Point) geoValue); case GEOSPATIALCOLLECTION: for (final Geospatial element : (GeospatialCollection) geoValue) { writeGeoValue(name, EdmPrimitiveTypeFactory.getInstance(element.getEdmPrimitiveTypeKind()), element, isNullable, json, geoValue.getSrid()); if (geoValue.getSrid() != null && geoValue.getSrid().isNotDefault() && (parentSrid == null || !parentSrid.equals(geoValue.getSrid()))) { srid(json, geoValue.getSrid());
result.append(item.getClass().getSimpleName()).append('('); switch (item.getEdmPrimitiveTypeKind()) { case GeographyPoint: case GeometryPoint:
private void writeSrsName(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException { if (value.getSrid() != null && value.getSrid().isNotDefault()) { writer.writeAttribute(Constants.PREFIX_GML, Constants.NS_GML, Constants.ATTR_SRSNAME, Constants.SRS_URLPREFIX + value.getSrid().toString()); } }
throw new EdmPrimitiveTypeException("The value type " + geoValue.getClass() + " is not supported."); if (geoValue.getSrid() != null && geoValue.getSrid().isNotDefault()) { throw new SerializerException("Non-standard SRID not supported!", SerializerException.MessageKeys.WRONG_PROPERTY_VALUE, name, geoValue.toString()); json.writeStringField(Constants.ATTR_TYPE, geoValueTypeToJsonName.get(geoValue.getGeoType())); json.writeFieldName(geoValue.getGeoType() == Geospatial.Type.GEOSPATIALCOLLECTION ? Constants.JSON_GEOMETRIES : Constants.JSON_COORDINATES); json.writeStartArray(); switch (geoValue.getGeoType()) { case POINT: writeGeoPoint(json, (Point) geoValue); case GEOSPATIALCOLLECTION: for (final Geospatial element : (GeospatialCollection) geoValue) { writeGeoValue(name, EdmPrimitiveTypeFactory.getInstance(element.getEdmPrimitiveTypeKind()), element, isNullable, json);
result.append(item.getClass().getSimpleName()).append('('); switch (item.getEdmPrimitiveTypeKind()) { case GeographyPoint: case GeometryPoint:
private void writeSrsName(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException { if (value.getSrid() != null && value.getSrid().isNotDefault()) { writer.writeAttribute(Constants.PREFIX_GML, Constants.NS_GML, Constants.ATTR_SRSNAME, Constants.SRS_URLPREFIX + value.getSrid().toString()); } }
public void serialize(final JsonGenerator jgen, final Geospatial value) throws IOException { if (value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeographyCollection) || value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) { final int yIdx = value.getEdmPrimitiveTypeKind().name().indexOf('y'); final String itemType = value.getEdmPrimitiveTypeKind().name().substring(yIdx + 1); jgen.writeStringField(Constants.ATTR_TYPE, itemType); switch (value.getEdmPrimitiveTypeKind()) { case GeographyPoint: case GeometryPoint: if (value.getSrid() != null && value.getSrid().isNotDefault()) { srid(jgen, value.getSrid());
public void serialize(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException { switch (value.getEdmPrimitiveTypeKind()) { case GeographyPoint: case GeometryPoint:
public static AbstractGeospatialType convert(Geospatial geospatial, Class<?> expectedType, String srid) { Geometry result = convertToJTS(geospatial); if (geospatial.getSrid() != null && geospatial.getSrid().isNotDefault()) { srid = geospatial.getSrid().toString(); } if (srid != null) { try { result.setSRID(Integer.valueOf(geospatial.getSrid().toString())); } catch (NumberFormatException e) { } } if (expectedType == GeographyType.class) { //assume normalization and valid srid? return GeometryUtils.getGeographyType(result); } return GeometryUtils.getGeometryType(result); }
: (obj instanceof Geospatial) ? Encoder.encode(EdmPrimitiveTypeFactory.getInstance( ((Geospatial) obj).getEdmPrimitiveTypeKind()). valueToString(obj, null, null, Constants.DEFAULT_PRECISION,
public static AbstractGeospatialType convert(Geospatial geospatial, Class<?> expectedType, String srid) { Geometry result = convertToJTS(geospatial); if (geospatial.getSrid() != null && geospatial.getSrid().isNotDefault()) { srid = geospatial.getSrid().toString(); } if (srid != null) { try { result.setSRID(Integer.valueOf(geospatial.getSrid().toString())); } catch (NumberFormatException e) { } } if (expectedType == GeographyType.class) { //assume normalization and valid srid? return GeometryUtils.getGeographyType(result); } return GeometryUtils.getGeometryType(result); }
: (obj instanceof Geospatial) ? Encoder.encode(EdmPrimitiveTypeFactory.getInstance( ((Geospatial) obj).getEdmPrimitiveTypeKind()). valueToString(obj, null, null, Constants.DEFAULT_PRECISION,
public void serialize(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException { switch (value.getEdmPrimitiveTypeKind()) { case GeographyPoint: case GeometryPoint:
|| EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(type) || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(type) ? valuable.asGeospatial().getEdmPrimitiveTypeKind() : EdmPrimitiveTypeKind.valueOfFQN(type.toString())). build();
|| EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(type) || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(type) ? valuable.asGeospatial().getEdmPrimitiveTypeKind() : EdmPrimitiveTypeKind.valueOfFQN(type.toString())). build();