@Override public SRID getSrid() { if (srid != null) return SRID.valueOf(srid); else return null; }
@JsonSetter void setSrid(String srid) { if (srid != null) this.srid = SRID.valueOf(srid); else this.srid = null; } }
@JsonSetter void setSrid(String srid) { if (srid != null) this.srid = SRID.valueOf(srid); else this.srid = null; }
protected Polygon stringToPolygon(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { final Matcher matcher = getMatcher(PATTERN, value); return newPolygon(SRID.valueOf(matcher.group(2)), matcher.group(4), isNullable, maxLength, precision, scale, isUnicode); }
protected Point stringToPoint(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { final Matcher matcher = getMatcher(PATTERN, value); return newPoint(SRID.valueOf(matcher.group(2)), matcher.group(4), isNullable, maxLength, precision, scale, isUnicode); }
protected LineString stringToLineString(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { final Matcher matcher = getMatcher(PATTERN, value); return newLineString(SRID.valueOf(matcher.group(2)), matcher.group(4), isNullable, maxLength, precision, scale, isUnicode); }
protected Polygon stringToPolygon(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { final Matcher matcher = getMatcher(PATTERN, value); return newPolygon(SRID.valueOf(matcher.group(2)), matcher.group(4), isNullable, maxLength, precision, scale, isUnicode); }
protected LineString stringToLineString(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { final Matcher matcher = getMatcher(PATTERN, value); return newLineString(SRID.valueOf(matcher.group(2)), matcher.group(4), isNullable, maxLength, precision, scale, isUnicode); }
protected Point stringToPoint(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { final Matcher matcher = getMatcher(PATTERN, value); return newPoint(SRID.valueOf(matcher.group(2)), matcher.group(4), isNullable, maxLength, precision, scale, isUnicode); }
protected MultiPoint stringToMultiPoint(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { final Matcher matcher = getMatcher(PATTERN, value); final List<Point> points = new ArrayList<Point>(); for (final String pointCoo : split(matcher.group(4), ',')) { points.add(newPoint(null, pointCoo.substring(1, pointCoo.length() - 1), isNullable, maxLength, precision, scale, isUnicode)); } return new MultiPoint(dimension, SRID.valueOf(matcher.group(2)), points); }
protected MultiLineString stringToMultiLineString(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { final Matcher matcher = getMatcher(PATTERN, value); final List<LineString> lineStrings = new ArrayList<LineString>(); for (String coo : matcher.group(4).contains("),(") ? matcher.group(4).split("\\),\\(") : new String[] { matcher.group(4) }) { String lineString = coo; if (lineString.charAt(0) == '(') { lineString = lineString.substring(1); } if (lineString.endsWith(")")) { lineString = lineString.substring(0, lineString.length() - 1); } lineStrings.add(newLineString(null, lineString, isNullable, maxLength, precision, scale, isUnicode)); } return new MultiLineString(this.dimension, SRID.valueOf(matcher.group(2)), lineStrings); }
protected MultiPoint stringToMultiPoint(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { final Matcher matcher = getMatcher(PATTERN, value); final List<Point> points = new ArrayList<Point>(); for (final String pointCoo : split(matcher.group(4), ',')) { points.add(newPoint(null, pointCoo.substring(1, pointCoo.length() - 1), isNullable, maxLength, precision, scale, isUnicode)); } return new MultiPoint(dimension, SRID.valueOf(matcher.group(2)), points); }
protected MultiLineString stringToMultiLineString(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { final Matcher matcher = getMatcher(PATTERN, value); final List<LineString> lineStrings = new ArrayList<LineString>(); for (String coo : matcher.group(4).contains("),(") ? matcher.group(4).split("\\),\\(") : new String[] { matcher.group(4) }) { String lineString = coo; if (lineString.charAt(0) == '(') { lineString = lineString.substring(1); } if (lineString.endsWith(")")) { lineString = lineString.substring(0, lineString.length() - 1); } lineStrings.add(newLineString(null, lineString, isNullable, maxLength, precision, scale, isUnicode)); } return new MultiLineString(this.dimension, SRID.valueOf(matcher.group(2)), lineStrings); }
protected MultiPolygon stringToMultiPolygon(final String value, final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { final Matcher matcher = getMatcher(PATTERN, value); final List<Polygon> polygons = new ArrayList<Polygon>(); for (String coo : matcher.group(4).contains(")),((") ? matcher.group(4).split("\\)\\),\\(\\(") : new String[] { matcher.group(4) }) { String polygon = coo; if (polygon.startsWith("((")) { polygon = polygon.substring(1); } if (polygon.endsWith("))")) { polygon = polygon.substring(0, polygon.length() - 1); } if (polygon.charAt(0) != '(') { polygon = "(" + polygon; } if (!polygon.endsWith(")")) { polygon += ")"; } polygons.add(newPolygon(null, polygon, isNullable, maxLength, precision, scale, isUnicode)); } return new MultiPolygon(dimension, SRID.valueOf(matcher.group(2)), polygons); }
SRID getSRID() { SRID result = null; if (jpaAttribute.getJavaMember() instanceof AnnotatedElement) { final AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember(); final EdmGeospatial spatialDetails = annotatedElement.getAnnotation(EdmGeospatial.class); if (spatialDetails != null) { final String srid = spatialDetails.srid(); if (srid.isEmpty()) result = SRID.valueOf(null); else result = SRID.valueOf(srid); result.setDimension(spatialDetails.dimension()); } } return result; }
public static Geospatial convertToODataValue(InputStream wkb, boolean includesSrid) throws FunctionExecutionException { Geometry g = GeometryUtils.getGeometry(wkb, null, includesSrid); JTS2OlingoBridge bridge = new JTS2OlingoBridge(Dimension.GEOMETRY, includesSrid?SRID.valueOf(String.valueOf(g.getSRID())):null); return bridge.convert(g); }
public static Geospatial convertToODataValue(InputStream wkb, boolean includesSrid) throws FunctionExecutionException { Geometry g = GeometryUtils.getGeometry(wkb, null, includesSrid); JTS2OlingoBridge bridge = new JTS2OlingoBridge(Dimension.GEOMETRY, includesSrid?SRID.valueOf(String.valueOf(g.getSRID())):null); return bridge.convert(g); }
@Override public SRID getSrid() { if (jpaParameter.srid() != null && !jpaParameter.srid().srid().isEmpty()) { final SRID srid = SRID.valueOf(jpaParameter.srid().srid()); srid.setDimension(jpaParameter.srid().dimension()); return srid; } else return null; } }
private void readReturnType(XMLEventReader reader, StartElement element, CsdlOperation operation) throws XMLStreamException { CsdlReturnType returnType = new CsdlReturnType(); returnType.setType(readType(element)); returnType.setCollection(isCollectionType(element)); returnType.setNullable(Boolean.parseBoolean(attr(element, "Nullable"))); String maxLength = attr(element, "MaxLength"); if (maxLength != null) { returnType.setMaxLength(Integer.parseInt(maxLength)); } String precision = attr(element, "Precision"); if (precision != null) { returnType.setPrecision(Integer.parseInt(precision)); } String scale = attr(element, "Scale"); if (scale != null) { returnType.setScale(Integer.parseInt(scale)); } String srid = attr(element, "SRID"); if (srid != null) { returnType.setSrid(SRID.valueOf(srid)); } peekAnnotations(reader, element.getName().getLocalPart(), returnType); operation.setReturnType(returnType); }
@Override protected CsdlReturnType determineEdmResultType(final ReturnType returnType) throws ODataJPAModelException { final CsdlReturnType edmResultType = new CsdlReturnType(); edmResultType.setType(determineReturnType(returnType)); edmResultType.setCollection(returnType.isCollection()); edmResultType.setNullable(returnType.isNullable()); if (returnType.maxLength() >= 0) edmResultType.setMaxLength(returnType.maxLength()); if (returnType.precision() >= 0) edmResultType.setPrecision(returnType.precision()); if (returnType.scale() >= 0) edmResultType.setScale(returnType.scale()); if (returnType.srid() != null && !returnType.srid().srid().isEmpty()) { final SRID srid = SRID.valueOf(returnType.srid().srid()); srid.setDimension(returnType.srid().dimension()); edmResultType.setSrid(srid); } return edmResultType; }