diff --git a/lib/client-api/pom.xml b/lib/client-api/pom.xml
index e506a97b2..eb3f9e3b9 100644
--- a/lib/client-api/pom.xml
+++ b/lib/client-api/pom.xml
@@ -45,10 +45,6 @@
commons-io
commons-io
-
- org.apache.commons
- commons-lang3
-
org.apache.httpcomponents
httpclient
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/GeoUtils.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java
similarity index 63%
rename from lib/client-api/src/main/java/org/apache/olingo/client/api/utils/GeoUtils.java
rename to lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java
index c4270fea0..083b4e059 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/utils/GeoUtils.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeoUtils.java
@@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.olingo.client.api.utils;
+package org.apache.olingo.client.api.data;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
public final class GeoUtils {
@@ -28,7 +28,7 @@ public final class GeoUtils {
// Empty private constructor for static utility classes
}
- public static Geospatial.Dimension getDimension(final ODataJClientEdmPrimitiveType type) {
+ public static Geospatial.Dimension getDimension(final EdmPrimitiveTypeKind type) {
Geospatial.Dimension dimension;
switch (type) {
@@ -50,39 +50,39 @@ public final class GeoUtils {
return dimension;
}
- public static ODataJClientEdmPrimitiveType getType(final Geospatial.Dimension dimension, final String elementName) {
- ODataJClientEdmPrimitiveType type = null;
+ public static EdmPrimitiveTypeKind getType(final Geospatial.Dimension dimension, final String elementName) {
+ EdmPrimitiveTypeKind type = null;
if (Constants.ELEM_POINT.equals(elementName)) {
type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPoint
- : ODataJClientEdmPrimitiveType.GeometryPoint;
+ ? EdmPrimitiveTypeKind.GeographyPoint
+ : EdmPrimitiveTypeKind.GeometryPoint;
} else if (Constants.ELEM_MULTIPOINT.equals(elementName)) {
type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPoint
- : ODataJClientEdmPrimitiveType.GeometryMultiPoint;
+ ? EdmPrimitiveTypeKind.GeographyMultiPoint
+ : EdmPrimitiveTypeKind.GeometryMultiPoint;
} else if (Constants.ELEM_LINESTRING.equals(elementName)) {
type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyLineString
- : ODataJClientEdmPrimitiveType.GeometryLineString;
+ ? EdmPrimitiveTypeKind.GeographyLineString
+ : EdmPrimitiveTypeKind.GeometryLineString;
} else if (Constants.ELEM_MULTILINESTRING.equals(elementName)) {
type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiLineString
- : ODataJClientEdmPrimitiveType.GeometryMultiLineString;
+ ? EdmPrimitiveTypeKind.GeographyMultiLineString
+ : EdmPrimitiveTypeKind.GeometryMultiLineString;
} else if (Constants.ELEM_POLYGON.equals(elementName)) {
type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPolygon
- : ODataJClientEdmPrimitiveType.GeometryPolygon;
+ ? EdmPrimitiveTypeKind.GeographyPolygon
+ : EdmPrimitiveTypeKind.GeometryPolygon;
} else if (Constants.ELEM_MULTIPOLYGON.equals(elementName)) {
type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPolygon
- : ODataJClientEdmPrimitiveType.GeometryMultiPolygon;
+ ? EdmPrimitiveTypeKind.GeographyMultiPolygon
+ : EdmPrimitiveTypeKind.GeometryMultiPolygon;
} else if (Constants.ELEM_GEOCOLLECTION.equals(elementName)
|| Constants.ELEM_GEOMEMBERS.equals(elementName)) {
type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyCollection
- : ODataJClientEdmPrimitiveType.GeometryCollection;
+ ? EdmPrimitiveTypeKind.GeographyCollection
+ : EdmPrimitiveTypeKind.GeometryCollection;
}
return type;
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
index b0deea4bd..c5d4d2aeb 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/GeospatialValue.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.data;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
public interface GeospatialValue extends Value {
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
index 93c4cfbdd..bd9658763 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataGeospatialValue.java
@@ -19,7 +19,8 @@
package org.apache.olingo.client.api.domain;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
public class ODataGeospatialValue extends ODataPrimitiveValue {
@@ -57,7 +58,7 @@ public class ODataGeospatialValue extends ODataPrimitiveValue {
* @param type type.
* @return the current builder.
*/
- public Builder setType(final ODataJClientEdmPrimitiveType type) {
+ public Builder setType(final EdmPrimitiveTypeKind type) {
isSupported(type);
if (type != null && !type.isGeospatial()) {
@@ -65,7 +66,7 @@ public class ODataGeospatialValue extends ODataPrimitiveValue {
"Use " + ODataPrimitiveValue.class.getSimpleName() + " for non-geospatial types");
}
- if (type == ODataJClientEdmPrimitiveType.Geography || type == ODataJClientEdmPrimitiveType.Geometry) {
+ if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) {
throw new IllegalArgumentException(
type + " is not an instantiable type. "
+ "An entity can declare a property to be of type Geometry. "
@@ -86,7 +87,7 @@ public class ODataGeospatialValue extends ODataPrimitiveValue {
throw new IllegalArgumentException("No Geospatial value provided");
}
if (this.ogv.type == null) {
- this.ogv.type = ((Geospatial) this.ogv.value).getEdmSimpleType();
+ this.ogv.type = ((Geospatial) this.ogv.value).getEdmPrimitiveTypeKind();
}
return this.ogv;
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
index 4b1deccba..5ea5edfa9 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataJClientEdmPrimitiveType.java
@@ -22,15 +22,15 @@ import java.math.BigDecimal;
import java.net.URI;
import java.util.UUID;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
/**
* Represent the primitive types of the Entity Data Model (EDM).
@@ -72,11 +72,11 @@ public enum ODataJClientEdmPrimitiveType {
/**
* A 64-bit value expressed as Coordinated Universal Time (UTC).
*/
- DateTime(new ODataServiceVersion[]{ODataServiceVersion.V30}, ODataTimestamp.class, "yyyy-MM-dd'T'HH:mm:ss"),
+ DateTime(new ODataServiceVersion[] {ODataServiceVersion.V30}, ODataTimestamp.class, "yyyy-MM-dd'T'HH:mm:ss"),
/**
* Date without a time-zone offset.
*/
- Date(new ODataServiceVersion[]{ODataServiceVersion.V40}, ODataTimestamp.class, "yyyy-MM-dd"),
+ Date(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataTimestamp.class, "yyyy-MM-dd"),
/**
* Date and time as an Offset in minutes from GMT.
*/
@@ -84,15 +84,15 @@ public enum ODataJClientEdmPrimitiveType {
/**
* The time of day with values ranging from 0:00:00.x to 23:59:59.y, where x and y depend upon the precision.
*/
- Time(new ODataServiceVersion[]{ODataServiceVersion.V30}, ODataDuration.class),
+ Time(new ODataServiceVersion[] {ODataServiceVersion.V30}, ODataDuration.class),
/**
* The time of day with values ranging from 0:00:00.x to 23:59:59.y, where x and y depend upon the precision.
*/
- TimeOfDay(new ODataServiceVersion[]{ODataServiceVersion.V40}, ODataDuration.class),
+ TimeOfDay(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataDuration.class),
/**
* Signed duration in days, hours, minutes, and (sub)seconds.
*/
- Duration(new ODataServiceVersion[]{ODataServiceVersion.V40}, ODataDuration.class),
+ Duration(new ODataServiceVersion[] {ODataServiceVersion.V40}, ODataDuration.class),
/**
* Numeric values with fixed precision and scale.
*/
@@ -256,25 +256,6 @@ public enum ODataJClientEdmPrimitiveType {
throw new IllegalArgumentException(value);
}
- /**
- * Gets EdmSimpleType from object instance.
- *
- * @param workingVersion OData version.
- * @param obj object.
- * @return EdmSimpleType object.
- */
- public static ODataJClientEdmPrimitiveType fromObject(final ODataServiceVersion workingVersion, final Object obj) {
- for (ODataJClientEdmPrimitiveType edmSimpleType : ODataJClientEdmPrimitiveType.values()) {
- if (edmSimpleType.javaType().equals(obj.getClass())) {
- return edmSimpleType == DateTimeOffset || edmSimpleType == DateTime || edmSimpleType == Date
- ? ((ODataTimestamp) obj).isOffset()
- ? DateTimeOffset : workingVersion == ODataServiceVersion.V30 ? DateTime : Date
- : edmSimpleType;
- }
- }
- throw new IllegalArgumentException(obj.getClass().getSimpleName() + " is not a simple type");
- }
-
/**
* Gets namespace.
*
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
index df69d1f35..21d85620c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataPrimitiveValue.java
@@ -28,9 +28,8 @@ import java.util.UUID;
import javax.xml.datatype.Duration;
import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
* OData primitive property value.
@@ -50,8 +49,8 @@ public class ODataPrimitiveValue extends ODataValue {
this.client = client;
}
- public AbstractBuilder isSupported(final ODataJClientEdmPrimitiveType type) {
- if (type != null && !ArrayUtils.contains(type.getSupportedVersions(), client.getServiceVersion())) {
+ public AbstractBuilder isSupported(final EdmPrimitiveTypeKind type) {
+ if (type != null && !type.getSupportedVersions().contains(client.getServiceVersion())) {
throw new IllegalArgumentException(String.format(
"Type %s not supported by the current OData working version", type.toString()));
}
@@ -103,12 +102,12 @@ public class ODataPrimitiveValue extends ODataValue {
* @param type type.
* @return the current builder.
*/
- public Builder setType(final ODataJClientEdmPrimitiveType type) {
+ public Builder setType(final EdmPrimitiveTypeKind type) {
isSupported(type);
- if (type == ODataJClientEdmPrimitiveType.Stream) {
+ if (type == EdmPrimitiveTypeKind.Stream) {
throw new IllegalArgumentException(String.format(
- "Cannot build a primitive value for %s", ODataJClientEdmPrimitiveType.Stream.toString()));
+ "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
}
this.opv.type = type;
@@ -129,7 +128,7 @@ public class ODataPrimitiveValue extends ODataValue {
}
if (this.opv.type == null) {
- this.opv.type = ODataJClientEdmPrimitiveType.String;
+ this.opv.type = EdmPrimitiveTypeKind.String;
}
if (this.opv.type.isGeospatial()) {
@@ -147,7 +146,7 @@ public class ODataPrimitiveValue extends ODataValue {
this.opv.value = new ODataDuration((Duration) this.opv.value);
}
- if (this.opv.value != null && !this.opv.type.javaType().isAssignableFrom(this.opv.value.getClass())) {
+ if (this.opv.value != null && !this.opv.getJavaType().isAssignableFrom(this.opv.value.getClass())) {
throw new IllegalArgumentException("Provided value is not compatible with " + this.opv.type.toString());
}
@@ -177,7 +176,7 @@ public class ODataPrimitiveValue extends ODataValue {
/**
* Value type.
*/
- protected ODataJClientEdmPrimitiveType type;
+ protected EdmPrimitiveTypeKind type;
/**
* Protected constructor, need to use the builder to instantiate this class.
@@ -189,15 +188,82 @@ public class ODataPrimitiveValue extends ODataValue {
this.client = client;
}
+ private Class> getJavaType() {
+ Class> javaType = null;
+
+ switch (this.type) {
+ case Binary:
+ javaType = byte[].class;
+ break;
+
+ case SByte:
+ javaType = Byte.class;
+ break;
+
+ case Boolean:
+ javaType = Boolean.class;
+ break;
+
+ case Date:
+ case DateTime:
+ case DateTimeOffset:
+ javaType = ODataTimestamp.class;
+ break;
+
+ case Time:
+ case TimeOfDay:
+ javaType = ODataDuration.class;
+ break;
+
+ case Decimal:
+ javaType = BigDecimal.class;
+ break;
+
+ case Single:
+ javaType = Float.class;
+ break;
+
+ case Double:
+ javaType = Double.class;
+ break;
+
+ case Guid:
+ javaType = UUID.class;
+ break;
+
+ case Int16:
+ javaType = Short.class;
+ break;
+
+ case Byte:
+ case Int32:
+ javaType = Integer.class;
+ break;
+
+ case Int64:
+ javaType = Long.class;
+ break;
+
+ case Stream:
+ javaType = URI.class;
+ break;
+
+ case String:
+ javaType = String.class;
+ break;
+
+ default:
+ javaType = this.value.getClass();
+ }
+
+ return javaType;
+ }
+
/**
* Parses given text as object value.
*/
private void parseText() {
switch (this.type) {
- case Null:
- this.value = null;
- break;
-
case Binary:
this.value = Base64.decodeBase64(this.toString());
break;
@@ -267,10 +333,6 @@ public class ODataPrimitiveValue extends ODataValue {
*/
private void formatValue() {
switch (this.type) {
- case Null:
- this.text = StringUtils.EMPTY;
- break;
-
case Binary:
this.text = Base64.encodeBase64String(this.toCastValue());
break;
@@ -295,15 +357,15 @@ public class ODataPrimitiveValue extends ODataValue {
break;
case Decimal:
- this.text = new DecimalFormat(this.type.pattern()).format(this.toCastValue());
+ this.text = new DecimalFormat("#.#######################").format(this.toCastValue());
break;
case Single:
- this.text = new DecimalFormat(this.type.pattern()).format(this.toCastValue());
+ this.text = new DecimalFormat("#.#######E0").format(this.toCastValue());
break;
case Double:
- this.text = new DecimalFormat(this.type.pattern()).format(this.toCastValue());
+ this.text = new DecimalFormat("#.#######################E0").format(this.toCastValue());
break;
case Guid:
@@ -341,7 +403,7 @@ public class ODataPrimitiveValue extends ODataValue {
* @return type name.
*/
public String getTypeName() {
- return type.toString();
+ return type.getFullQualifiedName().toString();
}
/**
@@ -369,6 +431,6 @@ public class ODataPrimitiveValue extends ODataValue {
*/
@SuppressWarnings("unchecked")
public T toCastValue() {
- return (T) type.javaType().cast(toValue());
+ return (T) getJavaType().cast(toValue());
}
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
index a1f3e3d7b..3f3eb9c6d 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataTimestamp.java
@@ -25,6 +25,7 @@ import java.util.Date;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
* Helper class for handling datetime and datetime-offset primitive values.
@@ -41,17 +42,25 @@ public final class ODataTimestamp implements Serializable {
private final boolean offset;
- public static ODataTimestamp getInstance(final ODataJClientEdmPrimitiveType type, final Timestamp timestamp) {
- return new ODataTimestamp(new SimpleDateFormat(type.pattern()),
- new Date(timestamp.getTime()), timestamp.getNanos(), type == ODataJClientEdmPrimitiveType.DateTimeOffset);
+ private static String getPattern(final EdmPrimitiveTypeKind type) {
+ return type == EdmPrimitiveTypeKind.DateTime
+ ? "yyyy-MM-dd'T'HH:mm:ss"
+ : type == EdmPrimitiveTypeKind.Date
+ ? "yyyy-MM-dd"
+ : "yyyy-MM-dd'T'HH:mm:ss";
}
- public static ODataTimestamp parse(final ODataJClientEdmPrimitiveType type, final String input) {
+ public static ODataTimestamp getInstance(final EdmPrimitiveTypeKind type, final Timestamp timestamp) {
+ return new ODataTimestamp(new SimpleDateFormat(getPattern(type)),
+ new Date(timestamp.getTime()), timestamp.getNanos(), type == EdmPrimitiveTypeKind.DateTimeOffset);
+ }
+
+ public static ODataTimestamp parse(final EdmPrimitiveTypeKind type, final String input) {
final ODataTimestamp instance;
final String[] dateParts = input.split("\\.");
- final SimpleDateFormat sdf = new SimpleDateFormat(type.pattern());
- final boolean isOffset = type == ODataJClientEdmPrimitiveType.DateTimeOffset;
+ final SimpleDateFormat sdf = new SimpleDateFormat(getPattern(type));
+ final boolean isOffset = type == EdmPrimitiveTypeKind.DateTimeOffset;
try {
final Date date = sdf.parse(dateParts[0]);
@@ -70,7 +79,7 @@ public final class ODataTimestamp implements Serializable {
instance = new ODataTimestamp(sdf, date, isOffset);
}
} catch (Exception e) {
- throw new IllegalArgumentException("Cannot parse " + type.pattern(), e);
+ throw new IllegalArgumentException("Cannot parse " + getPattern(type), e);
}
return instance;
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
index 53e0c0540..af0eba616 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
@@ -29,7 +29,6 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataValueFormat;
@@ -38,6 +37,7 @@ import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.utils.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
* This class implements an OData update entity property value request.
@@ -125,7 +125,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest extends ODataJacksonDeserializer {
- private final JSONGeoValueDeserializer geoDeserializer = new JSONGeoValueDeserializer();
+ private JSONGeoValueDeserializer geoDeserializer;
- protected ODataJClientEdmPrimitiveType getPrimitiveType(final JsonNode node) {
- ODataJClientEdmPrimitiveType result = ODataJClientEdmPrimitiveType.String;
+ private JSONGeoValueDeserializer getGeoDeserializer() {
+ if (geoDeserializer == null) {
+ geoDeserializer = new JSONGeoValueDeserializer(client.getServiceVersion());
+ }
+ return geoDeserializer;
+ }
+
+ protected EdmPrimitiveTypeKind getPrimitiveType(final JsonNode node) {
+ EdmPrimitiveTypeKind result = EdmPrimitiveTypeKind.String;
if (node.isIntegralNumber()) {
- result = ODataJClientEdmPrimitiveType.Int32;
+ result = EdmPrimitiveTypeKind.Int32;
} else if (node.isBoolean()) {
- result = ODataJClientEdmPrimitiveType.Boolean;
+ result = EdmPrimitiveTypeKind.Boolean;
} else if (node.isFloatingPointNumber()) {
- result = ODataJClientEdmPrimitiveType.Double;
+ result = EdmPrimitiveTypeKind.Double;
}
return result;
@@ -65,16 +72,14 @@ abstract class AbstractJsonDeserializer extends ODataJacksonDeserializer {
return type;
}
- private Value fromPrimitive(final JsonNode node, final ODataJClientEdmType typeInfo) {
+ private Value fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) {
Value value = null;
if (node.isNull()) {
value = new NullValueImpl();
} else {
- if (typeInfo != null && typeInfo.isGeospatialType()) {
- final ODataJClientEdmPrimitiveType geoType = ODataJClientEdmPrimitiveType.fromValue(typeInfo.getBaseType());
-
- value = new GeospatialValueImpl(this.geoDeserializer.deserialize(node, geoType));
+ if (typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+ value = new GeospatialValueImpl(getGeoDeserializer().deserialize(node, typeInfo));
} else {
value = new PrimitiveValueImpl(node.asText());
}
@@ -106,12 +111,12 @@ abstract class AbstractJsonDeserializer extends ODataJacksonDeserializer {
return value;
}
- private CollectionValue fromCollection(final Iterator nodeItor, final ODataJClientEdmType typeInfo) {
+ private CollectionValue fromCollection(final Iterator nodeItor, final EdmTypeInfo typeInfo) {
final CollectionValueImpl value = new CollectionValueImpl();
- final ODataJClientEdmType type = typeInfo == null
+ final EdmTypeInfo type = typeInfo == null
? null
- : new ODataJClientEdmType(typeInfo.getBaseType());
+ : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
while (nodeItor.hasNext()) {
final JsonNode child = nodeItor.next();
@@ -130,9 +135,9 @@ abstract class AbstractJsonDeserializer extends ODataJacksonDeserializer {
}
protected void value(final JSONPropertyImpl property, final JsonNode node) {
- final ODataJClientEdmType typeInfo = StringUtils.isBlank(property.getType())
+ final EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
? null
- : new ODataJClientEdmType(property.getType());
+ : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
final ODataPropertyType propType = typeInfo == null
? guessPropertyType(node)
@@ -157,7 +162,7 @@ abstract class AbstractJsonDeserializer extends ODataJacksonDeserializer {
case PRIMITIVE:
if (property.getType() == null) {
- property.setType(getPrimitiveType(node).toString());
+ property.setType(getPrimitiveType(node).getFullQualifiedName().toString());
}
property.setValue(fromPrimitive(node, typeInfo));
break;
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
index 3398ed95b..742784538 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractJsonSerializer.java
@@ -26,15 +26,15 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.apache.olingo.client.api.data.CollectionValue;
import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.ODataJClientEdmType;
+import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
abstract class AbstractJsonSerializer extends ODataJacksonSerializer {
- private static final ODataJClientEdmPrimitiveType[] NUMBER_TYPES = {
- ODataJClientEdmPrimitiveType.Byte, ODataJClientEdmPrimitiveType.SByte,
- ODataJClientEdmPrimitiveType.Single, ODataJClientEdmPrimitiveType.Double,
- ODataJClientEdmPrimitiveType.Int16, ODataJClientEdmPrimitiveType.Int32, ODataJClientEdmPrimitiveType.Int64
+ private static final EdmPrimitiveTypeKind[] NUMBER_TYPES = {
+ EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte,
+ EdmPrimitiveTypeKind.Single, EdmPrimitiveTypeKind.Double,
+ EdmPrimitiveTypeKind.Int16, EdmPrimitiveTypeKind.Int32, EdmPrimitiveTypeKind.Int64
};
private final JSONGeoValueSerializer geoSerializer = new JSONGeoValueSerializer();
@@ -50,20 +50,20 @@ abstract class AbstractJsonSerializer extends ODataJacksonSerializer {
}
private void value(final JsonGenerator jgen, final String type, final Value value) throws IOException {
- final ODataJClientEdmType typeInfo = type == null
+ final EdmTypeInfo typeInfo = type == null
? null
- : new ODataJClientEdmType(type);
+ : new EdmTypeInfo.Builder().setTypeExpression(type).build();
if (value.isNull()) {
jgen.writeNull();
} else if (value.isSimple()) {
final boolean isNumber = typeInfo == null
? NumberUtils.isNumber(value.asSimple().get())
- : ArrayUtils.contains(NUMBER_TYPES, typeInfo.getPrimitiveType());
+ : ArrayUtils.contains(NUMBER_TYPES, typeInfo.getPrimitiveTypeKind());
final boolean isBoolean = typeInfo == null
? (value.asSimple().get().equalsIgnoreCase(Boolean.TRUE.toString())
|| value.asSimple().get().equalsIgnoreCase(Boolean.FALSE.toString()))
- : typeInfo.getPrimitiveType() == ODataJClientEdmPrimitiveType.Boolean;
+ : typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Boolean;
if (isNumber) {
jgen.writeNumber(value.asSimple().get());
@@ -77,7 +77,7 @@ abstract class AbstractJsonSerializer extends ODataJacksonSerializer {
geoSerializer.serialize(jgen, value.asGeospatial().get());
jgen.writeEndObject();
} else if (value.isCollection()) {
- collection(jgen, typeInfo == null ? null : typeInfo.getBaseType(), value.asCollection());
+ collection(jgen, typeInfo == null ? null : typeInfo.getFullQualifiedName().toString(), value.asCollection());
} else if (value.isComplex()) {
jgen.writeStartObject();
for (Property property : value.asComplex().get()) {
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
index e733d2a44..20dd1646a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueDeserializer.java
@@ -28,20 +28,21 @@ import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
+import org.apache.olingo.client.api.data.GeoUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
class AtomGeoValueDeserializer {
private List points(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
final List result = new ArrayList();
@@ -67,7 +68,7 @@ class AtomGeoValueDeserializer {
}
private MultiPoint multipoint(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
List points = Collections.emptyList();
@@ -88,13 +89,13 @@ class AtomGeoValueDeserializer {
}
private LineString lineString(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
return new LineString(GeoUtils.getDimension(type), crs, points(reader, start, type, null));
}
private Polygon polygon(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
List extPoints = null;
List intPoints = null;
@@ -121,7 +122,7 @@ class AtomGeoValueDeserializer {
}
private MultiLineString multiLineString(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
final List lineStrings = new ArrayList();
@@ -142,7 +143,7 @@ class AtomGeoValueDeserializer {
}
private MultiPolygon multiPolygon(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
final List polygons = new ArrayList();
@@ -163,7 +164,7 @@ class AtomGeoValueDeserializer {
}
private GeospatialCollection collection(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
final List geospatials = new ArrayList();
@@ -196,7 +197,7 @@ class AtomGeoValueDeserializer {
}
public Geospatial deserialize(final XMLEventReader reader, final StartElement start,
- final ODataJClientEdmPrimitiveType type) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type) throws XMLStreamException {
String crs = null;
final Attribute srsName = start.getAttributeByName(Constants.QNAME_ATTR_SRSNAME);
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
index 409ff994b..2d69ef787 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomGeoValueSerializer.java
@@ -25,14 +25,14 @@ import java.util.Iterator;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
class AtomGeoValueSerializer {
@@ -126,7 +126,7 @@ class AtomGeoValueSerializer {
}
public void serialize(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
- switch (value.getEdmSimpleType()) {
+ switch (value.getEdmPrimitiveTypeKind()) {
case GeographyPoint:
case GeometryPoint:
writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINT, Constants.NS_GML);
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
index 9a24e38d3..00e6ac7e9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AtomPropertyDeserializer.java
@@ -28,9 +28,9 @@ import org.apache.olingo.client.api.Constants;
import org.apache.olingo.client.api.data.CollectionValue;
import org.apache.olingo.client.api.data.ComplexValue;
import org.apache.olingo.client.api.data.Value;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataJClientEdmType;
import org.apache.olingo.client.api.domain.ODataPropertyType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
class AtomPropertyDeserializer extends AbstractAtomDealer {
@@ -53,7 +53,7 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
if (event.isStartElement()) {
if (typeInfo != null && typeInfo.isGeospatialType()) {
- final ODataJClientEdmPrimitiveType geoType = ODataJClientEdmPrimitiveType.fromValue(typeInfo.getBaseType());
+ final EdmPrimitiveTypeKind geoType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getBaseType());
value = new GeospatialValueImpl(this.geoDeserializer.deserialize(reader, event.asStartElement(), geoType));
}
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeoUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeoUtils.java
deleted file mode 100644
index e0574be0a..000000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeoUtils.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-
-public final class GeoUtils {
-
- private GeoUtils() {
- // Empty private constructor for static utility classes
- }
-
- public static Geospatial.Dimension getDimension(final ODataJClientEdmPrimitiveType type) {
- Geospatial.Dimension dimension;
-
- switch (type) {
- case Geography:
- case GeographyCollection:
- case GeographyLineString:
- case GeographyMultiLineString:
- case GeographyPoint:
- case GeographyMultiPoint:
- case GeographyPolygon:
- case GeographyMultiPolygon:
- dimension = Geospatial.Dimension.GEOGRAPHY;
- break;
-
- default:
- dimension = Geospatial.Dimension.GEOMETRY;
- }
-
- return dimension;
- }
-
- public static ODataJClientEdmPrimitiveType getType(final Geospatial.Dimension dimension, final String elementName) {
- ODataJClientEdmPrimitiveType type = null;
-
- if (Constants.ELEM_POINT.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPoint
- : ODataJClientEdmPrimitiveType.GeometryPoint;
- } else if (Constants.ELEM_MULTIPOINT.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPoint
- : ODataJClientEdmPrimitiveType.GeometryMultiPoint;
- } else if (Constants.ELEM_LINESTRING.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyLineString
- : ODataJClientEdmPrimitiveType.GeometryLineString;
- } else if (Constants.ELEM_MULTILINESTRING.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiLineString
- : ODataJClientEdmPrimitiveType.GeometryMultiLineString;
- } else if (Constants.ELEM_POLYGON.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPolygon
- : ODataJClientEdmPrimitiveType.GeometryPolygon;
- } else if (Constants.ELEM_MULTIPOLYGON.equals(elementName)) {
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPolygon
- : ODataJClientEdmPrimitiveType.GeometryMultiPolygon;
- } else if (Constants.ELEM_GEOCOLLECTION.equals(elementName)
- || Constants.ELEM_GEOMEMBERS.equals(elementName)) {
-
- type = dimension == Geospatial.Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyCollection
- : ODataJClientEdmPrimitiveType.GeometryCollection;
- }
-
- return type;
- }
-}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
index 040b4f8c4..fdb0f445d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/GeospatialValueImpl.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core.data;
import org.apache.olingo.client.api.data.GeospatialValue;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
public class GeospatialValueImpl extends AbstractValue implements GeospatialValue {
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
index 1e92babb4..eebfef3bb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
@@ -24,19 +24,28 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
+import org.apache.olingo.client.api.data.GeoUtils;
+import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
class JSONGeoValueDeserializer {
- private Point point(final Iterator itor, final ODataJClientEdmPrimitiveType type, final String crs) {
+ private final ODataServiceVersion version;
+
+ public JSONGeoValueDeserializer(final ODataServiceVersion version) {
+ this.version = version;
+ }
+
+ private Point point(final Iterator itor, final EdmPrimitiveTypeKind type, final String crs) {
Point point = null;
if (itor.hasNext()) {
@@ -48,7 +57,7 @@ class JSONGeoValueDeserializer {
return point;
}
- private MultiPoint multipoint(final Iterator itor, final ODataJClientEdmPrimitiveType type,
+ private MultiPoint multipoint(final Iterator itor, final EdmPrimitiveTypeKind type,
final String crs) {
MultiPoint multiPoint = null;
@@ -67,7 +76,7 @@ class JSONGeoValueDeserializer {
return multiPoint;
}
- private LineString lineString(final Iterator itor, final ODataJClientEdmPrimitiveType type,
+ private LineString lineString(final Iterator itor, final EdmPrimitiveTypeKind type,
final String crs) {
LineString lineString = null;
@@ -86,7 +95,7 @@ class JSONGeoValueDeserializer {
return lineString;
}
- private MultiLineString multiLineString(final Iterator itor, final ODataJClientEdmPrimitiveType type,
+ private MultiLineString multiLineString(final Iterator itor, final EdmPrimitiveTypeKind type,
final String crs) {
MultiLineString multiLineString = null;
@@ -105,7 +114,7 @@ class JSONGeoValueDeserializer {
return multiLineString;
}
- private Polygon polygon(final Iterator itor, final ODataJClientEdmPrimitiveType type,
+ private Polygon polygon(final Iterator itor, final EdmPrimitiveTypeKind type,
final String crs) {
List extPoints = null;
@@ -135,7 +144,7 @@ class JSONGeoValueDeserializer {
return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints);
}
- private MultiPolygon multiPolygon(final Iterator itor, final ODataJClientEdmPrimitiveType type,
+ private MultiPolygon multiPolygon(final Iterator itor, final EdmPrimitiveTypeKind type,
final String crs) {
MultiPolygon multiPolygon = null;
@@ -154,7 +163,7 @@ class JSONGeoValueDeserializer {
return multiPolygon;
}
- private GeospatialCollection collection(final Iterator itor, final ODataJClientEdmPrimitiveType type,
+ private GeospatialCollection collection(final Iterator itor, final EdmPrimitiveTypeKind type,
final String crs) {
GeospatialCollection collection = null;
@@ -166,16 +175,16 @@ class JSONGeoValueDeserializer {
final JsonNode geo = itor.next();
final String collItemType = geo.get(Constants.ATTR_TYPE).asText();
final String callAsType;
- if (ODataJClientEdmPrimitiveType.GeographyCollection.name().equals(collItemType)
- || ODataJClientEdmPrimitiveType.GeometryCollection.name().equals(collItemType)) {
+ if (EdmPrimitiveTypeKind.GeographyCollection.name().equals(collItemType)
+ || EdmPrimitiveTypeKind.GeometryCollection.name().equals(collItemType)) {
callAsType = collItemType;
} else {
- callAsType = (type == ODataJClientEdmPrimitiveType.GeographyCollection ? "Geography" : "Geometry")
+ callAsType = (type == EdmPrimitiveTypeKind.GeographyCollection ? "Geography" : "Geometry")
+ collItemType;
}
- geospatials.add(deserialize(geo, ODataJClientEdmPrimitiveType.valueOf(callAsType)));
+ geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build()));
}
collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials);
@@ -186,9 +195,10 @@ class JSONGeoValueDeserializer {
return collection;
}
- public Geospatial deserialize(final JsonNode node, final ODataJClientEdmPrimitiveType type) {
- final ODataJClientEdmPrimitiveType actualType;
- if ((type == ODataJClientEdmPrimitiveType.Geography || type == ODataJClientEdmPrimitiveType.Geometry)
+ public Geospatial deserialize(final JsonNode node, final EdmTypeInfo typeInfo) {
+ final EdmPrimitiveTypeKind actualType;
+ if ((typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geography
+ || typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geometry)
&& node.has(Constants.ATTR_TYPE)) {
String nodeType = node.get(Constants.ATTR_TYPE).asText();
@@ -196,9 +206,9 @@ class JSONGeoValueDeserializer {
final int yIdx = nodeType.indexOf('y');
nodeType = nodeType.substring(yIdx + 1);
}
- actualType = ODataJClientEdmPrimitiveType.fromValue(type.toString() + nodeType);
+ actualType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getFullQualifiedName().toString() + nodeType);
} else {
- actualType = type;
+ actualType = typeInfo.getPrimitiveTypeKind();
}
final Iterator cooItor = node.has(Constants.JSON_COORDINATES)
@@ -214,37 +224,37 @@ class JSONGeoValueDeserializer {
switch (actualType) {
case GeographyPoint:
case GeometryPoint:
- value = point(cooItor, type, crs);
+ value = point(cooItor, actualType, crs);
break;
case GeographyMultiPoint:
case GeometryMultiPoint:
- value = multipoint(cooItor, type, crs);
+ value = multipoint(cooItor, actualType, crs);
break;
case GeographyLineString:
case GeometryLineString:
- value = lineString(cooItor, type, crs);
+ value = lineString(cooItor, actualType, crs);
break;
case GeographyMultiLineString:
case GeometryMultiLineString:
- value = multiLineString(cooItor, type, crs);
+ value = multiLineString(cooItor, actualType, crs);
break;
case GeographyPolygon:
case GeometryPolygon:
- value = polygon(cooItor, type, crs);
+ value = polygon(cooItor, actualType, crs);
break;
case GeographyMultiPolygon:
case GeometryMultiPolygon:
- value = multiPolygon(cooItor, type, crs);
+ value = multiPolygon(cooItor, actualType, crs);
break;
case GeographyCollection:
case GeometryCollection:
- value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), type, crs);
+ value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, crs);
break;
default:
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
index 207ded63c..2e692ae06 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
@@ -22,16 +22,16 @@ import com.fasterxml.jackson.core.JsonGenerator;
import java.io.IOException;
import java.util.Iterator;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.ComposedGeospatial;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.ComposedGeospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
class JSONGeoValueSerializer {
@@ -106,17 +106,17 @@ class JSONGeoValueSerializer {
}
public void serialize(final JsonGenerator jgen, final Geospatial value) throws IOException {
- if (value.getEdmSimpleType().equals(ODataJClientEdmPrimitiveType.GeographyCollection)
- || value.getEdmSimpleType().equals(ODataJClientEdmPrimitiveType.GeometryCollection)) {
+ if (value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeographyCollection)
+ || value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) {
- jgen.writeStringField(Constants.ATTR_TYPE, ODataJClientEdmPrimitiveType.GeometryCollection.name());
+ jgen.writeStringField(Constants.ATTR_TYPE, EdmPrimitiveTypeKind.GeometryCollection.name());
} else {
- final int yIdx = value.getEdmSimpleType().name().indexOf('y');
- final String itemType = value.getEdmSimpleType().name().substring(yIdx + 1);
+ 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.getEdmSimpleType()) {
+ switch (value.getEdmPrimitiveTypeKind()) {
case GeographyPoint:
case GeometryPoint:
jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
index da6f0fd10..948a930c9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
@@ -56,15 +56,19 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
public class EdmClientImpl extends AbstractEdmImpl {
+ private final ODataServiceVersion version;
+
private final XMLMetadata xmlMetadata;
private final EdmServiceMetadata serviceMetadata;
- public EdmClientImpl(final XMLMetadata xmlMetadata) {
+ public EdmClientImpl(final ODataServiceVersion version, final XMLMetadata xmlMetadata) {
+ this.version = version;
this.xmlMetadata = xmlMetadata;
this.serviceMetadata = AbstractEdmServiceMetadataImpl.getInstance(xmlMetadata);
}
@@ -115,7 +119,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
if (schema != null) {
final EnumType xmlEnumType = schema.getEnumType(enumName.getName());
if (xmlEnumType != null) {
- result = new EdmEnumTypeImpl(this, enumName, xmlEnumType);
+ result = new EdmEnumTypeImpl(version, this, enumName, xmlEnumType);
}
}
@@ -131,7 +135,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
final TypeDefinition xmlTypeDefinition = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
getTypeDefinition(typeDefinitionName.getName());
if (xmlTypeDefinition != null) {
- result = new EdmTypeDefinitionImpl(this, typeDefinitionName, xmlTypeDefinition);
+ result = new EdmTypeDefinitionImpl(version, this, typeDefinitionName, xmlTypeDefinition);
}
} else {
throw new UnsupportedInV3Exception();
@@ -378,7 +382,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
protected List createSchemas() {
final List schemas = new ArrayList();
for (Schema schema : xmlMetadata.getSchemas()) {
- schemas.add(new EdmSchemaImpl(this, xmlMetadata, schema));
+ schemas.add(new EdmSchemaImpl(version, this, xmlMetadata, schema));
}
return schemas;
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
index 10a1b2e92..05cfa27be 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
@@ -27,7 +27,6 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.AbstractEdmEnumType;
import org.apache.olingo.commons.core.edm.EdmMemberImpl;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import java.util.ArrayList;
import java.util.Collection;
@@ -37,6 +36,9 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType {
@@ -54,14 +56,16 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType
private final Map members;
- public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName fqn, final EnumType xmlEnumType) {
+ public EdmEnumTypeImpl(final ODataServiceVersion version, final Edm edm, final FullQualifiedName fqn,
+ final EnumType xmlEnumType) {
+
super(edm, fqn, xmlEnumType.isFlags());
if (xmlEnumType.getUnderlyingType() == null) {
- this.underlyingType = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+ this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
} else {
- this.underlyingType = EdmPrimitiveTypeKind.valueOfFQN(xmlEnumType.getUnderlyingType()).
- getEdmPrimitiveTypeInstance();
+ this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ EdmPrimitiveTypeKind.valueOfFQN(version, xmlEnumType.getUnderlyingType()));
if (!ArrayUtils.contains(VALID_UNDERLYING_TYPES, this.underlyingType.getKind())) {
throw new EdmException("Not allowed as underlying type: " + this.underlyingType.getKind());
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
index 58c9496ab..ffe41cde4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
@@ -41,18 +41,25 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.edm.AbstractEdmSchemaImpl;
public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
+ private final ODataServiceVersion version;
+
private final Edm edm;
private final XMLMetadata xmlMetadata;
private final Schema schema;
- public EdmSchemaImpl(Edm edm, XMLMetadata xmlMetadata, Schema schema) {
+ public EdmSchemaImpl(final ODataServiceVersion version, final Edm edm,
+ final XMLMetadata xmlMetadata, final Schema schema) {
+
super(schema.getNamespace(), schema.getAlias());
+
+ this.version = version;
this.edm = edm;
this.xmlMetadata = xmlMetadata;
this.schema = schema;
@@ -77,7 +84,8 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).getTypeDefinitions();
if (providerTypeDefinitions != null) {
for (TypeDefinition def : providerTypeDefinitions) {
- typeDefinitions.add(new EdmTypeDefinitionImpl(edm, new FullQualifiedName("namespace", def.getName()), def));
+ typeDefinitions.add(
+ new EdmTypeDefinitionImpl(version, edm, new FullQualifiedName("namespace", def.getName()), def));
}
}
}
@@ -90,7 +98,8 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
final List providerEnumTypes = schema.getEnumTypes();
if (providerEnumTypes != null) {
for (EnumType enumType : providerEnumTypes) {
- enumTypes.add(new EdmEnumTypeImpl(edm, new FullQualifiedName(namespace, enumType.getName()), enumType));
+ enumTypes.add(
+ new EdmEnumTypeImpl(version, edm, new FullQualifiedName(namespace, enumType.getName()), enumType));
}
}
return enumTypes;
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
index cf2ad47e7..199d61e72 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
@@ -22,10 +22,12 @@ import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.edm.AbstractEdmTypeDefinition;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements EdmTypeDefinition {
@@ -33,14 +35,14 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
private EdmPrimitiveType edmPrimitiveTypeInstance;
- public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
- final TypeDefinition typeDefinition) {
+ public EdmTypeDefinitionImpl(final ODataServiceVersion version, final Edm edm,
+ final FullQualifiedName typeDefinitionName, final TypeDefinition typeDefinition) {
super(edm, typeDefinitionName);
this.typeDefinition = typeDefinition;
try {
- edmPrimitiveTypeInstance = EdmPrimitiveTypeKind.valueOfFQN(typeDefinition.getUnderlyingType()).
- getEdmPrimitiveTypeInstance();
+ this.edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ EdmPrimitiveTypeKind.valueOfFQN(version, typeDefinition.getUnderlyingType()));
} catch (IllegalArgumentException e) {
throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
index 3ed86dc0d..461e829a8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeInfo.java
@@ -18,15 +18,13 @@
*/
package org.apache.olingo.client.core.edm;
-import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,9 +70,7 @@ public class EdmTypeInfo {
private final FullQualifiedName fullQualifiedName;
- private EdmPrimitiveType primitiveType;
-
- private final boolean geospatialType;
+ private EdmPrimitiveTypeKind primitiveType;
private EdmEnumType enumType;
@@ -114,14 +110,10 @@ public class EdmTypeInfo {
this.fullQualifiedName = new FullQualifiedName(namespace, typeName);
try {
- this.primitiveType = EdmPrimitiveTypeKind.valueOf(this.fullQualifiedName.getName()).
- getEdmPrimitiveTypeInstance();
+ this.primitiveType = EdmPrimitiveTypeKind.valueOf(this.fullQualifiedName.getName());
} catch (IllegalArgumentException e) {
LOG.debug("{} does not appear to refer to an Edm primitive type", this.fullQualifiedName);
}
- // TODO - OLINGO-65 implement Geospatial types!
- this.geospatialType = this.fullQualifiedName.getNamespace().equals(EdmPrimitiveType.EDM_NAMESPACE)
- && this.fullQualifiedName.getName().startsWith("Geo");
if (this.primitiveType == null && this.edm != null) {
this.enumType = this.edm.getEnumType(this.fullQualifiedName);
if (this.enumType == null) {
@@ -146,21 +138,13 @@ public class EdmTypeInfo {
}
public boolean isPrimitiveType() {
- return this.primitiveType != null || isGeospatialType();
+ return this.primitiveType != null;
}
- public EdmPrimitiveType getPrimitiveType() {
+ public EdmPrimitiveTypeKind getPrimitiveTypeKind() {
return primitiveType;
}
- public boolean isGeospatialType() {
- return geospatialType;
- }
-
- public Object getGeospatialType() {
- throw new NotImplementedException("Geospatial types missing");
- }
-
public boolean isEnumType() {
return this.enumType != null;
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
index 69a278fad..b185d5da7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataBinder.java
@@ -38,7 +38,6 @@ import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataGeospatialValue;
import org.apache.olingo.client.api.domain.ODataInlineEntity;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataOperation;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
@@ -55,6 +54,7 @@ import org.apache.olingo.client.core.data.JSONPropertyImpl;
import org.apache.olingo.client.core.data.LinkImpl;
import org.apache.olingo.client.core.data.NullValueImpl;
import org.apache.olingo.client.core.data.PrimitiveValueImpl;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -378,14 +378,14 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
value = new ODataPrimitiveValue.Builder(client).setText(resource.getValue().asSimple().get()).
setType(resource.getType() == null
? null
- : ODataJClientEdmPrimitiveType.fromValue(resource.getType())).build();
+ : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
} else if (resource.getValue().isGeospatial()) {
value = new ODataGeospatialValue.Builder(client).setValue(resource.getValue().asGeospatial().get()).
setType(resource.getType() == null
- || ODataJClientEdmPrimitiveType.Geography.toString().equals(resource.getType())
- || ODataJClientEdmPrimitiveType.Geometry.toString().equals(resource.getType())
+ || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
+ || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().toString().equals(resource.getType())
? null
- : ODataJClientEdmPrimitiveType.fromValue(resource.getType())).build();
+ : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
} else if (resource.getValue().isComplex()) {
value = new ODataComplexValue(resource.getType());
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
index cfe08ecc3..596e8fdcd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractODataReader.java
@@ -26,7 +26,6 @@ import org.apache.olingo.client.api.data.Property;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.domain.ODataValue;
@@ -35,6 +34,7 @@ import org.apache.olingo.client.api.format.ODataFormat;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.format.ODataValueFormat;
import org.apache.olingo.client.api.op.CommonODataReader;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -91,7 +91,7 @@ public abstract class AbstractODataReader implements CommonODataReader {
} else if (ODataValue.class.isAssignableFrom(reference)) {
res = client.getPrimitiveValueBuilder().
setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT
- ? ODataJClientEdmPrimitiveType.String : ODataJClientEdmPrimitiveType.Stream).
+ ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(src)).
build();
} else if (XMLMetadata.class.isAssignableFrom(reference)) {
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
index 54e4ad0df..6649a3900 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
@@ -40,7 +40,7 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
@Override
public Edm readMetadata(final InputStream input) {
- return new EdmClientImpl(client.getDeserializer().toMetadata(input));
+ return new EdmClientImpl(client.getServiceVersion(), client.getDeserializer().toMetadata(input));
}
@Override
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
index 5a64d63e9..8324ccac4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
@@ -38,7 +38,7 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
@Override
public Edm readMetadata(final InputStream input) {
- return new EdmClientImpl(client.getDeserializer().toMetadata(input));
+ return new EdmClientImpl(client.getServiceVersion(), client.getDeserializer().toMetadata(input));
}
@Override
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
index a40da387e..5326602e6 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
@@ -32,22 +32,22 @@ import java.util.List;
import java.util.UUID;
import org.apache.commons.codec.binary.Base64;
import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataGeospatialValue;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataTimestamp;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial.Dimension;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
public abstract class AbstractPrimitiveTest extends AbstractTest {
@@ -66,13 +66,15 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected ODataPrimitiveValue writePrimitiveValue(final ODataPrimitiveValue value) {
final ODataPrimitiveValue newValue;
- if (ODataJClientEdmPrimitiveType.isGeospatial(value.getTypeName())) {
+ final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOfFQN(
+ getClient().getServiceVersion(), value.getTypeName());
+ if (typeKind.isGeospatial()) {
newValue = getClient().getGeospatialValueBuilder().
- setType(ODataJClientEdmPrimitiveType.fromValue(value.getTypeName())).
+ setType(EdmPrimitiveTypeKind.valueOfFQN(getVersion(), value.getTypeName())).
setValue(((ODataGeospatialValue) value).getGeospatial()).build();
} else {
newValue = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.fromValue(value.getTypeName())).
+ setType(EdmPrimitiveTypeKind.valueOfFQN(getClient().getServiceVersion(), value.getTypeName())).
setValue(value.toValue()).build();
}
@@ -95,7 +97,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final ODataPrimitiveValue value =
readPrimitiveValue(getClass().getResourceAsStream(getFilename(entity, propertyName)));
- if (ODataJClientEdmPrimitiveType.isGeospatial(value.getTypeName())) {
+ final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOfFQN(
+ getClient().getServiceVersion(), value.getTypeName());
+ if (typeKind.isGeospatial()) {
assertEquals(value.toValue(), writePrimitiveValue(value).toValue());
} else {
assertEquals(value.toString(), writePrimitiveValue(value).toString());
@@ -106,7 +110,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void int32(final String entity, final String propertyName, final int check) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.Int32.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Int32.toString(), opv.getTypeName());
final Integer value = opv.toCastValue();
assertNotNull(value);
@@ -115,7 +119,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void string(final String entity, final String propertyName, final String check) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.String.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.String.toString(), opv.getTypeName());
final String value = opv.toCastValue();
assertNotNull(value);
@@ -126,7 +130,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void decimal(final String entity, final String propertyName, final BigDecimal check) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.Decimal.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Decimal.toString(), opv.getTypeName());
final BigDecimal value = opv.toCastValue();
assertNotNull(value);
@@ -135,7 +139,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void datetime(final String entity, final String propertyName, final String check) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.DateTime.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.DateTime.toString(), opv.getTypeName());
final ODataTimestamp value = opv.toCastValue();
assertNotNull(value);
@@ -144,7 +148,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void guid(final String entity, final String propertyName, final String check) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.Guid.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Guid.toString(), opv.getTypeName());
final UUID value = opv.toCastValue();
assertNotNull(value);
@@ -153,7 +157,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void binary(final String entity, final String propertyName) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(ODataJClientEdmPrimitiveType.Binary.toString(), opv.getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Binary.toString(), opv.getTypeName());
final byte[] value = opv.toCastValue();
assertNotNull(value);
@@ -171,7 +175,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String entity,
final String propertyName,
final Point expectedValues,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -202,7 +206,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String entity,
final String propertyName,
final List check,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -219,7 +223,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String entity,
final String propertyName,
final List check,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -246,7 +250,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String entity,
final String propertyName,
final List> check,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -301,7 +305,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String propertyName,
final List checkInterior,
final List checkExterior,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -321,7 +325,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String propertyName,
final List> checkInterior,
final List> checkExterior,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -344,7 +348,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void geomCollection(
final String entity,
final String propertyName,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
@@ -373,7 +377,7 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
protected void geogCollection(
final String entity,
final String propertyName,
- final ODataJClientEdmPrimitiveType expectedType,
+ final EdmPrimitiveTypeKind expectedType,
final Dimension expectedDimension) {
final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
index 48e17e73a..e9b97f21e 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
@@ -27,13 +27,13 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataCollectionValue;
import org.apache.olingo.client.api.domain.ODataComplexValue;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.junit.Test;
@@ -52,7 +52,7 @@ public abstract class AbstractPropertyTest extends AbstractTest {
+ "Customer_-10_CustomerId_value.txt");
final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.String).
+ setType(EdmPrimitiveTypeKind.String).
setText(IOUtils.toString(input)).
build();
assertNotNull(value);
@@ -76,7 +76,8 @@ public abstract class AbstractPropertyTest extends AbstractTest {
} else {
// This is needed because type information gets lost with JSON serialization
final ODataPrimitiveValue typedValue = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.fromValue(property.getPrimitiveValue().getTypeName())).
+ setType(EdmPrimitiveTypeKind.valueOfFQN(
+ getClient().getServiceVersion(), property.getPrimitiveValue().getTypeName())).
setText(written.getPrimitiveValue().toString()).
build();
comparable = getClient().getObjectFactory().newPrimitiveProperty(written.getName(), typedValue);
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index 589affa10..e87b87730 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -58,7 +58,6 @@ import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataInlineEntity;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataValue;
@@ -68,6 +67,7 @@ import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.utils.URIUtils;
import org.apache.olingo.client.core.data.AtomEntryImpl;
import org.apache.olingo.client.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -214,7 +214,7 @@ public abstract class AbstractTestITCase {
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Information",
getClient().getPrimitiveValueBuilder().setText(sampleinfo).setType(
- ODataJClientEdmPrimitiveType.String).build()));
+ EdmPrimitiveTypeKind.String).build()));
return entity;
}
@@ -228,12 +228,12 @@ public abstract class AbstractTestITCase {
// add name attribute
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name",
getClient().getPrimitiveValueBuilder().setText(sampleName).setType(
- ODataJClientEdmPrimitiveType.String).build()));
+ EdmPrimitiveTypeKind.String).build()));
// add key attribute
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
getClient().getPrimitiveValueBuilder().setText(String.valueOf(id)).setType(
- ODataJClientEdmPrimitiveType.Int32).build()));
+ EdmPrimitiveTypeKind.Int32).build()));
// add BackupContactInfo attribute (collection)
final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
@@ -249,13 +249,13 @@ public abstract class AbstractTestITCase {
// add BackupContactInfo.ContactDetails.AlternativeNames attribute (collection)
final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
altNamesValue.add(getClient().getPrimitiveValueBuilder().
- setText("myname").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("myname").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
// add BackupContactInfo.ContactDetails.EmailBag attribute (collection)
final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
emailBagValue.add(getClient().getPrimitiveValueBuilder().
- setText("myname@mydomain.com").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("myname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(getClient().getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
// add BackupContactInfo.ContactDetails.ContactAlias attribute (complex)
@@ -266,7 +266,7 @@ public abstract class AbstractTestITCase {
// add BackupContactInfo.ContactDetails.ContactAlias.AlternativeNames attribute (collection)
final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
aliasAltNamesValue.add(getClient().getPrimitiveValueBuilder().
- setText("myAlternativeName").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
contactAliasValue.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
if (withInlineInfo) {
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 0d7bac2c2..465dc07e5 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -42,13 +42,13 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.NoContentException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Ignore;
import org.junit.Test;
@@ -288,10 +288,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(key).setType(ODataJClientEdmPrimitiveType.Int32)
+ client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32)
.build()));
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32)
+ client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32)
.build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
@@ -383,9 +383,9 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
ODataEntity order = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
order.addLink(client.getObjectFactory().newEntityNavigationLink(
"Customer", URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString())));
@@ -442,22 +442,22 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("MessageId",
client.getPrimitiveValueBuilder().setValue(1000).
- setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ setType(EdmPrimitiveTypeKind.Int32).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("FromUsername",
client.getPrimitiveValueBuilder().setValue("1").
- setType(ODataJClientEdmPrimitiveType.String).build()));
+ setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("ToUsername",
client.getPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
- setType(ODataJClientEdmPrimitiveType.String).build()));
+ setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Subject",
client.getPrimitiveValueBuilder().setValue("Test subject").
- setType(ODataJClientEdmPrimitiveType.String).build()));
+ setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Body",
client.getPrimitiveValueBuilder().setValue("Test body").
- setType(ODataJClientEdmPrimitiveType.String).build()));
+ setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
client.getPrimitiveValueBuilder().setValue(false).
- setType(ODataJClientEdmPrimitiveType.Boolean).build()));
+ setType(EdmPrimitiveTypeKind.Boolean).build()));
final CommonURIBuilder> builder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Message");
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index 77172267b..8399494e0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -32,8 +32,8 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateR
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
/**
@@ -184,7 +184,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
message.getProperties().remove(message.getProperty("IsRead"));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
client.getPrimitiveValueBuilder().setValue(!before).
- setType(ODataJClientEdmPrimitiveType.Boolean).build()));
+ setType(EdmPrimitiveTypeKind.Boolean).build()));
return client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, message);
}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index 6b23f142e..b8ce3b4fb 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -44,7 +44,6 @@ import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataInlineEntity;
import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
import org.apache.olingo.client.api.domain.ODataValue;
@@ -52,6 +51,7 @@ import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
@@ -209,9 +209,9 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(key).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32).build()));
orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(),
@@ -267,13 +267,13 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
// add name attribute
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Name",
- client.getPrimitiveValueBuilder().setText(name).setType(ODataJClientEdmPrimitiveType.String).build()));
+ client.getPrimitiveValueBuilder().setText(name).setType(EdmPrimitiveTypeKind.String).build()));
// add key attribute
if (id != 0) {
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
client.getPrimitiveValueBuilder().setText(String.valueOf(id)).
- setType(ODataJClientEdmPrimitiveType.Int32).build()));
+ setType(EdmPrimitiveTypeKind.Int32).build()));
}
final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
@@ -285,12 +285,12 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
altNamesValue.add(client.getPrimitiveValueBuilder().
- setText("My Alternative name").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("My Alternative name").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
emailBagValue.add(client.getPrimitiveValueBuilder().
- setText("altname@mydomain.com").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("altname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
final ODataComplexValue contactAliasValue = new ODataComplexValue(
@@ -299,17 +299,17 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
aliasAltNamesValue.add(client.getPrimitiveValueBuilder().
- setText("myAlternativeName").setType(ODataJClientEdmPrimitiveType.String).build());
+ setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
final ODataComplexValue homePhone = new ODataComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone");
homePhone.add(client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
client.getPrimitiveValueBuilder().setText("8437568356834568").
- setType(ODataJClientEdmPrimitiveType.String).build()));
+ setType(EdmPrimitiveTypeKind.String).build()));
homePhone.add(client.getObjectFactory().newPrimitiveProperty("Extension",
client.getPrimitiveValueBuilder().setText("124365426534621534423ttrf").
- setType(ODataJClientEdmPrimitiveType.String).
+ setType(EdmPrimitiveTypeKind.String).
build()));
contactDetails.add(client.getObjectFactory().newComplexProperty("HomePhone", homePhone));
@@ -372,7 +372,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
entity.setMediaEntity(true);
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Information",
- client.getPrimitiveValueBuilder().setText(info).setType(ODataJClientEdmPrimitiveType.String).build()));
+ client.getPrimitiveValueBuilder().setText(info).setType(EdmPrimitiveTypeKind.String).build()));
return entity;
}
// validate newly created entities
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index 7718317b8..c64d7bb2c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -30,19 +30,19 @@ import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.domain.ODataComplexValue;
import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
import org.junit.Ignore;
import org.junit.Test;
@@ -70,15 +70,15 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
private void read(final ODataPubFormat format) {
ODataEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f");
assertEquals(
- ODataJClientEdmPrimitiveType.Double.toString(),
+ EdmPrimitiveTypeKind.Double.toString(),
row.getProperty("Double").getPrimitiveValue().getTypeName());
assertEquals(
- ODataJClientEdmPrimitiveType.Guid.toString(),
+ EdmPrimitiveTypeKind.Guid.toString(),
row.getProperty("Id").getPrimitiveValue().getTypeName());
row = readRow(format, "672b8250-1e6e-4785-80cf-b94b572e42b3");
assertEquals(
- ODataJClientEdmPrimitiveType.Decimal.toString(),
+ EdmPrimitiveTypeKind.Decimal.toString(),
row.getProperty("Decimal").getPrimitiveValue().getTypeName());
}
@@ -99,50 +99,50 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
ODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Id",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Guid).setValue(guid).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).setValue(guid).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aString",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.String).setValue("string").
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).setValue("string").
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aBoolean",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Boolean).setValue(true).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Boolean).setValue(true).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLong",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Int64).setValue(15L).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int64).setValue(15L).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDouble",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Double).setValue(1.5D).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Double).setValue(1.5D).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aByte",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.SByte).setValue(Byte.MAX_VALUE).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDate",
- client.getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.DateTime).setValue(new Date()).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()).
build()));
final Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null);
point.setX(1.2);
point.setY(2.1);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPoint",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPoint).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(point).build()));
final List points = new ArrayList();
points.add(point);
points.add(point);
final MultiPoint multipoint = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPoint",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiPoint).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
setValue(multipoint).build()));
final LineString lineString = new LineString(Geospatial.Dimension.GEOMETRY, null, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLineString",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryLineString).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryLineString).
setValue(lineString).build()));
final List lineStrings = new ArrayList();
lineStrings.add(lineString);
lineStrings.add(lineString);
final MultiLineString multiLineString = new MultiLineString(Geospatial.Dimension.GEOGRAPHY, null, lineStrings);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiLineString",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiLineString).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
setValue(multiLineString).build()));
final Point otherPoint = new Point(Geospatial.Dimension.GEOGRAPHY, null);
otherPoint.setX(3.4);
@@ -152,14 +152,14 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
points.add(point);
final Polygon polygon = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, points, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPolygon",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPolygon).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
setValue(polygon).build()));
final List polygons = new ArrayList();
polygons.add(polygon);
polygons.add(polygon);
final MultiPolygon multiPolygon = new MultiPolygon(Geospatial.Dimension.GEOGRAPHY, null, polygons);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPolygon",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyMultiPolygon).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
setValue(multiPolygon).build()));
final List geospatials = new ArrayList();
geospatials.add(otherPoint);
@@ -168,47 +168,47 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
geospatials.add(multiPolygon);
final GeospatialCollection geoColl = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, geospatials);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aCollection",
- client.getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyCollection).
+ client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(geoColl).build()));
final ODataComplexValue contactDetails =
new ODataComplexValue("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails");
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("FirstContacted",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Binary).setValue("text".getBytes()).build()));
+ setType(EdmPrimitiveTypeKind.Binary).setValue("text".getBytes()).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("LastContacted",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.DateTimeOffset).setText("2001-04-05T05:05:05.001+00:01").build()));
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setText("2001-04-05T05:05:05.001+00:01").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Contacted",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.DateTime).setText("2001-04-05T05:05:04.001").build()));
+ setType(EdmPrimitiveTypeKind.DateTime).setText("2001-04-05T05:05:04.001").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("GUID",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Guid).setValue(UUID.randomUUID()).build()));
+ setType(EdmPrimitiveTypeKind.Guid).setValue(UUID.randomUUID()).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("PreferedContactTime",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Time).setText("-P9DT51M10.5063807S").build()));
+ setType(EdmPrimitiveTypeKind.Time).setText("-P9DT51M10.5063807S").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Byte",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Byte).setValue(Integer.valueOf(241)).build()));
+ setType(EdmPrimitiveTypeKind.Byte).setValue(Integer.valueOf(241)).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("SignedByte",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.SByte).setValue(Byte.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Double",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Double).setValue(Double.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.Double).setValue(Double.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Single",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Single).setValue(Float.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.Single).setValue(Float.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Short",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Int16).setValue(Short.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.Int16).setValue(Short.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Int",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Int32).setValue(Integer.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.Int32).setValue(Integer.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Long",
client.getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Int64).setValue(Long.MAX_VALUE).build()));
+ setType(EdmPrimitiveTypeKind.Int64).setValue(Long.MAX_VALUE).build()));
row.getProperties().add(client.getObjectFactory().newComplexProperty("aContact", contactDetails));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().
@@ -220,37 +220,37 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
row = readRow(format, guid.toString());
assertNotNull(row);
- assertEquals(ODataJClientEdmPrimitiveType.Guid.toString(),
+ assertEquals(EdmPrimitiveTypeKind.Guid.toString(),
row.getProperty("Id").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.String.toString(),
+ assertEquals(EdmPrimitiveTypeKind.String.toString(),
row.getProperty("aString").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.Boolean.toString(),
+ assertEquals(EdmPrimitiveTypeKind.Boolean.toString(),
row.getProperty("aBoolean").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.Int64.toString(),
+ assertEquals(EdmPrimitiveTypeKind.Int64.toString(),
row.getProperty("aLong").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.Double.toString(),
+ assertEquals(EdmPrimitiveTypeKind.Double.toString(),
row.getProperty("aDouble").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.SByte.toString(),
+ assertEquals(EdmPrimitiveTypeKind.SByte.toString(),
row.getProperty("aByte").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.DateTime.toString(),
+ assertEquals(EdmPrimitiveTypeKind.DateTime.toString(),
row.getProperty("aDate").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeographyPoint.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyPoint.toString(),
row.getProperty("aPoint").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiPoint.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint.toString(),
row.getProperty("aMultiPoint").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeometryLineString.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeometryLineString.toString(),
row.getProperty("aLineString").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiLineString.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString.toString(),
row.getProperty("aMultiLineString").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeographyPolygon.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyPolygon.toString(),
row.getProperty("aPolygon").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeographyMultiPolygon.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyMultiPolygon.toString(),
row.getProperty("aMultiPolygon").getPrimitiveValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.GeographyCollection.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyCollection.toString(),
row.getProperty("aCollection").getPrimitiveValue().getTypeName());
assertEquals("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails",
row.getProperty("aContact").getComplexValue().getTypeName());
- assertEquals(ODataJClientEdmPrimitiveType.SByte.toString(),
+ assertEquals(EdmPrimitiveTypeKind.SByte.toString(),
row.getProperty("aContact").getComplexValue().get("SignedByte").getPrimitiveValue().getTypeName());
final ODataDeleteResponse deleteRes = client.getCUDRequestFactory().getDeleteRequest(row.getEditLink()).
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 8559d4ff1..903adf805 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -25,14 +25,14 @@ import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.domain.ODataEntity;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
import org.apache.olingo.client.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.client.core.op.impl.ResourceFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.junit.Test;
public class EntityTest extends AbstractTest {
@@ -89,7 +89,7 @@ public class EntityTest extends AbstractTest {
if ("GeogMultiLine".equals(property.getName())) {
found = true;
assertTrue(property.hasPrimitiveValue());
- assertEquals(ODataJClientEdmPrimitiveType.GeographyMultiLineString.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyMultiLineString.getFullQualifiedName().toString(),
property.getPrimitiveValue().getTypeName());
}
}
@@ -168,7 +168,7 @@ public class EntityTest extends AbstractTest {
assertNotNull(entity);
final ODataProperty geogCollection = entity.getProperty("GeogCollection");
- assertEquals(ODataJClientEdmPrimitiveType.GeographyCollection.toString(),
+ assertEquals(EdmPrimitiveTypeKind.GeographyCollection.getFullQualifiedName().toString(),
geogCollection.getPrimitiveValue().getTypeName());
int count = 0;
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
index fea25ca9b..5dca101b7 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
@@ -49,8 +49,9 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.junit.Test;
public class MetadataTest extends AbstractTest {
@@ -133,7 +134,7 @@ public class MetadataTest extends AbstractTest {
new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService", "ProductReview"));
assertNotNull(entity);
assertFalse(entity.getPropertyNames().isEmpty());
- assertEquals(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance(),
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32),
entity.getProperty("ProductId").getType());
assertFalse(entity.getKeyPropertyRefs().isEmpty());
@@ -150,7 +151,7 @@ public class MetadataTest extends AbstractTest {
for (EdmActionImportInfo info : metadata.getServiceMetadata().getActionImportInfos()) {
actionImports.add(info.getActionImportName());
}
- final Set expectedAI = new HashSet(Arrays.asList(new String[]{
+ final Set expectedAI = new HashSet(Arrays.asList(new String[] {
"ResetDataSource",
"IncreaseSalaries",
"Sack",
@@ -162,7 +163,7 @@ public class MetadataTest extends AbstractTest {
for (EdmFunctionImportInfo info : metadata.getServiceMetadata().getFunctionImportInfos()) {
functionImports.add(info.getFunctionImportName());
}
- final Set expectedFI = new HashSet(Arrays.asList(new String[]{
+ final Set expectedFI = new HashSet(Arrays.asList(new String[] {
"GetPrimitiveString",
"GetSpecificCustomer",
"GetCustomerCount",
@@ -177,7 +178,7 @@ public class MetadataTest extends AbstractTest {
final EdmFunctionImport getArgumentPlusOne = container.getFunctionImport("GetArgumentPlusOne");
assertNotNull(getArgumentPlusOne);
- assertEquals(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance(),
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32),
getArgumentPlusOne.getFunction(null).getReturnType().getType());
final EdmActionImport resetDataSource = container.getActionImport("ResetDataSource");
@@ -191,7 +192,7 @@ public class MetadataTest extends AbstractTest {
final EdmFunction getComputer = metadata.getFunction(
new FullQualifiedName(container.getNamespace(), "GetComputer"),
new FullQualifiedName(container.getNamespace(), computer.getName()),
- Boolean.FALSE, Arrays.asList(new String[]{"computer"}));
+ Boolean.FALSE, Arrays.asList(new String[] {"computer"}));
assertNotNull(getComputer);
assertEquals(computer, getComputer.getParameter("computer").getType());
assertEquals(computer, getComputer.getReturnType().getType());
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
index 641fafa10..c5e4aee4d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
@@ -29,21 +29,21 @@ import java.util.List;
import java.util.UUID;
import org.apache.commons.codec.binary.Base64;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataDuration;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataTimestamp;
import org.apache.olingo.client.api.domain.ODataValue;
-import org.apache.olingo.client.api.domain.geospatial.Geospatial;
-import org.apache.olingo.client.api.domain.geospatial.GeospatialCollection;
-import org.apache.olingo.client.api.domain.geospatial.LineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiLineString;
-import org.apache.olingo.client.api.domain.geospatial.MultiPoint;
-import org.apache.olingo.client.api.domain.geospatial.MultiPolygon;
-import org.apache.olingo.client.api.domain.geospatial.Point;
-import org.apache.olingo.client.api.domain.geospatial.Polygon;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
import org.junit.Test;
public class PrimitiveValueTest extends AbstractTest {
@@ -56,24 +56,24 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageInt32() {
final int primitive = -10;
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Int32).
+ ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Int32.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Int32.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
assertEquals(Integer.valueOf(primitive), value.asPrimitive().toCastValue());
- value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Int32).setText("9").build();
+ value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).setText("9").build();
assertEquals("9", value.asPrimitive().toCastValue().toString());
}
@Test
public void manageString() {
final String primitive = UUID.randomUUID().toString();
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.String).
+ ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.String.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
assertEquals(primitive, value.toString());
- value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.String).
+ value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().toCastValue().toString());
}
@@ -81,12 +81,12 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageDecimal() {
final BigDecimal primitive = new BigDecimal("-79228162514264337593543950335");
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Decimal).
+ ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Decimal.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Decimal.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
assertEquals(primitive, value.asPrimitive().toCastValue());
- value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Decimal).
+ value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
setText("-79228162514264337593543950335").build();
assertEquals("-79228162514264337593543950335", value.asPrimitive().toCastValue().toString());
}
@@ -97,15 +97,15 @@ public class PrimitiveValueTest extends AbstractTest {
final String primitive = "2013-01-10T06:27:51.1667673";
try {
new ODataPrimitiveValue.Builder(ODataClientFactory.getV4()).
- setType(ODataJClientEdmPrimitiveType.DateTime).setText(primitive).build();
+ setType(EdmPrimitiveTypeKind.DateTime).setText(primitive).build();
fail();
} catch (IllegalArgumentException iae) {
// ignore
}
final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.DateTime).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.DateTime).
setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.DateTime.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.DateTime.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
// performed cast to improve the check
assertEquals(primitive, value.asPrimitive().toCastValue().toString());
}
@@ -116,16 +116,16 @@ public class PrimitiveValueTest extends AbstractTest {
final String primitive = "-P9DT51M10.5063807S";
try {
new ODataPrimitiveValue.Builder(ODataClientFactory.getV4()).
- setType(ODataJClientEdmPrimitiveType.Time).setText(primitive).build();
+ setType(EdmPrimitiveTypeKind.Time).setText(primitive).build();
fail();
} catch (IllegalArgumentException iae) {
// ignore
}
final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Time).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Time).
setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Time.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Time.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
// performed cast to improve the check
assertEquals(primitive, value.asPrimitive().toCastValue().toString());
}
@@ -134,8 +134,9 @@ public class PrimitiveValueTest extends AbstractTest {
public void manageDateTimeOffset() {
final String primitive = "2013-01-10T02:00:00";
final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.DateTimeOffset).setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.DateTimeOffset.toString(), value.asPrimitive().getTypeName());
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setText(primitive).build();
+ assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
// performed cast to improve the check
assertEquals(primitive, value.asPrimitive().toCastValue().toString());
}
@@ -143,12 +144,12 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageGuid() {
final UUID primitive = UUID.fromString("1126a28b-a4af-4bbd-bf0a-2b2c22635565");
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Guid).
+ ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Guid.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Guid.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
assertEquals(primitive, value.asPrimitive().toCastValue());
- value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Guid).
+ value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().toCastValue().toString());
}
@@ -156,14 +157,14 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageBinary() {
final byte[] primitive = UUID.randomUUID().toString().getBytes();
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Binary).
+ ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Binary.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.Binary.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
assertEquals(
Base64.encodeBase64String(primitive),
Base64.encodeBase64String(value.asPrimitive().toCastValue()));
- value = getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.Binary).
+ value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
setText(Base64.encodeBase64String("primitive".getBytes())).build();
assertEquals("primitive", new String(value.asPrimitive().toCastValue()));
}
@@ -175,7 +176,7 @@ public class PrimitiveValueTest extends AbstractTest {
primitive.setY(173.334);
try {
- getClient().getPrimitiveValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPoint).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(primitive).build();
fail();
} catch (IllegalArgumentException iae) {
@@ -183,10 +184,11 @@ public class PrimitiveValueTest extends AbstractTest {
}
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPoint).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(primitive).
build();
- assertEquals(ODataJClientEdmPrimitiveType.GeographyPoint.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeographyPoint.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
assertEquals(Double.valueOf(primitive.getX()), Double.valueOf(value.asPrimitive().toCastValue().getX()));
assertEquals(Double.valueOf(primitive.getY()), Double.valueOf(value.asPrimitive().toCastValue().getY()));
}
@@ -217,8 +219,9 @@ public class PrimitiveValueTest extends AbstractTest {
final LineString primitive = new LineString(Geospatial.Dimension.GEOGRAPHY, null, points);
final ODataValue value = getClient().getGeospatialValueBuilder().
- setType(ODataJClientEdmPrimitiveType.GeographyLineString).setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeographyLineString.toString(), value.asPrimitive().getTypeName());
+ setType(EdmPrimitiveTypeKind.GeographyLineString).setValue(primitive).build();
+ assertEquals(EdmPrimitiveTypeKind.GeographyLineString.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator iter = value.asPrimitive().toCastValue().iterator();
@@ -242,8 +245,9 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiPoint primitive = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
final ODataValue value = getClient().getGeospatialValueBuilder().
- setType(ODataJClientEdmPrimitiveType.GeometryMultiPoint).setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiPoint.toString(), value.asPrimitive().getTypeName());
+ setType(EdmPrimitiveTypeKind.GeometryMultiPoint).setValue(primitive).build();
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator iter = value.asPrimitive().toCastValue().iterator();
point = iter.next();
@@ -302,9 +306,10 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiLineString primitive = new MultiLineString(Geospatial.Dimension.GEOMETRY, null, lines);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiLineString).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiLineString.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator lineIter = value.asPrimitive().toCastValue().iterator();
@@ -355,9 +360,10 @@ public class PrimitiveValueTest extends AbstractTest {
final Polygon primitive = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, interior, exterior);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyPolygon).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeographyPolygon.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeographyPolygon.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
assertTrue(value.asPrimitive().toCastValue().getInterior().isEmpty());
final Iterator iter = value.asPrimitive().toCastValue().getExterior().iterator();
@@ -461,9 +467,10 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiPolygon primitive = new MultiPolygon(Geospatial.Dimension.GEOMETRY, null, polygons);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryMultiPolygon).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPolygon).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeometryMultiPolygon.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator iter = value.asPrimitive().toCastValue().iterator();
@@ -507,9 +514,10 @@ public class PrimitiveValueTest extends AbstractTest {
final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOMETRY, null, collection);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeometryCollection).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryCollection).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeometryCollection.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeometryCollection.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator iter = value.asPrimitive().toCastValue().iterator();
iter.next();
@@ -539,9 +547,10 @@ public class PrimitiveValueTest extends AbstractTest {
final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, collection);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(ODataJClientEdmPrimitiveType.GeographyCollection).
+ getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.GeographyCollection.toString(), value.asPrimitive().getTypeName());
+ assertEquals(EdmPrimitiveTypeKind.GeographyCollection.getFullQualifiedName().toString(),
+ value.asPrimitive().getTypeName());
final Iterator iter = value.asPrimitive().toCastValue().iterator();
iter.next();
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
index 3d74f7bf3..fd2a69694 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
@@ -27,6 +27,7 @@ import org.apache.olingo.client.core.edm.EdmEnumTypeImpl;
import org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import static org.junit.Assert.assertEquals;
@@ -49,7 +50,7 @@ public class FilterFactoryTest extends AbstractTest {
@Test
public void has() {
- final EdmEnumType pattern = new EdmEnumTypeImpl(
+ final EdmEnumType pattern = new EdmEnumTypeImpl(ODataServiceVersion.V40,
null, new FullQualifiedName("Sales", "Pattern"), new EnumTypeImpl());
final URIFilter filter = getFilterFactory().has(getFilterArgFactory().property("style"), pattern, "Yellow");
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
index afeba9252..fb2ba5ca7 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
@@ -50,9 +50,10 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.junit.Test;
public class MetadataTest extends AbstractTest {
@@ -82,7 +83,7 @@ public class MetadataTest extends AbstractTest {
assertNotNull(responseStatus);
assertTrue(responseStatus.getNavigationPropertyNames().isEmpty());
assertEquals("Recipient", responseStatus.getBaseType().getName());
- assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance(),
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset),
responseStatus.getProperty("Time").getType());
// 3. Entity
@@ -106,8 +107,8 @@ public class MetadataTest extends AbstractTest {
assertNotNull(move);
assertTrue(move.isBound());
assertEquals(2, move.getParameterNames().size());
- assertEquals(
- EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), move.getParameter("DestinationId").getType());
+ assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String),
+ move.getParameter("DestinationId").getType());
// 5. EntityContainer
final EdmEntityContainer container = edm.getEntityContainer(
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
index c146feef4..d72861dcf 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
@@ -22,13 +22,13 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
import org.apache.olingo.client.api.domain.ODataDuration;
import org.apache.olingo.client.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.domain.ODataTimestamp;
import org.apache.olingo.client.api.domain.ODataValue;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class PrimitiveValueTest extends AbstractTest {
@@ -44,15 +44,15 @@ public class PrimitiveValueTest extends AbstractTest {
final String primitive = "-P9DT51M12.5063807S";
try {
new ODataPrimitiveValue.Builder(ODataClientFactory.getV3()).
- setType(ODataJClientEdmPrimitiveType.TimeOfDay).setText(primitive).build();
+ setType(EdmPrimitiveTypeKind.TimeOfDay).setText(primitive).build();
fail();
} catch (IllegalArgumentException iae) {
// ignore
}
final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.TimeOfDay).setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.TimeOfDay.toString(), value.asPrimitive().getTypeName());
+ setType(EdmPrimitiveTypeKind.TimeOfDay).setText(primitive).build();
+ assertEquals(EdmPrimitiveTypeKind.TimeOfDay.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
// performed cast to improve the check
assertEquals(primitive, value.asPrimitive().toCastValue().toString());
}
@@ -63,15 +63,15 @@ public class PrimitiveValueTest extends AbstractTest {
final String primitive = "2013-01-10";
try {
new ODataPrimitiveValue.Builder(ODataClientFactory.getV3()).
- setType(ODataJClientEdmPrimitiveType.Date).setText(primitive).build();
+ setType(EdmPrimitiveTypeKind.Date).setText(primitive).build();
fail();
} catch (IllegalArgumentException iae) {
// ignore
}
final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(ODataJClientEdmPrimitiveType.Date).setText(primitive).build();
- assertEquals(ODataJClientEdmPrimitiveType.Date.toString(), value.asPrimitive().getTypeName());
+ setType(EdmPrimitiveTypeKind.Date).setText(primitive).build();
+ assertEquals(EdmPrimitiveTypeKind.Date.getFullQualifiedName().toString(), value.asPrimitive().getTypeName());
// performed cast to improve the check
assertEquals(primitive, value.asPrimitive().toCastValue().toString());
}
diff --git a/lib/commons-api/pom.xml b/lib/commons-api/pom.xml
index 42c42b429..e398eaa88 100644
--- a/lib/commons-api/pom.xml
+++ b/lib/commons-api/pom.xml
@@ -33,4 +33,12 @@
0.1.0-SNAPSHOT
..
+
+
+
+ org.apache.commons
+ commons-lang3
+
+
+
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java
new file mode 100644
index 000000000..898b6b284
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.edm;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+
+public interface EdmGeospatialType extends EdmType {
+
+ String EDM_NAMESPACE = EdmPrimitiveType.EDM_NAMESPACE;
+
+ /**
+ * Returns the Java type for this EDM geospatial type.
+ *
+ * @return the geospatial Java type
+ */
+ Class extends Geospatial> getJavaType();
+
+}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java
new file mode 100644
index 000000000..069d9e507
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.edm;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public enum EdmPrimitiveTypeKind {
+
+ Binary,
+ Boolean,
+ Byte,
+ SByte,
+ Date(new ODataServiceVersion[] {ODataServiceVersion.V40}),
+ DateTime(new ODataServiceVersion[] {ODataServiceVersion.V30}),
+ DateTimeOffset,
+ Time(new ODataServiceVersion[] {ODataServiceVersion.V30}),
+ TimeOfDay(new ODataServiceVersion[] {ODataServiceVersion.V40}),
+ Duration(new ODataServiceVersion[] {ODataServiceVersion.V40}),
+ Decimal,
+ Single,
+ Double,
+ Guid,
+ Int16,
+ Int32,
+ Int64,
+ String,
+ Stream,
+ Geography,
+ GeographyPoint,
+ GeographyLineString,
+ GeographyPolygon,
+ GeographyMultiPoint,
+ GeographyMultiLineString,
+ GeographyMultiPolygon,
+ GeographyCollection,
+ Geometry,
+ GeometryPoint,
+ GeometryLineString,
+ GeometryPolygon,
+ GeometryMultiPoint,
+ GeometryMultiLineString,
+ GeometryMultiPolygon,
+ GeometryCollection;
+
+ private final List versions;
+
+ EdmPrimitiveTypeKind() {
+ this.versions = Collections.unmodifiableList(
+ Arrays.asList(new ODataServiceVersion[] {ODataServiceVersion.V30, ODataServiceVersion.V40}));
+ }
+
+ EdmPrimitiveTypeKind(final ODataServiceVersion[] versions) {
+ this.versions = Collections.unmodifiableList(Arrays.asList(versions.clone()));
+ }
+
+ public List getSupportedVersions() {
+ return this.versions;
+ }
+
+ /**
+ * Checks if is a geospatial type.
+ *
+ * @return true if is geospatial type; false otherwise.
+ */
+ public boolean isGeospatial() {
+ return name().startsWith("Geo");
+ }
+
+ /**
+ * Returns the {@link FullQualifiedName} for this type kind.
+ *
+ * @return {@link FullQualifiedName}
+ */
+ public FullQualifiedName getFullQualifiedName() {
+ return new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, toString());
+ }
+
+ public static EdmPrimitiveTypeKind valueOf(final ODataServiceVersion version, final String name) {
+ final EdmPrimitiveTypeKind kind = valueOf(name);
+ if (!kind.versions.contains(version)) {
+ throw new IllegalArgumentException(kind + " not allowed in " + version);
+ }
+ return kind;
+ }
+
+ /**
+ * Gets EdmPrimitiveTypeKind from a full-qualified type name, for the given OData protocol version.
+ *
+ * @param version OData protocol version.
+ * @param fqn full-qualified type name.
+ * @return EdmPrimitiveTypeKind object.
+ */
+ public static EdmPrimitiveTypeKind valueOfFQN(final ODataServiceVersion version, final FullQualifiedName fqn) {
+ return valueOfFQN(version, fqn.toString());
+ }
+
+ /**
+ * Gets EdmPrimitiveTypeKind from a full type expression (as Edm.Int32), for the given OData
+ * protocol version.
+ *
+ * @param version OData protocol version.
+ * @param fqn string value type.
+ * @return EdmPrimitiveTypeKind object.
+ */
+ public static EdmPrimitiveTypeKind valueOfFQN(final ODataServiceVersion version, final String fqn) {
+ if (version == null) {
+ throw new IllegalArgumentException("No OData protocol version provided");
+ }
+ if (!fqn.startsWith(EdmPrimitiveType.EDM_NAMESPACE + ".")) {
+ throw new IllegalArgumentException(fqn + " does not look like an Edm primitive type");
+ }
+
+ final EdmPrimitiveTypeKind kind = valueOf(fqn.substring(4));
+ if (!kind.versions.contains(version)) {
+ throw new IllegalArgumentException(kind + " not allowed in " + version);
+ }
+ return kind;
+ }
+
+}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
similarity index 97%
rename from lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.java
rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
index 2ef65e87a..82a13fe80 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/ComposedGeospatial.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.olingo.client.api.domain.geospatial;
+package org.apache.olingo.commons.api.edm.geo;
import java.util.ArrayList;
import java.util.Iterator;
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
similarity index 94%
rename from lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java
rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
index 44e95584b..62de5ec3d 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Geospatial.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.olingo.client.api.domain.geospatial;
+package org.apache.olingo.commons.api.edm.geo;
import java.io.Serializable;
@@ -24,7 +24,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
* Base class for all geospatial info.
@@ -141,7 +141,7 @@ public abstract class Geospatial implements Serializable {
this.srid = srid;
}
- public abstract ODataJClientEdmPrimitiveType getEdmSimpleType();
+ public abstract EdmPrimitiveTypeKind getEdmPrimitiveTypeKind();
/**
* {@inheritDoc }
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java
similarity index 81%
rename from lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.java
rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java
index 64092121d..b3e3f9fd5 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/GeospatialCollection.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java
@@ -16,11 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.olingo.client.api.domain.geospatial;
+package org.apache.olingo.commons.api.edm.geo;
import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
* Wrapper for a collection of geospatials info.
@@ -41,9 +40,9 @@ public class GeospatialCollection extends ComposedGeospatial {
}
@Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyCollection
- : ODataJClientEdmPrimitiveType.GeometryCollection;
+ ? EdmPrimitiveTypeKind.GeographyCollection
+ : EdmPrimitiveTypeKind.GeometryCollection;
}
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
similarity index 78%
rename from lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java
rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
index 474b57829..297a96260 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/LineString.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
@@ -16,11 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.olingo.client.api.domain.geospatial;
+package org.apache.olingo.commons.api.edm.geo;
import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
public class LineString extends ComposedGeospatial {
@@ -31,9 +30,9 @@ public class LineString extends ComposedGeospatial {
}
@Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyLineString
- : ODataJClientEdmPrimitiveType.GeometryLineString;
+ ? EdmPrimitiveTypeKind.GeographyLineString
+ : EdmPrimitiveTypeKind.GeometryLineString;
}
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java
similarity index 78%
rename from lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java
rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java
index 3eb0466df..2f98d63fd 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiLineString.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java
@@ -16,11 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.olingo.client.api.domain.geospatial;
+package org.apache.olingo.commons.api.edm.geo;
import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
public class MultiLineString extends ComposedGeospatial {
@@ -31,9 +30,10 @@ public class MultiLineString extends ComposedGeospatial {
}
@Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiLineString
- : ODataJClientEdmPrimitiveType.GeometryMultiLineString;
+ ? EdmPrimitiveTypeKind.GeographyMultiLineString
+ : EdmPrimitiveTypeKind.GeometryMultiLineString;
}
+
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java
similarity index 78%
rename from lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java
rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java
index 8ea16b958..999f24bcb 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPoint.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java
@@ -16,11 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.olingo.client.api.domain.geospatial;
+package org.apache.olingo.commons.api.edm.geo;
import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
public class MultiPoint extends ComposedGeospatial {
@@ -31,9 +30,10 @@ public class MultiPoint extends ComposedGeospatial {
}
@Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPoint
- : ODataJClientEdmPrimitiveType.GeometryMultiPoint;
+ ? EdmPrimitiveTypeKind.GeographyMultiPoint
+ : EdmPrimitiveTypeKind.GeometryMultiPoint;
}
+
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
similarity index 78%
rename from lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java
rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
index ed55b922f..fd0fdae51 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/MultiPolygon.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
@@ -16,11 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.olingo.client.api.domain.geospatial;
+package org.apache.olingo.commons.api.edm.geo;
import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
public class MultiPolygon extends ComposedGeospatial {
@@ -31,9 +30,9 @@ public class MultiPolygon extends ComposedGeospatial {
}
@Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyMultiPolygon
- : ODataJClientEdmPrimitiveType.GeometryMultiPolygon;
+ ? EdmPrimitiveTypeKind.GeographyMultiPolygon
+ : EdmPrimitiveTypeKind.GeometryMultiPolygon;
}
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java
similarity index 85%
rename from lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java
rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java
index 63b91664e..a9e0c39e6 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Point.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.olingo.client.api.domain.geospatial;
+package org.apache.olingo.commons.api.edm.geo;
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
public class Point extends Geospatial {
@@ -69,9 +69,9 @@ public class Point extends Geospatial {
}
@Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPoint
- : ODataJClientEdmPrimitiveType.GeometryPoint;
+ ? EdmPrimitiveTypeKind.GeographyPoint
+ : EdmPrimitiveTypeKind.GeometryPoint;
}
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Polygon.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java
similarity index 85%
rename from lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Polygon.java
rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java
index 2aa1787cd..2501d4eae 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/geospatial/Polygon.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java
@@ -16,11 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.olingo.client.api.domain.geospatial;
+package org.apache.olingo.commons.api.edm.geo;
import java.util.List;
-
-import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
* Polygon.
@@ -66,9 +65,9 @@ public class Polygon extends Geospatial {
}
@Override
- public ODataJClientEdmPrimitiveType getEdmSimpleType() {
+ public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
return dimension == Dimension.GEOGRAPHY
- ? ODataJClientEdmPrimitiveType.GeographyPolygon
- : ODataJClientEdmPrimitiveType.GeometryPolygon;
+ ? EdmPrimitiveTypeKind.GeographyPolygon
+ : EdmPrimitiveTypeKind.GeometryPolygon;
}
}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
index b1d551bcc..09bd8ce0f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
@@ -23,9 +23,10 @@ import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmMapping;
import org.apache.olingo.commons.api.edm.EdmParameter;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
public abstract class AbstractEdmParameter extends EdmElementImpl implements EdmParameter {
@@ -43,7 +44,7 @@ public abstract class AbstractEdmParameter extends EdmElementImpl implements Edm
if (typeImpl == null) {
if (EdmPrimitiveType.EDM_NAMESPACE.equals(paramType.getNamespace())) {
try {
- typeImpl = EdmPrimitiveTypeKind.valueOf(paramType.getName()).getEdmPrimitiveTypeInstance();
+ typeImpl = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.valueOf(paramType.getName()));
} catch (IllegalArgumentException e) {
throw new EdmException("Cannot find type with name: " + paramType, e);
}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java
index 11e036562..c54239f89 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java
@@ -21,10 +21,11 @@ package org.apache.olingo.commons.core.edm;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
public abstract class AbstractEdmProperty extends EdmElementImpl implements EdmProperty {
@@ -47,7 +48,7 @@ public abstract class AbstractEdmProperty extends EdmElementImpl implements EdmP
final FullQualifiedName typeName = getTypeFQN();
if (isPrimitive()) {
try {
- propertyType = EdmPrimitiveTypeKind.valueOf(typeName.getName()).getEdmPrimitiveTypeInstance();
+ propertyType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.valueOf(typeName.getName()));
} catch (IllegalArgumentException e) {
throw new EdmException("Cannot find type with name: " + typeName, e);
}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java
index a6a6a8409..532f6666b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java
@@ -21,10 +21,11 @@ package org.apache.olingo.commons.core.edm;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmReturnType;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
public abstract class AbstractEdmReturnType implements EdmReturnType {
@@ -44,7 +45,7 @@ public abstract class AbstractEdmReturnType implements EdmReturnType {
if (typeImpl == null) {
if (EdmPrimitiveType.EDM_NAMESPACE.equals(typeName.getNamespace())) {
try {
- typeImpl = EdmPrimitiveTypeKind.valueOf(typeName.getName()).getEdmPrimitiveTypeInstance();
+ typeImpl = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.valueOf(typeName.getName()));
} catch (IllegalArgumentException e) {
throw new EdmException("Cannot find type with name: " + typeName, e);
}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java
new file mode 100644
index 000000000..8e5cb6ff5
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.EdmGeospatialType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+
+public abstract class AbstractEdmGeospatialType implements EdmGeospatialType {
+
+ private final Class reference;
+
+ protected final Dimension dimension;
+
+ protected final Type type;
+
+ protected AbstractEdmGeospatialType(final Class reference, final Dimension dimension, final Type type) {
+ this.reference = reference;
+ this.dimension = dimension;
+ this.type = type;
+ }
+
+ @Override
+ public Class extends Geospatial> getJavaType() {
+ return reference;
+ }
+
+ @Override
+ public String getNamespace() {
+ return EDM_NAMESPACE;
+ }
+
+ @Override
+ public String getName() {
+ return getClass().getSimpleName().substring(3);
+ }
+
+ @Override
+ public EdmTypeKind getKind() {
+ return EdmTypeKind.PRIMITIVE;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return this == obj || obj != null && getClass() == obj.getClass();
+ }
+
+ @Override
+ public int hashCode() {
+ return getClass().hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return new FullQualifiedName(getNamespace(), getName()).getFullQualifiedNameAsString();
+ }
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java
index 5f141c08f..9aa660e77 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDate.java
@@ -64,10 +64,11 @@ public final class EdmDate extends SingletonPrimitiveType {
try {
return EdmDateTimeOffset.convertDateTime(dateTimeValue, returnType);
} catch (final IllegalArgumentException e) {
- throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value), e");
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
} catch (final ClassCastException e) {
throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType), e");
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)", e);
}
}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
new file mode 100644
index 000000000..e06138851
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTime.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+
+/**
+ * Implementation of the EDM primitive type DateTime.
+ */
+public final class EdmDateTime extends SingletonPrimitiveType {
+
+ public static final ThreadLocal DATE_FORMAT = new ThreadLocal() {
+ @Override
+ protected SimpleDateFormat initialValue() {
+ return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+ }
+ };
+
+ private static final EdmDateTime INSTANCE = new EdmDateTime();
+
+ public static EdmDateTime getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public Class> getDefaultType() {
+ return Calendar.class;
+ }
+
+ @Override
+ protected T internalValueOfString(final String value,
+ final Boolean isNullable, final Integer maxLength, final Integer precision,
+ final Integer scale, final Boolean isUnicode, final Class returnType) throws EdmPrimitiveTypeException {
+
+ Calendar calendar = null;
+ Timestamp timestamp = null;
+
+ final String[] dateParts = value.split("\\.");
+ try {
+ final Date date = DATE_FORMAT.get().parse(dateParts[0]);
+ if (dateParts.length > 1) {
+ int idx = dateParts[1].indexOf('+');
+ if (idx == -1) {
+ idx = dateParts[1].indexOf('-');
+ }
+ if (idx == -1) {
+ calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ calendar.setTime(date);
+
+ timestamp = new Timestamp(calendar.getTimeInMillis());
+ timestamp.setNanos(Integer.parseInt(dateParts[1]));
+ } else {
+ calendar = Calendar.getInstance(TimeZone.getTimeZone(dateParts[1].substring(idx)));
+ calendar.setTime(date);
+
+ timestamp = new Timestamp(calendar.getTimeInMillis());
+ timestamp.setNanos(Integer.parseInt(dateParts[1].substring(0, idx)));
+ }
+ } else {
+ timestamp = new Timestamp(date.getTime());
+ }
+ } catch (Exception e) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
+ }
+
+ if (returnType.isAssignableFrom(Calendar.class)) {
+ return returnType.cast(calendar);
+ } else if (returnType.isAssignableFrom(Timestamp.class)) {
+ return returnType.cast(timestamp);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.LITERAL_UNCONVERTIBLE_TO_VALUE_TYPE.addContent(value, returnType)");
+ }
+ }
+
+ @Override
+ protected String internalValueToString(final T value,
+ final Boolean isNullable, final Integer maxLength, final Integer precision,
+ final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof Calendar) {
+ final Calendar calendar = (Calendar) value;
+
+ final StringBuilder formatted = new StringBuilder().append(DATE_FORMAT.get().format(calendar.getTime()));
+ formatted.append(calendar.getTimeZone());
+
+ return formatted.toString();
+ } else if (value instanceof Timestamp) {
+ final Timestamp timestamp = (Timestamp) value;
+
+ final StringBuilder formatted = new StringBuilder().append(DATE_FORMAT.get().format(timestamp));
+ if (timestamp.getNanos() > 0) {
+ formatted.append('.').append(String.valueOf(timestamp.getNanos()));
+ }
+
+ return formatted.toString();
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
+ }
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java
new file mode 100644
index 000000000..f5951cbc7
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+
+public final class EdmGeography extends AbstractEdmGeospatialType {
+
+ private static final EdmGeography INSTANCE = new EdmGeography();
+
+ public static EdmGeography getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeography() {
+ super(Geospatial.class, Dimension.GEOGRAPHY, null);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java
new file mode 100644
index 000000000..aab7210c9
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyCollection extends AbstractEdmGeospatialType {
+
+ private static final EdmGeographyCollection INSTANCE = new EdmGeographyCollection();
+
+ public static EdmGeographyCollection getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyCollection() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.GEOSPATIALCOLLECTION);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java
new file mode 100644
index 000000000..23c92cc20
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyLineString extends AbstractEdmGeospatialType {
+
+ private static final EdmGeographyLineString INSTANCE = new EdmGeographyLineString();
+
+ public static EdmGeographyLineString getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyLineString() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.LINESTRING);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java
new file mode 100644
index 000000000..9b5901df4
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyMultiLineString extends AbstractEdmGeospatialType {
+
+ private static final EdmGeographyMultiLineString INSTANCE = new EdmGeographyMultiLineString();
+
+ public static EdmGeographyMultiLineString getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyMultiLineString() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.MULTILINESTRING);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
new file mode 100644
index 000000000..db6604188
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyMultiPoint extends AbstractEdmGeospatialType {
+
+ private static final EdmGeographyMultiPoint INSTANCE = new EdmGeographyMultiPoint();
+
+ public static EdmGeographyMultiPoint getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyMultiPoint() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.MULTIPOINT);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java
new file mode 100644
index 000000000..4b53a30a2
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyMultiPolygon extends AbstractEdmGeospatialType {
+
+ private static final EdmGeographyMultiPolygon INSTANCE = new EdmGeographyMultiPolygon();
+
+ public static EdmGeographyMultiPolygon getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyMultiPolygon() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.MULTIPOLYGON);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java
new file mode 100644
index 000000000..61abce333
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyPoint extends AbstractEdmGeospatialType {
+
+ private static final EdmGeographyPoint INSTANCE = new EdmGeographyPoint();
+
+ public static EdmGeographyPoint getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyPoint() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.POINT);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java
new file mode 100644
index 000000000..a7a1a6cd0
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeographyPolygon extends AbstractEdmGeospatialType {
+
+ private static final EdmGeographyPolygon INSTANCE = new EdmGeographyPolygon();
+
+ public static EdmGeographyPolygon getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeographyPolygon() {
+ super(Point.class, Dimension.GEOGRAPHY, Type.POLYGON);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java
new file mode 100644
index 000000000..2f16e24c2
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+
+public final class EdmGeometry extends AbstractEdmGeospatialType {
+
+ private static final EdmGeometry INSTANCE = new EdmGeometry();
+
+ public static EdmGeometry getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometry() {
+ super(Geospatial.class, Dimension.GEOMETRY, null);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
new file mode 100644
index 000000000..12c6c01d1
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryCollection extends AbstractEdmGeospatialType {
+
+ private static final EdmGeometryCollection INSTANCE = new EdmGeometryCollection();
+
+ public static EdmGeometryCollection getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryCollection() {
+ super(Point.class, Dimension.GEOMETRY, Type.GEOSPATIALCOLLECTION);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java
new file mode 100644
index 000000000..db8cfb004
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryLineString extends AbstractEdmGeospatialType {
+
+ private static final EdmGeometryLineString INSTANCE = new EdmGeometryLineString();
+
+ public static EdmGeometryLineString getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryLineString() {
+ super(Point.class, Dimension.GEOMETRY, Type.LINESTRING);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java
new file mode 100644
index 000000000..7bf89e6c7
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryMultiLineString extends AbstractEdmGeospatialType {
+
+ private static final EdmGeometryMultiLineString INSTANCE = new EdmGeometryMultiLineString();
+
+ public static EdmGeometryMultiLineString getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryMultiLineString() {
+ super(Point.class, Dimension.GEOMETRY, Type.MULTILINESTRING);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java
new file mode 100644
index 000000000..9311d8de8
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryMultiPoint extends AbstractEdmGeospatialType {
+
+ private static final EdmGeometryMultiPoint INSTANCE = new EdmGeometryMultiPoint();
+
+ public static EdmGeometryMultiPoint getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryMultiPoint() {
+ super(Point.class, Dimension.GEOMETRY, Type.MULTIPOINT);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java
new file mode 100644
index 000000000..f64ed8705
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryMultiPolygon extends AbstractEdmGeospatialType {
+
+ private static final EdmGeometryMultiPolygon INSTANCE = new EdmGeometryMultiPolygon();
+
+ public static EdmGeometryMultiPolygon getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryMultiPolygon() {
+ super(Point.class, Dimension.GEOMETRY, Type.MULTIPOLYGON);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java
new file mode 100644
index 000000000..ba8e5d287
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryPoint extends AbstractEdmGeospatialType {
+
+ private static final EdmGeometryPoint INSTANCE = new EdmGeometryPoint();
+
+ public static EdmGeometryPoint getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryPoint() {
+ super(Point.class, Dimension.GEOMETRY, Type.POINT);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java
new file mode 100644
index 000000000..12f8cf118
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.Point;
+
+public final class EdmGeometryPolygon extends AbstractEdmGeospatialType {
+
+ private static final EdmGeometryPolygon INSTANCE = new EdmGeometryPolygon();
+
+ public static EdmGeometryPolygon getInstance() {
+ return INSTANCE;
+ }
+
+ public EdmGeometryPolygon() {
+ super(Point.class, Dimension.GEOMETRY, Type.POLYGON);
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java
new file mode 100644
index 000000000..83a257dbe
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import org.apache.olingo.commons.api.edm.EdmGeospatialType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmType;
+
+public final class EdmPrimitiveTypeFactory {
+
+ public static EdmType getInstance(final EdmPrimitiveTypeKind kind) {
+ return kind.isGeospatial()
+ ? getGeoInstance(kind)
+ : getNonGeoInstance(kind);
+ }
+
+ /**
+ * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmPrimitiveType} (for
+ * non-geospatial types).
+ *
+ * @param kind EdmPrimitiveTypeKind
+ * @return {@link EdmPrimitiveType} instance
+ */
+ public static EdmPrimitiveType getNonGeoInstance(final EdmPrimitiveTypeKind kind) {
+ switch (kind) {
+ case Binary:
+ return EdmBinary.getInstance();
+ case Boolean:
+ return EdmBoolean.getInstance();
+ case Byte:
+ return EdmByte.getInstance();
+ case SByte:
+ return EdmSByte.getInstance();
+ case Date:
+ return EdmDate.getInstance();
+ case DateTime:
+ return EdmDateTime.getInstance();
+ case DateTimeOffset:
+ return EdmDateTimeOffset.getInstance();
+ case Time:
+ return EdmTime.getInstance();
+ case TimeOfDay:
+ return EdmTimeOfDay.getInstance();
+ case Duration:
+ return EdmDuration.getInstance();
+ case Decimal:
+ return EdmDecimal.getInstance();
+ case Single:
+ return EdmSingle.getInstance();
+ case Double:
+ return EdmDouble.getInstance();
+ case Guid:
+ return EdmGuid.getInstance();
+ case Int16:
+ return EdmInt16.getInstance();
+ case Int32:
+ return EdmInt32.getInstance();
+ case Int64:
+ return EdmInt64.getInstance();
+ case String:
+ return EdmString.getInstance();
+ case Stream:
+ return EdmStream.getInstance();
+
+ default:
+ throw new IllegalArgumentException("Wrong type: " + kind);
+ }
+ }
+
+ /**
+ * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmGeospatialType}.
+ *
+ * @param kind EdmPrimitiveTypeKind
+ * @return {@link EdmGeospatialType} instance
+ */
+ public static EdmGeospatialType getGeoInstance(final EdmPrimitiveTypeKind kind) {
+ switch (kind) {
+ case Geography:
+ return EdmGeography.getInstance();
+ case GeographyPoint:
+ return EdmGeographyPoint.getInstance();
+ case GeographyLineString:
+ return EdmGeographyLineString.getInstance();
+ case GeographyPolygon:
+ return EdmGeographyPolygon.getInstance();
+ case GeographyMultiPoint:
+ return EdmGeographyMultiPoint.getInstance();
+ case GeographyMultiLineString:
+ return EdmGeographyMultiLineString.getInstance();
+ case GeographyMultiPolygon:
+ return EdmGeographyMultiPolygon.getInstance();
+ case GeographyCollection:
+ return EdmGeographyCollection.getInstance();
+ case Geometry:
+ return EdmGeometry.getInstance();
+ case GeometryPoint:
+ return EdmGeometry.getInstance();
+ case GeometryLineString:
+ return EdmGeometryLineString.getInstance();
+ case GeometryPolygon:
+ return EdmGeometryPolygon.getInstance();
+ case GeometryMultiPoint:
+ return EdmGeometryMultiPoint.getInstance();
+ case GeometryMultiLineString:
+ return EdmGeographyMultiLineString.getInstance();
+ case GeometryMultiPolygon:
+ return EdmGeometryMultiPolygon.getInstance();
+ case GeometryCollection:
+ return EdmGeometryCollection.getInstance();
+
+ default:
+ throw new IllegalArgumentException("Wrong type: " + kind);
+
+ }
+ }
+
+ private EdmPrimitiveTypeFactory() {
+ // empty constructor for static utility class
+ }
+
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
deleted file mode 100644
index e36860758..000000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.commons.core.edm.primitivetype;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-//TODO: Should we delete this typekind and use a facade?
-public enum EdmPrimitiveTypeKind {
-
- Binary, Boolean, Byte, Date, DateTimeOffset, Decimal, Double, Duration, Guid,
- Int16, Int32, Int64, SByte, Single, String, TimeOfDay;
-
- /**
- * Returns the {@link FullQualifiedName} for this type kind.
- *
- * @return {@link FullQualifiedName}
- */
- public FullQualifiedName getFullQualifiedName() {
- return new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, toString());
- }
-
- /**
- * Returns an instance for this {@link EdmPrimitiveTypeKind} in the form of {@link EdmPrimitiveType}.
- *
- * @return {@link EdmPrimitiveType} instance
- */
- public EdmPrimitiveType getEdmPrimitiveTypeInstance() {
- switch (this) {
- case Binary:
- return EdmBinary.getInstance();
- case Boolean:
- return EdmBoolean.getInstance();
- case Byte:
- return EdmByte.getInstance();
- case Date:
- return EdmDate.getInstance();
- case DateTimeOffset:
- return EdmDateTimeOffset.getInstance();
- case Decimal:
- return EdmDecimal.getInstance();
- case Double:
- return EdmDouble.getInstance();
- case Duration:
- return EdmDuration.getInstance();
- case Guid:
- return EdmGuid.getInstance();
- case Int16:
- return EdmInt16.getInstance();
- case Int32:
- return EdmInt32.getInstance();
- case Int64:
- return EdmInt64.getInstance();
- case SByte:
- return EdmSByte.getInstance();
- case Single:
- return EdmSingle.getInstance();
- case String:
- return EdmString.getInstance();
- case TimeOfDay:
- return EdmTimeOfDay.getInstance();
- default:
- throw new RuntimeException("Wrong type:" + this);
- }
- }
-
- /**
- * Gets EdmPrimitiveTypeKind from a full string (e.g. 'Edm.Int32').
- *
- * @param value string value type.
- * @return EdmPrimitiveTypeKind object.
- */
- public static EdmPrimitiveTypeKind valueOfFQN(final String value) {
- if (!value.startsWith(EdmPrimitiveType.EDM_NAMESPACE + ".")) {
- throw new IllegalArgumentException(value + " does not look like an Edm primitive type");
- }
- return valueOf(value.substring(4));
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java
new file mode 100644
index 000000000..75b629187
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStream.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm.primitivetype;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+
+/**
+ * Implementation of the EDM primitive type Stream as URI.
+ */
+public final class EdmStream extends SingletonPrimitiveType {
+
+ private static final EdmStream INSTANCE = new EdmStream();
+
+ public static EdmStream getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public Class> getDefaultType() {
+ return URI.class;
+ }
+
+ @Override
+ public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) {
+
+ if (value == null) {
+ return isNullable == null || isNullable;
+ }
+
+ try {
+ new URI(value);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ @Override
+ protected T internalValueOfString(final String value,
+ final Boolean isNullable, final Integer maxLength, final Integer precision,
+ final Integer scale, final Boolean isUnicode, final Class returnType) throws EdmPrimitiveTypeException {
+
+ URI stream = null;
+ try {
+ stream = new URI(value);
+ } catch (Exception e) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
+ }
+
+ if (returnType.isAssignableFrom(URI.class)) {
+ return returnType.cast(stream);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected String internalValueToString(final T value,
+ final Boolean isNullable, final Integer maxLength, final Integer precision,
+ final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof URI) {
+ return ((URI) value).toASCIIString();
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
+ }
+}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNull.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java
similarity index 57%
rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNull.java
rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java
index 57b1218b3..75e80cfb8 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNull.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java
@@ -18,33 +18,25 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-//TODO: Is this class still necessary?
/**
- * Implementation of the simple type Null.
+ * Implementation of the EDM primitive type Time.
*/
-public final class EdmNull extends SingletonPrimitiveType {
+public final class EdmTime extends SingletonPrimitiveType {
- private static final EdmNull INSTANCE = new EdmNull();
+ private static final EdmTime INSTANCE = new EdmTime();
- public static EdmNull getInstance() {
+ public static EdmTime getInstance() {
return INSTANCE;
}
- @Override
- public boolean equals(final Object obj) {
- return this == obj || obj == null;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
@Override
public Class> getDefaultType() {
- return null;
+ return Duration.class;
}
@Override
@@ -52,7 +44,20 @@ public final class EdmNull extends SingletonPrimitiveType {
final Boolean isNullable, final Integer maxLength, final Integer precision,
final Integer scale, final Boolean isUnicode, final Class returnType) throws EdmPrimitiveTypeException {
- return null;
+ Duration duration = null;
+ try {
+ final DatatypeFactory dtFactory = DatatypeFactory.newInstance();
+ duration = dtFactory.newDuration(value);
+ } catch (Exception e) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
+ }
+
+ if (returnType.isAssignableFrom(Duration.class)) {
+ return returnType.cast(duration);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.LITERAL_UNCONVERTIBLE_TO_VALUE_TYPE.addContent(value, returnType)");
+ }
}
@Override
@@ -60,16 +65,13 @@ public final class EdmNull extends SingletonPrimitiveType {
final Boolean isNullable, final Integer maxLength, final Integer precision,
final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
- return null;
- }
+ if (value instanceof Duration) {
+ final Duration duration = (Duration) value;
+ return duration.toString();
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
- @Override
- public String toUriLiteral(final String literal) {
- return "null";
- }
-
- @Override
- public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
- return null;
}
}
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
index 18b0dc6cf..dba916b36 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
@@ -28,10 +28,9 @@ import java.util.Calendar;
import java.util.UUID;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmNull;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
import org.junit.Test;
public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
@@ -40,9 +39,11 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
public void nameSpace() throws Exception {
assertEquals(EdmPrimitiveType.SYSTEM_NAMESPACE, Uint7.getInstance().getNamespace());
- assertEquals(EdmPrimitiveType.EDM_NAMESPACE, EdmNull.getInstance().getNamespace());
+ assertEquals(EdmPrimitiveType.EDM_NAMESPACE, EdmInt32.getInstance().getNamespace());
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
+ final EdmType instance = kind.isGeospatial()
+ ? EdmPrimitiveTypeFactory.getGeoInstance(kind)
+ : EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
assertEquals(EdmPrimitiveType.EDM_NAMESPACE, instance.getNamespace());
}
}
@@ -51,29 +52,33 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
public void names() throws Exception {
assertEquals("Uint7", Uint7.getInstance().getName());
- assertEquals("Null", EdmNull.getInstance().getName());
- assertEquals("Binary", EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Boolean", EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Byte", EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Date", EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance().getName());
- assertEquals("DateTimeOffset", EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Decimal", EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Double", EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Duration", EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Guid", EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Int16", EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Int32", EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Int64", EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance().getName());
- assertEquals("SByte", EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance().getName());
- assertEquals("Single", EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance().getName());
- assertEquals("String", EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance().getName());
- assertEquals("TimeOfDay", EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance().getName());
+ assertEquals("Binary", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).getName());
+ assertEquals("Boolean", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).getName());
+ assertEquals("Byte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).getName());
+ assertEquals("Date", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).getName());
+ assertEquals("DateTimeOffset",
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).getName());
+ assertEquals("Decimal", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).getName());
+ assertEquals("Double", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).getName());
+ assertEquals("Duration", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).getName());
+ assertEquals("Guid", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).getName());
+ assertEquals("Int16", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).getName());
+ assertEquals("Int32", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).getName());
+ assertEquals("Int64", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).getName());
+ assertEquals("SByte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).getName());
+ assertEquals("Single", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).getName());
+ assertEquals("String", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).getName());
+ assertEquals("TimeOfDay", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).getName());
}
@Test
public void kind() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- assertEquals(EdmTypeKind.PRIMITIVE, kind.getEdmPrimitiveTypeInstance().getKind());
+ if (kind.isGeospatial()) {
+ assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getGeoInstance(kind).getKind());
+ } else {
+ assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getNonGeoInstance(kind).getKind());
+ }
}
}
@@ -81,95 +86,113 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
public void toStringAll() throws Exception {
assertEquals("System.Uint7", Uint7.getInstance().toString());
- assertEquals("Edm.Null", EdmNull.getInstance().toString());
- assertEquals("Edm.Binary", EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Boolean", EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Byte", EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Date", EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.DateTimeOffset", EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Decimal", EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Double", EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Duration", EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Guid", EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Int16", EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Int32", EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Int64", EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.SByte", EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.Single", EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.String", EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance().toString());
- assertEquals("Edm.TimeOfDay", EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance().toString());
+ assertEquals("Edm.Binary", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).toString());
+ assertEquals("Edm.Boolean", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).toString());
+ assertEquals("Edm.Byte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).toString());
+ assertEquals("Edm.Date", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).toString());
+ assertEquals("Edm.DateTimeOffset",
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).toString());
+ assertEquals("Edm.Decimal", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).toString());
+ assertEquals("Edm.Double", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).toString());
+ assertEquals("Edm.Duration", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).toString());
+ assertEquals("Edm.Guid", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).toString());
+ assertEquals("Edm.Int16", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).toString());
+ assertEquals("Edm.Int32", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).toString());
+ assertEquals("Edm.Int64", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).toString());
+ assertEquals("Edm.SByte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).toString());
+ assertEquals("Edm.Single", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).toString());
+ assertEquals("Edm.String", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).toString());
+ assertEquals("Edm.TimeOfDay", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).toString());
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertEquals(instance.toString(), kind.getFullQualifiedName().toString());
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertEquals(instance.toString(), kind.getFullQualifiedName().toString());
+ }
}
}
@Test
public void compatibility() {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertTrue(instance.isCompatible(instance));
- assertFalse(instance.isCompatible(
- (kind == EdmPrimitiveTypeKind.String ? EdmPrimitiveTypeKind.Binary : EdmPrimitiveTypeKind.String)
- .getEdmPrimitiveTypeInstance()));
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertTrue(instance.isCompatible(instance));
+ assertFalse(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(
+ (kind == EdmPrimitiveTypeKind.String ? EdmPrimitiveTypeKind.Binary : EdmPrimitiveTypeKind.String))));
+ }
}
}
@Test
public void defaultType() throws Exception {
assertEquals(Byte.class, Uint7.getInstance().getDefaultType());
- assertNull(EdmNull.getInstance().getDefaultType());
- assertEquals(byte[].class, EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Boolean.class, EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Short.class, EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Calendar.class, EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Calendar.class, EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(BigDecimal.class, EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Double.class, EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(BigDecimal.class, EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(UUID.class, EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Short.class, EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Integer.class, EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Long.class, EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Byte.class, EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Float.class, EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(String.class, EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance().getDefaultType());
- assertEquals(Calendar.class, EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance().getDefaultType());
+ assertEquals(byte[].class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).getDefaultType());
+ assertEquals(Boolean.class,
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).getDefaultType());
+ assertEquals(Short.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).getDefaultType());
+ assertEquals(Calendar.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).getDefaultType());
+ assertEquals(Calendar.class,
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).getDefaultType());
+ assertEquals(BigDecimal.class,
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).getDefaultType());
+ assertEquals(Double.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).getDefaultType());
+ assertEquals(BigDecimal.class,
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).getDefaultType());
+ assertEquals(UUID.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).getDefaultType());
+ assertEquals(Short.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).getDefaultType());
+ assertEquals(Integer.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).getDefaultType());
+ assertEquals(Long.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).getDefaultType());
+ assertEquals(Byte.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).getDefaultType());
+ assertEquals(Float.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).getDefaultType());
+ assertEquals(String.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).getDefaultType());
+ assertEquals(Calendar.class,
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).getDefaultType());
}
@Test
public void validate() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertTrue(instance.validate(null, null, null, null, null, null));
- assertTrue(instance.validate(null, true, null, null, null, null));
- assertFalse(instance.validate(null, false, null, null, null, null));
- assertFalse(instance.validate("ä", null, null, null, null, false));
- if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Binary) {
- assertFalse(instance.validate("", null, null, null, null, null));
- }
- if (kind != EdmPrimitiveTypeKind.String) {
- assertFalse(instance.validate("ä", null, null, null, null, null));
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertTrue(instance.validate(null, null, null, null, null, null));
+ assertTrue(instance.validate(null, true, null, null, null, null));
+ assertFalse(instance.validate(null, false, null, null, null, null));
+ if (kind != EdmPrimitiveTypeKind.Stream) {
+ assertFalse(instance.validate("ä", null, null, null, null, false));
+ }
+ if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Binary
+ && kind != EdmPrimitiveTypeKind.Stream) {
+
+ assertFalse(instance.validate("", null, null, null, null, null));
+ }
+ if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Stream) {
+ assertFalse(instance.validate("ä", null, null, null, null, null));
+ }
}
}
- assertTrue(EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().validate("abcd", null, 3, null, null, null));
- assertFalse(EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance().validate("abcd", null, 2, null, null, null));
+ assertTrue(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).
+ validate("abcd", null, 3, null, null, null));
+ assertFalse(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).
+ validate("abcd", null, 2, null, null, null));
- assertTrue(EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().validate("1", null, null, null, null,
- null));
- assertFalse(EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance().validate("1.2", null, null, null, 0, null));
+ assertTrue(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).
+ validate("1", null, null, null, null, null));
+ assertFalse(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).
+ validate("1.2", null, null, null, 0, null));
}
@Test
public void uriLiteral() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertEquals("test", instance.fromUriLiteral(instance.toUriLiteral("test")));
- assertNull(instance.toUriLiteral(null));
- assertNull(instance.fromUriLiteral(null));
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertEquals("test", instance.fromUriLiteral(instance.toUriLiteral("test")));
+ assertNull(instance.toUriLiteral(null));
+ assertNull(instance.fromUriLiteral(null));
+ }
}
}
}
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
index 39fd38c31..c3ff01c34 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
@@ -25,12 +25,12 @@ import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmBinaryTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Binary.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary);
@Test
public void validate() throws Exception {
@@ -64,14 +64,14 @@ public class EdmBinaryTest extends PrimitiveTypeBaseTest {
@Test
public void valueToString() throws Exception {
- final byte[] binary = new byte[] { (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF };
+ final byte[] binary = new byte[]{(byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF};
assertEquals("qrvM3e7_", instance.valueToString(binary, null, null, null, null, null));
assertEquals("qrvM3e7_", instance.valueToString(binary, null, 6, null, null, null));
assertEquals("qrvM3e7_", instance.valueToString(binary, null, Integer.MAX_VALUE, null, null, null));
- assertEquals("qg", instance.valueToString(new Byte[] { new Byte((byte) 170) }, null, null, null, null, null));
+ assertEquals("qg", instance.valueToString(new Byte[]{new Byte((byte) 170)}, null, null, null, null, null));
expectFacetsErrorInValueToString(instance, binary, null, 3, null, null, null);
@@ -80,23 +80,23 @@ public class EdmBinaryTest extends PrimitiveTypeBaseTest {
@Test
public void valueOfString() throws Exception {
- final byte[] binary = new byte[] { (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF };
+ final byte[] binary = new byte[]{(byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF};
assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, null, null, null, null, byte[].class)));
- assertTrue(Arrays.equals(new Byte[] { binary[0], binary[1], binary[2] }, instance.valueOfString("qrvM", null, null,
- null, null, null, Byte[].class)));
+ assertTrue(Arrays.equals(new Byte[]{binary[0], binary[1], binary[2]}, instance.valueOfString("qrvM", null, null,
+ null, null, null, Byte[].class)));
assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, 6, null, null, null, byte[].class)));
- assertTrue(Arrays.equals(new byte[] { 42 }, instance.valueOfString("Kg==", null, 1, null, null, null,
- byte[].class)));
- assertTrue(Arrays.equals(new byte[] { 42 }, instance.valueOfString("Kg", null, 1, null, null, null,
- byte[].class)));
- assertTrue(Arrays.equals(new byte[] { 1, 2 }, instance.valueOfString("AQI=", null, 2, null, null, null,
- byte[].class)));
+ assertTrue(Arrays.equals(new byte[]{42}, instance.valueOfString("Kg==", null, 1, null, null, null,
+ byte[].class)));
+ assertTrue(Arrays.equals(new byte[]{42}, instance.valueOfString("Kg", null, 1, null, null, null,
+ byte[].class)));
+ assertTrue(Arrays.equals(new byte[]{1, 2}, instance.valueOfString("AQI=", null, 2, null, null, null,
+ byte[].class)));
assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, 6, null, null, null,
- byte[].class)));
+ byte[].class)));
assertTrue(Arrays.equals(binary, instance.valueOfString("qrvM3e7_", null, Integer.MAX_VALUE, null, null, null,
- byte[].class)));
+ byte[].class)));
expectFacetsErrorInValueOfString(instance, "qrvM3e7_", null, 3, null, null, null);
expectContentErrorInValueOfString(instance, "@");
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
index 1abca669c..d1e6580ee 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
@@ -21,12 +21,12 @@ package org.apache.olingo.commons.core.edm.primitivetype;
import static org.junit.Assert.assertEquals;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmBooleanTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean);
@Test
public void toUriLiteral() throws Exception {
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
index ddf819ff4..c560c39da 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
@@ -24,13 +24,12 @@ import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmByteTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte);
@Test
public void compatibility() {
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
index 3d966bce4..6cc3d1924 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
@@ -25,12 +25,12 @@ import java.util.Date;
import java.util.TimeZone;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmDateTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Date.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date);
@Test
public void toUriLiteral() throws Exception {
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
index f92fbecda..bcc01232d 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
@@ -26,12 +26,12 @@ import java.util.Date;
import java.util.TimeZone;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmDateTimeOffsetTest extends PrimitiveTypeBaseTest {
- final EdmPrimitiveType instance = EdmPrimitiveTypeKind.DateTimeOffset.getEdmPrimitiveTypeInstance();
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset);
@Test
public void toUriLiteral() throws Exception {
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
index 9f987a7e9..35917af01 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
@@ -25,24 +25,23 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmDecimalTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double)));
}
@Test
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
index abb3a6bf2..57403ced3 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
@@ -25,23 +25,22 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmDoubleTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Double.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single)));
}
@Test
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
index 7b97f7eba..85745b4ae 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
@@ -24,12 +24,12 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmDurationTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Duration.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration);
@Test
public void toUriLiteral() throws Exception {
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
index c6d73ca42..f69eddc18 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
@@ -23,12 +23,12 @@ import static org.junit.Assert.assertEquals;
import java.util.UUID;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmGuidTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Guid.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid);
@Test
public void toUriLiteral() {
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
index 458e1d49b..55c12bba0 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
@@ -24,19 +24,18 @@ import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmInt16Test extends PrimitiveTypeBaseTest {
- final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance();
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16);
@Test
public void testInt16Compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
}
@Test
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
index f0ada7e35..e3410d742 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
@@ -24,20 +24,19 @@ import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmInt32Test extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
}
@Test
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
index d7047701d..f45ab4949 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
@@ -24,21 +24,20 @@ import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmInt64Test extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
}
@Test
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
index 3a9daafba..5450be841 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
@@ -21,7 +21,7 @@ package org.apache.olingo.commons.core.edm.primitivetype;
import static org.junit.Assert.assertNull;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmNullTest extends PrimitiveTypeBaseTest {
@@ -29,22 +29,26 @@ public class EdmNullTest extends PrimitiveTypeBaseTest {
@Test
public void checkNull() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertNull(instance.valueToString(null, null, null, null, null, null));
- assertNull(instance.valueToString(null, true, null, null, null, null));
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertNull(instance.valueToString(null, null, null, null, null, null));
+ assertNull(instance.valueToString(null, true, null, null, null, null));
- expectNullErrorInValueToString(instance);
+ expectNullErrorInValueToString(instance);
+ }
}
}
@Test
public void checkValueOfNull() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmPrimitiveType instance = kind.getEdmPrimitiveTypeInstance();
- assertNull(instance.valueOfString(null, null, null, null, null, null, instance.getDefaultType()));
- assertNull(instance.valueOfString(null, true, null, null, null, null, instance.getDefaultType()));
+ if (!kind.isGeospatial()) {
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ assertNull(instance.valueOfString(null, null, null, null, null, null, instance.getDefaultType()));
+ assertNull(instance.valueOfString(null, true, null, null, null, null, instance.getDefaultType()));
- expectNullErrorInValueOfString(instance);
+ expectNullErrorInValueOfString(instance);
+ }
}
}
-}
\ No newline at end of file
+}
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
index 0ebb34226..88835e928 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
@@ -24,13 +24,12 @@ import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmSByteTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte);
@Test
public void compatibility() {
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
index 67847c772..9e90f22ab 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
@@ -25,22 +25,21 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmSingleTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.Single.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Byte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.SByte.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int16.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeKind.Int64.getEdmPrimitiveTypeInstance()));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
}
@Test
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
index 993c94325..bba0f910c 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
@@ -21,12 +21,12 @@ package org.apache.olingo.commons.core.edm.primitivetype;
import static org.junit.Assert.assertEquals;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmStringTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String);
@Test
public void toUriLiteral() throws Exception {
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
index 8979df9d3..ee9b2b882 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
@@ -24,12 +24,12 @@ import java.util.Calendar;
import java.util.TimeZone;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.junit.Test;
public class EdmTimeOfDayTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeKind.TimeOfDay.getEdmPrimitiveTypeInstance();
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay);
@Test
public void toUriLiteral() throws Exception {
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
index 05807ee0e..c956789b3 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
@@ -18,11 +18,10 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.Uint7;
import org.junit.Test;
public class UInt7Test extends PrimitiveTypeBaseTest {
@@ -30,6 +29,7 @@ public class UInt7Test extends PrimitiveTypeBaseTest {
@Test
public void compatibility() {
assertTrue(Uint7.getInstance().isCompatible(Uint7.getInstance()));
- assertFalse(Uint7.getInstance().isCompatible(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance()));
+ assertFalse(Uint7.getInstance().isCompatible(
+ EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String)));
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
index faceb0edb..9645d93f3 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
@@ -24,9 +24,10 @@ import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmMember;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.AbstractEdmEnumType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.edm.provider.EnumType;
public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType {
@@ -39,10 +40,10 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType
super(edm, enumName, enumType.isFlags());
if (enumType.getUnderlyingType() == null) {
- this.underlyingType = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+ this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
} else {
- this.underlyingType = EdmPrimitiveTypeKind.valueOf(
- enumType.getUnderlyingType().getName()).getEdmPrimitiveTypeInstance();
+ this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ EdmPrimitiveTypeKind.valueOf(enumType.getUnderlyingType().getName()));
// TODO: Should we validate that the underlying type is of byte, sbyte, in16, int32 or int64?
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
index 1c6fb0b87..91b0cde14 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
@@ -21,10 +21,11 @@ package org.apache.olingo.server.core.edm.provider;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.AbstractEdmTypeDefinition;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements EdmTypeDefinition {
@@ -34,7 +35,7 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
private EdmPrimitiveType edmPrimitiveTypeInstance;
public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
- final TypeDefinition typeDefinition) {
+ final TypeDefinition typeDefinition) {
super(edm, typeDefinitionName);
this.typeDefinition = typeDefinition;
@@ -44,8 +45,8 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
public EdmPrimitiveType getUnderlyingType() {
if (edmPrimitiveTypeInstance == null) {
try {
- edmPrimitiveTypeInstance = EdmPrimitiveTypeKind.valueOf(
- typeDefinition.getUnderlyingType().getName()).getEdmPrimitiveTypeInstance();
+ edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ EdmPrimitiveTypeKind.valueOf(typeDefinition.getUnderlyingType().getName()));
} catch (IllegalArgumentException e) {
throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
index a5b81af42..bb24c64de 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
@@ -18,17 +18,21 @@
*/
package org.apache.olingo.server.core.uri;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.uri.UriResourceKind;
import org.apache.olingo.server.api.uri.UriResourceLambdaAll;
import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements UriResourceLambdaAll {
+
protected EdmProperty property;
+
private String lambdaVariable;
+
private ExpressionImpl expression;
public UriResourceLambdaAllImpl() {
@@ -37,7 +41,7 @@ public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements Ur
@Override
public EdmType getType() {
- return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+ return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean);
}
@Override
@@ -53,7 +57,9 @@ public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements Ur
public UriResourceLambdaAllImpl setLamdaVariable(final String lambdaVariable) {
this.lambdaVariable = lambdaVariable;
return this;
- };
+ }
+
+ ;
@Override
public Expression getExpression() {
@@ -63,7 +69,9 @@ public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements Ur
public UriResourceLambdaAllImpl setExpression(final ExpressionImpl expression) {
this.expression = expression;
return this;
- };
+ }
+
+ ;
@Override
public String toString() {
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
index 65b6a698d..1e3143c1b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
@@ -18,17 +18,21 @@
*/
package org.apache.olingo.server.core.uri;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.uri.UriResourceKind;
import org.apache.olingo.server.api.uri.UriResourceLambdaAny;
import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements UriResourceLambdaAny {
+
protected EdmProperty property;
+
private String lambdaVariable;
+
private ExpressionImpl expression;
public UriResourceLambdaAnyImpl() {
@@ -37,7 +41,7 @@ public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements Ur
@Override
public EdmType getType() {
- return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+ return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean);
}
@Override
@@ -53,7 +57,9 @@ public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements Ur
public UriResourceLambdaAnyImpl setLamdaVariable(final String lambdaVariable) {
this.lambdaVariable = lambdaVariable;
return this;
- };
+ }
+
+ ;
@Override
public Expression getExpression() {
@@ -68,5 +74,6 @@ public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements Ur
@Override
public String toString() {
return "any";
- };
+ }
+;
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
index e6a22569e..7d9b0d183 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
@@ -54,7 +54,6 @@ import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.LevelsOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.SkipOptionImpl;
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
index 44607603c..c7d13cdb5 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
@@ -22,10 +22,6 @@ import java.util.Stack;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectItemContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectSegmentContext;
import org.apache.olingo.server.core.uri.parser.UriParseTreeVisitor.TypeInformation;
import org.apache.olingo.server.core.uri.queryoption.ExpandItemImpl;
import org.apache.olingo.server.core.uri.queryoption.SelectItemImpl;
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
index b3e5d694d..47f5ccee5 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
@@ -23,7 +23,6 @@ import java.util.List;
import org.antlr.v4.runtime.misc.ParseCancellationException;
import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.TerminalNodeImpl;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmActionImport;
@@ -36,12 +35,14 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmSingleton;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.uri.UriInfoKind;
import org.apache.olingo.server.api.uri.UriResource;
import org.apache.olingo.server.api.uri.UriResourcePartTyped;
@@ -70,7 +71,6 @@ import org.apache.olingo.server.core.uri.UriResourceValueImpl;
import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl;
import org.apache.olingo.server.core.uri.antlr.UriLexer;
import org.apache.olingo.server.core.uri.antlr.UriParserBaseVisitor;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AliasAndValueContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllEOFContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltAddContext;
@@ -128,7 +128,6 @@ import org.apache.olingo.server.core.uri.antlr.UriParserParser.NamespaceContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.NaninfinityContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.NowMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.NullruleContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.Number_in_jsonContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.OdataIdentifierContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByEOFContext;
@@ -157,14 +156,11 @@ import org.apache.olingo.server.core.uri.antlr.UriParserParser.TopContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.TotalOffsetMinutesMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.TotalsecondsMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.TrimMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.UnaryContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.YearMethodCallExprContext;
-import org.apache.olingo.server.core.uri.queryoption.AliasQueryOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.CountOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.ExpandItemImpl;
import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.LevelsOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.OrderByItemImpl;
import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
@@ -185,22 +181,22 @@ import org.apache.olingo.server.core.uri.queryoption.expression.TypeLiteralImpl;
/**
* UriVisitor
- *
- * Converts the URI parse tree the generated by ANTLR into an internal representation
- * which maybe is given to the application.
- * While converting the tree is only validated against the EDM if necessary.
- *
+ *
+ * Converts the URI parse tree the generated by ANTLR into an internal representation which maybe is given to the
+ * application. While converting the tree is only validated against the EDM if necessary.
+ *
* Attention:
* This UriVisitor is at somes point more lax than the original ABNF
- * It is more tolerable against additional white spaces
- * Currently not supported
+ * It is more tolerable against additional white spaces Currently not supported
* Parsing the context of $metadata
* Parsing $search
*/
public class UriParseTreeVisitor extends UriParserBaseVisitor