diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java index 20ab3a590..d3d7476b2 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java @@ -277,7 +277,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler /** * Gets the current ETag defined into the wrapped entity. * - * @return + * @return the current etag */ public String getETag() { return getEntity().getETag(); diff --git a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java index a2ccbaea5..de8c10eaf 100644 --- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java +++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java @@ -1463,7 +1463,7 @@ public abstract class AbstractServices { * @param path * @param format * @param changes - * @return + * @return response */ @PUT @Path("/{entitySetName}({entityId})/{path:.*}/$value") @@ -1491,7 +1491,7 @@ public abstract class AbstractServices { * @param path * @param format * @param changes - * @return + * @return response */ @MERGE @Path("/{entitySetName}({entityId})/{path:.*}") @@ -1519,7 +1519,7 @@ public abstract class AbstractServices { * @param path * @param format * @param changes - * @return + * @return response */ @PATCH @Path("/{entitySetName}({entityId})/{path:.*}") @@ -1587,7 +1587,7 @@ public abstract class AbstractServices { * @param path * @param format * @param changes - * @return + * @return response */ @PUT @Path("/{entitySetName}({entityId})/{path:.*}") @@ -1650,7 +1650,7 @@ public abstract class AbstractServices { * @param entityId * @param path * @param format - * @return + * @return response */ @DELETE @Path("/{entitySetName}({entityId})/{path:.*}/$value") diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java index b97085f68..55831b7e0 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java @@ -28,9 +28,7 @@ import org.apache.olingo.commons.api.http.HttpMethod; /** * Abstract representation of an OData request. Get instance by using factories. * - * @see org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory * @see org.apache.olingo.client.api.communication.request.cud.CUDRequestFactory - * @see org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory * @see org.apache.olingo.client.api.communication.request.batch.BatchRequestFactory * @see org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory */ diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataReferenceAddingRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataReferenceAddingRequest.java index ad34ecbf3..82f001a4b 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataReferenceAddingRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataReferenceAddingRequest.java @@ -1,18 +1,18 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -28,12 +28,12 @@ import org.apache.olingo.client.api.communication.response.ODataReferenceAddingR * ODataReferenceAdding requests eighter add or change the reference of navigation properties. * * If the navigation property is a collection of navigation references, the request adds a new reference to the - * collection. [OData Protocol 4.0 - 11.4.6.1] + * collection. [OData Protocol 4.0 - 11.4.6.1] * * If the request addresses an navigation property, which references a single entity, the reference will * be changed to the value provided by the request. [OData-Protocol 4.0 - 11.4.6.3] */ -public interface ODataReferenceAddingRequest - extends ODataBasicRequest, ODataBatchableRequest { +public interface ODataReferenceAddingRequest extends ODataBasicRequest, + ODataBatchableRequest { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataBatchResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataBatchResponse.java index 744758e73..358c44155 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataBatchResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataBatchResponse.java @@ -25,7 +25,7 @@ import org.apache.olingo.client.api.communication.request.batch.ODataBatchRespon /** * This class implements a response to a batch request. * - * @see org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest + * @see org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest */ public interface ODataBatchResponse extends ODataResponse { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataReferenceAddingResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataReferenceAddingResponse.java index adae48503..51bba0c95 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataReferenceAddingResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataReferenceAddingResponse.java @@ -25,7 +25,7 @@ package org.apache.olingo.client.api.communication.response; * If the request was successful, the service response has status code 204 and * the body has to be empty. * - * @see org.apache.olingo.client.api.communication.request.cud.api.request.cud.v4.ODataReferenceAddingRequest + * @see org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddingRequest */ public interface ODataReferenceAddingResponse extends ODataResponse { //No additional methods needed for now. diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java index d0eaac9dd..af6beb75b 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java @@ -175,7 +175,7 @@ public interface URIBuilder { * @return current URIBuilder instance * @see QueryOption#FILTER * @see URIFilter - * @see org.apache.olingo.client.api.uri.CommonFilterFactory + * @see org.apache.olingo.client.api.uri.FilterFactory */ URIBuilder filter(URIFilter filter); diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java index 2162b87bc..517079dfd 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java @@ -21,7 +21,7 @@ package org.apache.olingo.client.api.uri; /** * Interface for any available filter; obtain instances via FilterFactory. * - * @see org.apache.olingo.client.api.uri.CommonFilterFactory + * @see org.apache.olingo.client.api.uri.FilterFactory */ public interface URIFilter { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java index d10960a26..bdfd11831 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java @@ -47,9 +47,7 @@ import org.apache.olingo.commons.api.http.HttpMethod; /** * Abstract representation of an OData request. Get instance by using factories. * - * @see org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory * @see org.apache.olingo.client.api.communication.request.cud.CUDRequestFactory - * @see org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory * @see org.apache.olingo.client.api.communication.request.batch.BatchRequestFactory * @see org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory */ diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java index c3e76692c..f1732cc72 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java @@ -23,7 +23,7 @@ import org.apache.olingo.client.api.uri.FilterArg; /** * Filter property path; obtain instances via FilterArgFactory. * - * @see org.apache.olingo.client.api.uri.CommonFilterArgFactory + * @see org.apache.olingo.client.api.uri.FilterArgFactory */ public class FilterConst implements FilterArg { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java index 4842a9630..501a7342d 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java @@ -23,7 +23,7 @@ import org.apache.olingo.client.api.uri.FilterArg; /** * Filter value literals; obtain instances via FilterArgFactory. * - * @see org.apache.olingo.client.api.uri.v3.FilterArgFactory + * @see org.apache.olingo.client.api.uri.FilterArgFactory */ public class FilterLiteral implements FilterArg { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java index bc99eb495..6073112b4 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java @@ -23,7 +23,7 @@ import org.apache.olingo.client.api.uri.FilterArg; /** * Filter property path; obtain instances via FilterArgFactory. * - * @see org.apache.olingo.client.api.uri.CommonFilterArgFactory + * @see org.apache.olingo.client.api.uri.FilterArgFactory */ public class FilterProperty implements FilterArg { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java index 26399c268..608dc3a38 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java @@ -179,7 +179,6 @@ public final class URIUtils { /** * Turns primitive values into their respective URI representation. * - * @param version OData protocol version * @param obj primitive value * @return URI representation */ diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java index 04888d795..ad64559b4 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java @@ -23,7 +23,6 @@ import java.util.Map; /** * OData complex property value. * - * @param The actual ODataProperty interface. */ public interface ODataComplexValue extends ODataValue, ODataLinked, ODataAnnotatable, Iterable { diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java index ff9a4203c..6ba0ad638 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java @@ -30,7 +30,6 @@ public class ODataInlineEntity extends ODataLink { /** * Constructor. * - * @param version OData service version. * @param uri edit link. * @param type type. * @param title title. @@ -45,7 +44,6 @@ public class ODataInlineEntity extends ODataLink { /** * Constructor. * - * @param version OData service version. * @param baseURI base URI. * @param href href. * @param type type. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java index 4bc8bdba2..859367918 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java @@ -105,7 +105,6 @@ public class ODataLink extends ODataItem implements ODataAnnotatable { /** * Constructor. * - * @param version OData service version. * @param uri URI. * @param type type. * @param title title. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java index f99aa3e33..5ae427cb8 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java @@ -73,7 +73,6 @@ public enum ODataLinkType { * Gets * LinkType instance from the given rel and type. * - * @param version OData protocol version. * @param rel rel. * @param type type. * @return ODataLinkType object. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperation.java index d6101b3a6..c90316df7 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperation.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperation.java @@ -32,6 +32,8 @@ public interface EdmOperation extends EdmType, EdmAnnotatable { EdmParameter getParameter(String name); /** + * A list of all parameter names. If this is a bound action or function the first parameter name in the list is the + * binding parameter * @return a list of all parameter names */ List getParameterNames(); @@ -63,7 +65,7 @@ public interface EdmOperation extends EdmType, EdmAnnotatable { * @return true if binding parameter is of type collection. */ Boolean isBindingParameterTypeCollection(); - + /** * @return the entity set path as a String or null if not present */ 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 index b7efca716..78dd0139a 100644 --- 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 @@ -81,7 +81,6 @@ public enum EdmPrimitiveTypeKind { /** * 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. */ @@ -93,7 +92,6 @@ public enum EdmPrimitiveTypeKind { * 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. */ diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/EdmTypeKind.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/EdmTypeKind.java index bf24673ac..b55ec1689 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/EdmTypeKind.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/EdmTypeKind.java @@ -23,6 +23,6 @@ package org.apache.olingo.commons.api.edm.constants; */ public enum EdmTypeKind { - UNDEFINED, PRIMITIVE, ENUM, DEFINITION, COMPLEX, ENTITY, NAVIGATION, ACTION, FUNCTION, SYSTEM + PRIMITIVE, ENUM, DEFINITION, COMPLEX, ENTITY, NAVIGATION, ACTION, FUNCTION } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/Schema.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/Schema.java index 183478fe4..7ed27041e 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/Schema.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/Schema.java @@ -131,7 +131,7 @@ public class Schema extends AbstractEdmItem implements Annotatable{ /** * All actions with the given name * @param name - * @return + * @return a list of actions */ public List getActions(final String name) { return getAllByName(name, getActions()); @@ -149,7 +149,7 @@ public class Schema extends AbstractEdmItem implements Annotatable{ /** * All functions with the given name * @param name - * @return + * @return a list of functions */ public List getFunctions(final String name) { return getAllByName(name, getFunctions()); diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java index 6a4b494f3..52e4bec5d 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java @@ -57,7 +57,6 @@ public enum ODataFormat { /** * Gets format as {@link ContentType}. - * @param version OData service version. * @return format as ContentType. */ public ContentType getContentType() { diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java index 5cb207632..de79cf72f 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java @@ -56,14 +56,14 @@ public class JsonDeltaDeserializer extends JsonDeserializer { delta.setBaseURI(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA)); } - if (tree.hasNonNull(jsonCount)) { - delta.setCount(tree.get(jsonCount).asInt()); + if (tree.hasNonNull(Constants.JSON_COUNT)) { + delta.setCount(tree.get(Constants.JSON_COUNT).asInt()); } - if (tree.hasNonNull(jsonNextLink)) { - delta.setNext(URI.create(tree.get(jsonNextLink).textValue())); + if (tree.hasNonNull(Constants.JSON_NEXT_LINK)) { + delta.setNext(URI.create(tree.get(Constants.JSON_NEXT_LINK).textValue())); } - if (tree.hasNonNull(jsonDeltaLink)) { - delta.setDeltaLink(URI.create(tree.get(jsonDeltaLink).textValue())); + if (tree.hasNonNull(Constants.JSON_DELTA_LINK)) { + delta.setDeltaLink(URI.create(tree.get(Constants.JSON_DELTA_LINK).textValue())); } if (tree.hasNonNull(Constants.VALUE)) { diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java index fc7e4f8cf..96416238a 100755 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java @@ -72,36 +72,6 @@ public class JsonDeserializer implements ODataDeserializer { protected final boolean serverMode; - protected String jsonType = Constants.JSON_TYPE; - - protected String jsonId = Constants.JSON_ID; - - protected String jsonETag = Constants.JSON_ETAG; - - protected String jsonReadLink = Constants.JSON_READ_LINK; - - protected String jsonEditLink = Constants.JSON_EDIT_LINK; - - protected String jsonMediaEditLink = Constants.JSON_MEDIA_EDIT_LINK; - - protected String jsonMediaReadLink = Constants.JSON_MEDIA_READ_LINK; - - protected String jsonMediaContentType = Constants.JSON_MEDIA_CONTENT_TYPE; - - protected String jsonMediaETag = Constants.JSON_MEDIA_ETAG; - - protected String jsonAssociationLink = Constants.JSON_ASSOCIATION_LINK; - - protected String jsonNavigationLink = Constants.JSON_NAVIGATION_LINK; - - protected String jsonCount = Constants.JSON_COUNT; - - protected String jsonNextLink = Constants.JSON_NEXT_LINK; - - protected String jsonDeltaLink = Constants.JSON_DELTA_LINK; - - protected String jsonError = Constants.JSON_ERROR; - private JsonGeoValueDeserializer geoDeserializer; private JsonParser parser; @@ -163,7 +133,7 @@ public class JsonDeserializer implements ODataDeserializer { private void clientLinks(final Map.Entry field, final Linked linked, final Set toRemove, final JsonNode tree, final ObjectCodec codec) throws IOException { - if (field.getKey().endsWith(jsonNavigationLink)) { + if (field.getKey().endsWith(Constants.JSON_NAVIGATION_LINK)) { final LinkImpl link = new LinkImpl(); link.setTitle(getTitle(field)); link.setRel(Constants.NS_NAVIGATION_LINK_REL + getTitle(field)); @@ -176,8 +146,8 @@ public class JsonDeserializer implements ODataDeserializer { linked.getNavigationLinks().add(link); toRemove.add(field.getKey()); - toRemove.add(setInline(field.getKey(), jsonNavigationLink, tree, codec, link)); - } else if (field.getKey().endsWith(jsonAssociationLink)) { + toRemove.add(setInline(field.getKey(), Constants.JSON_NAVIGATION_LINK, tree, codec, link)); + } else if (field.getKey().endsWith(Constants.JSON_ASSOCIATION_LINK)) { final LinkImpl link = new LinkImpl(); link.setTitle(getTitle(field)); link.setRel(Constants.NS_ASSOCIATION_LINK_REL + getTitle(field)); @@ -193,7 +163,7 @@ public class JsonDeserializer implements ODataDeserializer { final JsonNode tree, final ObjectCodec codec) throws IOException { if (field.getKey().endsWith(Constants.JSON_BIND_LINK_SUFFIX) - || field.getKey().endsWith(jsonNavigationLink)) { + || field.getKey().endsWith(Constants.JSON_NAVIGATION_LINK)) { if (field.getValue().isValueNode()) { final String suffix = field.getKey().replaceAll("^.*@", "@"); @@ -280,7 +250,7 @@ public class JsonDeserializer implements ODataDeserializer { if (annotatable != null) { annotatable.getAnnotations().add(entityAnnot); } - } else if (type == null && field.getKey().endsWith(getJSONAnnotation(jsonType))) { + } else if (type == null && field.getKey().endsWith(getJSONAnnotation(Constants.JSON_TYPE))) { type = field.getValue().asText(); } else if (annotation == null && customAnnotation.matches() && !"odata".equals(customAnnotation.group(2))) { annotation = new AnnotationImpl(); @@ -354,8 +324,8 @@ public class JsonDeserializer implements ODataDeserializer { values.add(child.asText()); } } else if (child.isContainerNode()) { - if (child.has(jsonType)) { - ((ObjectNode) child).remove(jsonType); + if (child.has(Constants.JSON_TYPE)) { + ((ObjectNode) child).remove(Constants.JSON_TYPE); } final Object value = fromComplex((ObjectNode) child, codec); valueType = ValueType.COLLECTION_COMPLEX; @@ -387,9 +357,9 @@ public class JsonDeserializer implements ODataDeserializer { break; case COMPLEX: - if (node.has(jsonType)) { - valuable.setType(node.get(jsonType).asText()); - ((ObjectNode) node).remove(jsonType); + if (node.has(Constants.JSON_TYPE)) { + valuable.setType(node.get(Constants.JSON_TYPE).asText()); + ((ObjectNode) node).remove(Constants.JSON_TYPE); } final Object value = fromComplex((ObjectNode) node, codec); valuable.setValue(ValueType.COMPLEX, value); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java index b63950b27..228ac062d 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java @@ -82,7 +82,7 @@ public class JsonEntityDeserializer extends JsonDeserializer { if (contextURL != null) { entity.setBaseURI(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA)); } - + final String metadataETag; if (tree.hasNonNull(Constants.JSON_METADATA_ETAG)) { metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue(); @@ -91,56 +91,57 @@ public class JsonEntityDeserializer extends JsonDeserializer { metadataETag = null; } - if (tree.hasNonNull(jsonETag)) { - entity.setETag(tree.get(jsonETag).textValue()); - tree.remove(jsonETag); + if (tree.hasNonNull(Constants.JSON_ETAG)) { + entity.setETag(tree.get(Constants.JSON_ETAG).textValue()); + tree.remove(Constants.JSON_ETAG); } - if (tree.hasNonNull(jsonType)) { - entity.setType(new EdmTypeInfo.Builder().setTypeExpression(tree.get(jsonType).textValue()).build().internal()); - tree.remove(jsonType); + if (tree.hasNonNull(Constants.JSON_TYPE)) { + entity.setType(new EdmTypeInfo.Builder().setTypeExpression(tree.get(Constants.JSON_TYPE).textValue()).build() + .internal()); + tree.remove(Constants.JSON_TYPE); } - if (tree.hasNonNull(jsonId)) { - entity.setId(URI.create(tree.get(jsonId).textValue())); - tree.remove(jsonId); + if (tree.hasNonNull(Constants.JSON_ID)) { + entity.setId(URI.create(tree.get(Constants.JSON_ID).textValue())); + tree.remove(Constants.JSON_ID); } - if (tree.hasNonNull(jsonReadLink)) { + if (tree.hasNonNull(Constants.JSON_READ_LINK)) { final LinkImpl link = new LinkImpl(); link.setRel(Constants.SELF_LINK_REL); - link.setHref(tree.get(jsonReadLink).textValue()); + link.setHref(tree.get(Constants.JSON_READ_LINK).textValue()); entity.setSelfLink(link); - tree.remove(jsonReadLink); + tree.remove(Constants.JSON_READ_LINK); } - if (tree.hasNonNull(jsonEditLink)) { + if (tree.hasNonNull(Constants.JSON_EDIT_LINK)) { final LinkImpl link = new LinkImpl(); if (serverMode) { link.setRel(Constants.EDIT_LINK_REL); } - link.setHref(tree.get(jsonEditLink).textValue()); + link.setHref(tree.get(Constants.JSON_EDIT_LINK).textValue()); entity.setEditLink(link); - tree.remove(jsonEditLink); + tree.remove(Constants.JSON_EDIT_LINK); } - if (tree.hasNonNull(jsonMediaReadLink)) { - entity.setMediaContentSource(URI.create(tree.get(jsonMediaReadLink).textValue())); - tree.remove(jsonMediaReadLink); + if (tree.hasNonNull(Constants.JSON_MEDIA_READ_LINK)) { + entity.setMediaContentSource(URI.create(tree.get(Constants.JSON_MEDIA_READ_LINK).textValue())); + tree.remove(Constants.JSON_MEDIA_READ_LINK); } - if (tree.hasNonNull(jsonMediaEditLink)) { - entity.setMediaContentSource(URI.create(tree.get(jsonMediaEditLink).textValue())); - tree.remove(jsonMediaEditLink); + if (tree.hasNonNull(Constants.JSON_MEDIA_EDIT_LINK)) { + entity.setMediaContentSource(URI.create(tree.get(Constants.JSON_MEDIA_EDIT_LINK).textValue())); + tree.remove(Constants.JSON_MEDIA_EDIT_LINK); } - if (tree.hasNonNull(jsonMediaContentType)) { - entity.setMediaContentType(tree.get(jsonMediaContentType).textValue()); - tree.remove(jsonMediaContentType); + if (tree.hasNonNull(Constants.JSON_MEDIA_CONTENT_TYPE)) { + entity.setMediaContentType(tree.get(Constants.JSON_MEDIA_CONTENT_TYPE).textValue()); + tree.remove(Constants.JSON_MEDIA_CONTENT_TYPE); } - if (tree.hasNonNull(jsonMediaETag)) { - entity.setMediaETag(tree.get(jsonMediaETag).textValue()); - tree.remove(jsonMediaETag); + if (tree.hasNonNull(Constants.JSON_MEDIA_ETAG)) { + entity.setMediaETag(tree.get(Constants.JSON_MEDIA_ETAG).textValue()); + tree.remove(Constants.JSON_MEDIA_ETAG); } final Set toRemove = new HashSet(); @@ -151,7 +152,7 @@ public class JsonEntityDeserializer extends JsonDeserializer { final Matcher customAnnotation = CUSTOM_ANNOTATION.matcher(field.getKey()); links(field, entity, toRemove, tree, parser.getCodec()); - if (field.getKey().endsWith(getJSONAnnotation(jsonMediaEditLink))) { + if (field.getKey().endsWith(getJSONAnnotation(Constants.JSON_MEDIA_EDIT_LINK))) { final LinkImpl link = new LinkImpl(); link.setTitle(getTitle(field)); link.setRel(Constants.NS_MEDIA_EDIT_LINK_REL + getTitle(field)); @@ -159,14 +160,15 @@ public class JsonEntityDeserializer extends JsonDeserializer { link.setType(ODataLinkType.MEDIA_EDIT.toString()); entity.getMediaEditLinks().add(link); - if (tree.has(link.getTitle() + getJSONAnnotation(jsonMediaETag))) { - link.setMediaETag(tree.get(link.getTitle() + getJSONAnnotation(jsonMediaETag)).asText()); - toRemove.add(link.getTitle() + getJSONAnnotation(jsonMediaETag)); + if (tree.has(link.getTitle() + getJSONAnnotation(Constants.JSON_MEDIA_ETAG))) { + link.setMediaETag(tree.get(link.getTitle() + getJSONAnnotation(Constants.JSON_MEDIA_ETAG)).asText()); + toRemove.add(link.getTitle() + getJSONAnnotation(Constants.JSON_MEDIA_ETAG)); } toRemove.add(field.getKey()); - toRemove.add(setInline(field.getKey(), getJSONAnnotation(jsonMediaEditLink), tree, parser.getCodec(), link)); - } else if (field.getKey().endsWith(getJSONAnnotation(jsonMediaContentType))) { + toRemove.add(setInline(field.getKey(), getJSONAnnotation(Constants.JSON_MEDIA_EDIT_LINK), tree, parser + .getCodec(), link)); + } else if (field.getKey().endsWith(getJSONAnnotation(Constants.JSON_MEDIA_CONTENT_TYPE))) { final String linkTitle = getTitle(field); for (Link link : entity.getMediaEditLinks()) { if (linkTitle.equals(link.getTitle())) { diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java index 00b807e00..1e844b532 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java @@ -79,17 +79,17 @@ public class JsonEntitySetDeserializer extends JsonDeserializer { metadataETag = null; } - if (tree.hasNonNull(jsonCount)) { - entitySet.setCount(tree.get(jsonCount).asInt()); - tree.remove(jsonCount); + if (tree.hasNonNull(Constants.JSON_COUNT)) { + entitySet.setCount(tree.get(Constants.JSON_COUNT).asInt()); + tree.remove(Constants.JSON_COUNT); } - if (tree.hasNonNull(jsonNextLink)) { - entitySet.setNext(URI.create(tree.get(jsonNextLink).textValue())); - tree.remove(jsonNextLink); + if (tree.hasNonNull(Constants.JSON_NEXT_LINK)) { + entitySet.setNext(URI.create(tree.get(Constants.JSON_NEXT_LINK).textValue())); + tree.remove(Constants.JSON_NEXT_LINK); } - if (tree.hasNonNull(jsonDeltaLink)) { - entitySet.setDeltaLink(URI.create(tree.get(jsonDeltaLink).textValue())); - tree.remove(jsonDeltaLink); + if (tree.hasNonNull(Constants.JSON_DELTA_LINK)) { + entitySet.setDeltaLink(URI.create(tree.get(Constants.JSON_DELTA_LINK).textValue())); + tree.remove(Constants.JSON_DELTA_LINK); } if (tree.hasNonNull(Constants.VALUE)) { diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java index 8e49a28d6..89252dca3 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java @@ -43,8 +43,8 @@ public class JsonODataErrorDeserializer extends JsonDeserializer { final ODataError error = new ODataError(); final ObjectNode tree = parser.getCodec().readTree(parser); - if (tree.has(jsonError)) { - final JsonNode errorNode = tree.get(jsonError); + if (tree.has(Constants.JSON_ERROR)) { + final JsonNode errorNode = tree.get(Constants.JSON_ERROR); if (errorNode.has(Constants.ERROR_CODE)) { error.setCode(errorNode.get(Constants.ERROR_CODE).textValue()); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java index 9a9498e39..e0732d5d9 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java @@ -75,9 +75,10 @@ public class JsonPropertyDeserializer extends JsonDeserializer { contextURL = null; } - if (tree.has(jsonType)) { - property.setType(new EdmTypeInfo.Builder().setTypeExpression(tree.get(jsonType).textValue()).build().internal()); - tree.remove(jsonType); + if (tree.has(Constants.JSON_TYPE)) { + property.setType(new EdmTypeInfo.Builder().setTypeExpression(tree.get(Constants.JSON_TYPE).textValue()).build() + .internal()); + tree.remove(Constants.JSON_TYPE); } if (tree.has(Constants.JSON_NULL) && tree.get(Constants.JSON_NULL).asBoolean()) { diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java index 8ccb253ed..1989df11e 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java @@ -45,7 +45,9 @@ public class DeserializerException extends ODataTranslatedException { /** parameter: navigationPropertyName */NAVIGATION_PROPERTY_NOT_FOUND, /** parameter: annotationName */INVALID_ANNOTATION_TYPE, /** parameter: annotationName */INVALID_NULL_ANNOTATION, - /** parameter: binding link */INVALID_ENTITY_BINDING_LINK; + /** parameter: binding link */INVALID_ENTITY_BINDING_LINK, + /** parameter: action parameter name */INVALID_ACTION_PARAMETER_TYPE, + /** parameter: parameterName */ INVALID_NULL_PARAMETER; @Override public String getKey() { diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java index a62531baf..9a0e6934d 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java @@ -53,7 +53,7 @@ public interface FixedFormatSerializer { * Serializes a batch response * @param batchResponses * @param boundary - * @return + * @return response as an input stream * @throws BatchSerializerException */ InputStream batchResponse(List batchResponses, String boundary) throws BatchSerializerException; diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java index a66570f0f..8d2701e0c 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java @@ -186,7 +186,7 @@ public class ODataJsonDeserializer implements ODataDeserializer { public List actionParameters(InputStream stream, final EdmAction edmAction) throws DeserializerException { try { ObjectNode tree = parseJsonTree(stream); - ArrayList parameters = new ArrayList(); + List parameters = new ArrayList(); consumeParameters(edmAction, tree, parameters); assertJsonNodeIsEmpty(tree); return parameters; @@ -211,29 +211,50 @@ public class ODataJsonDeserializer implements ODataDeserializer { return tree; } - private void consumeParameters(final EdmAction edmAction, ObjectNode node, ArrayList parameters) + private void consumeParameters(final EdmAction edmAction, ObjectNode node, List parameters) throws DeserializerException { - for (final String name : edmAction.getParameterNames()) { + List parameterNames = edmAction.getParameterNames(); + if (edmAction.isBound()) { + // The binding parameter must not occur in the payload. + parameterNames = parameterNames.subList(1, parameterNames.size()); + } + for (final String name : parameterNames) { final EdmParameter edmParameter = edmAction.getParameter(name); ParameterImpl parameter = new ParameterImpl(); parameter.setName(name); JsonNode jsonNode = node.get(name); - if (jsonNode == null) { - if (!edmParameter.isNullable()) { - // TODO: new message key. - throw new DeserializerException("Non-nullable parameter not present or null", - DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, name); + + switch (edmParameter.getType().getKind()) { + case PRIMITIVE: + case DEFINITION: + case ENUM: + if (jsonNode == null || jsonNode.isNull()) { + if (!edmParameter.isNullable()) { + throw new DeserializerException("Non-nullable parameter not present or null", + DeserializerException.MessageKeys.INVALID_NULL_PARAMETER, name); + } + if (edmParameter.isCollection()) { + throw new DeserializerException("Collection must not be null for parameter: " + name, + DeserializerException.MessageKeys.INVALID_NULL_PARAMETER, name); + } + parameter.setValue(ValueType.PRIMITIVE, null); + } else { + Property consumePropertyNode = + consumePropertyNode(edmParameter.getName(), edmParameter.getType(), edmParameter.isCollection(), + edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(), edmParameter + .getScale(), true, edmParameter.getMapping(), jsonNode); + parameter.setValue(consumePropertyNode.getValueType(), consumePropertyNode.getValue()); + parameters.add(parameter); + node.remove(name); } - } else { - Property consumePropertyNode = - consumePropertyNode(edmParameter.getName(), edmParameter.getType(), edmParameter.isCollection(), - edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(), edmParameter - .getScale(), - true, edmParameter.getMapping(), - jsonNode); - parameter.setValue(consumePropertyNode.getValueType(), consumePropertyNode.getValue()); - parameters.add(parameter); - node.remove(name); + break; + case COMPLEX: + case ENTITY: + throw new DeserializerException("Entity an complex parameters currently not Implemented", + DeserializerException.MessageKeys.NOT_IMPLEMENTED); + default: + throw new DeserializerException("Invalid type kind " + edmParameter.getType().getKind().toString() + + " for action parameter: " + name, DeserializerException.MessageKeys.INVALID_ACTION_PARAMETER_TYPE, name); } } } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java index 5956e8286..a7ce16baa 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java @@ -147,9 +147,12 @@ public class ODataJsonSerializer implements ODataSerializer { json.writeNumberField(Constants.JSON_COUNT, entitySet.getCount()); } json.writeFieldName(Constants.VALUE); - writeEntitySet(metadata, entityType, entitySet, options == null ? null : options.getExpand(), - options == null ? null : options.getSelect(), - options == null ? false : options.onlyReferences(), json); + if(options == null) { + writeEntitySet(metadata, entityType, entitySet, null, null, false, json); + } else { + writeEntitySet(metadata, entityType, entitySet, + options.getExpand(), options.getSelect(), options.onlyReferences(), json); + } if (entitySet.getNext() != null) { json.writeStringField(Constants.JSON_NEXT_LINK, entitySet.getNext().toASCIIString()); } @@ -242,7 +245,8 @@ public class ODataJsonSerializer implements ODataSerializer { protected EdmEntityType resolveEntityType(ServiceMetadata metadata, EdmEntityType baseType, String derivedTypeName) throws SerializerException { - if (baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName)) { + if (derivedTypeName == null || + baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName)) { return baseType; } EdmEntityType derivedType = metadata.getEdm().getEntityType(new FullQualifiedName(derivedTypeName)); @@ -265,7 +269,8 @@ public class ODataJsonSerializer implements ODataSerializer { protected EdmComplexType resolveComplexType(ServiceMetadata metadata, EdmComplexType baseType, String derivedTypeName) throws SerializerException { - if (baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName)) { + if (derivedTypeName == null || + baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName)) { return baseType; } EdmComplexType derivedType = metadata.getEdm().getComplexType(new FullQualifiedName(derivedTypeName)); diff --git a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties index b8254c3d2..2bca28692 100644 --- a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties +++ b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties @@ -117,6 +117,8 @@ DeserializerException.UNKNOWN_PRIMITIVE_TYPE=Unknown primitive type '%1$s' for p DeserializerException.NAVIGATION_PROPERTY_NOT_FOUND=Can`t find navigation property with name: '%1$s'. DeserializerException.INVALID_ANNOTATION_TYPE=The annotation '%1$s' has the wrong JSON type. DeserializerException.INVALID_ENTITY_BINDING_LINK=The binding link '%1$s' is malformed. +DeserializerException.INVALID_ACTION_PARAMETER_TYPE=The action parameter '%1$s' must be either primitive, complex or an entity or a collection of those types. +DeserializerException.INVALID_NULL_PARAMETER=The parameter '%1$s' must not be null. BatchDeserializerException.INVALID_BOUNDARY=Invalid boundary at line '%1$s'. BatchDeserializerException.INVALID_CHANGESET_METHOD=Invalid method: a ChangeSet cannot contain retrieve requests at line '%1$s'. diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java index ddfd15dc0..b9f6db6b5 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java @@ -37,10 +37,10 @@ public class EdmTypeImplTest { @Test public void getterTest() { - EdmType type = new EdmTypeImplTester(new FullQualifiedName("namespace", "name"), EdmTypeKind.UNDEFINED); + EdmType type = new EdmTypeImplTester(new FullQualifiedName("namespace", "name"), EdmTypeKind.PRIMITIVE); assertEquals("name", type.getName()); assertEquals("namespace", type.getNamespace()); - assertEquals(EdmTypeKind.UNDEFINED, type.getKind()); + assertEquals(EdmTypeKind.PRIMITIVE, type.getKind()); EdmAnnotatable an = (EdmAnnotatable) type; assertNotNull(an.getAnnotations().get(0)); } diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java index 45fd740f5..9de716694 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java @@ -92,8 +92,7 @@ public class DataCreator { EntitySet entitySet = new EntitySetImpl(); for (int i = 1; i <= 503; i++) { - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", i)) + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", i)) .addProperty(createPrimitive("PropertyString", "Number:" + i))); } @@ -112,32 +111,20 @@ public class DataCreator { @SuppressWarnings("unchecked") private Entity createETKeyNavEntity(int propertyInt16, String propertyString) { - return new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", propertyInt16)) + return new EntityImpl().addProperty(createPrimitive("PropertyInt16", propertyInt16)) .addProperty(createPrimitive("PropertyString", propertyString)) - .addProperty(createComplex("PropertyCompNav", - createPrimitive("PropertyInt16", 1))) - .addProperty(createKeyNavAllPrimComplexValue("PropertyCompAllPrim")) - .addProperty(createComplex("PropertyCompTwoPrim", - createPrimitive("PropertyInt16", 16), - createPrimitive("PropertyString", "Test123"))) - .addProperty(createPrimitiveCollection("CollPropertyString", - "Employee1@company.example", - "Employee2@company.example", - "Employee3@company.example")) - .addProperty(createPrimitiveCollection("CollPropertyInt16", 1000, 2000, 30112)) - .addProperty(createComplexCollection("CollPropertyComp", - Arrays.asList( - createPrimitive("PropertyInt16", 1), - createKeyNavAllPrimComplexValue("PropertyComp")), - Arrays.asList( - createPrimitive("PropertyInt16", 2), - createKeyNavAllPrimComplexValue("PropertyComp")), - Arrays.asList( - createPrimitive("PropertyInt16", 3), - createKeyNavAllPrimComplexValue("PropertyComp")))) - .addProperty(createComplex("PropertyCompCompNav", - createPrimitive("PropertyString", "1"), + .addProperty(createComplex("PropertyCompNav", createPrimitive("PropertyInt16", 1))) + .addProperty(createKeyNavAllPrimComplexValue("PropertyCompAllPrim")).addProperty( + createComplex("PropertyCompTwoPrim", createPrimitive("PropertyInt16", 16), + createPrimitive("PropertyString", "Test123"))).addProperty( + createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example", + "Employee3@company.example")) + .addProperty(createPrimitiveCollection("CollPropertyInt16", 1000, 2000, 30112)).addProperty( + createComplexCollection("CollPropertyComp", + Arrays.asList(createPrimitive("PropertyInt16", 1), createKeyNavAllPrimComplexValue("PropertyComp")), + Arrays.asList(createPrimitive("PropertyInt16", 2), createKeyNavAllPrimComplexValue("PropertyComp")), + Arrays.asList(createPrimitive("PropertyInt16", 3), createKeyNavAllPrimComplexValue("PropertyComp")))) + .addProperty(createComplex("PropertyCompCompNav", createPrimitive("PropertyString", "1"), createComplex("PropertyCompNav", createPrimitive("PropertyInt16", 1)))); } @@ -154,55 +141,40 @@ public class DataCreator { @SuppressWarnings("unchecked") private Entity createESTwoKeyNavEntity(int propertyInt16, String propertyString) { - return new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", propertyInt16)) - .addProperty(createPrimitive("PropertyString", propertyString)) - .addProperty(createComplex("PropertyComp", - createPrimitive("PropertyInt16", 11), - createComplex("PropertyComp", - createPrimitive("PropertyString", "StringValue"), - createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119, -85, -51, -17 }), - createPrimitive("PropertyBoolean", true), - createPrimitive("PropertyByte", 255), - createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 7, 16, 23)), - createPrimitive("PropertyDecimal", 34), - createPrimitive("PropertySingle", 179000000000000000000D), - createPrimitive("PropertyDouble", -179000000000000000000D), - createPrimitive("PropertyDuration", 6), - createPrimitive("PropertyGuid", UUID.fromString("01234567-89ab-cdef-0123-456789abcdef")), - createPrimitive("PropertyInt16", Short.MAX_VALUE), - createPrimitive("PropertyInt32", Integer.MAX_VALUE), - createPrimitive("PropertyInt64", Long.MAX_VALUE), - createPrimitive("PropertySByte", Byte.MAX_VALUE), - createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59))))) - .addProperty(createComplex("PropertyCompNav", - createPrimitive("PropertyInt16", 1), - createKeyNavAllPrimComplexValue("PropertyComp"))) + return new EntityImpl().addProperty(createPrimitive("PropertyInt16", propertyInt16)) + .addProperty(createPrimitive("PropertyString", propertyString)).addProperty( + createComplex("PropertyComp", createPrimitive("PropertyInt16", 11), + createComplex("PropertyComp", createPrimitive("PropertyString", "StringValue"), + createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119, -85, -51, -17 }), + createPrimitive("PropertyBoolean", true), createPrimitive("PropertyByte", 255), + createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 7, 16, 23)), + createPrimitive("PropertyDecimal", 34), createPrimitive("PropertySingle", 179000000000000000000D), + createPrimitive("PropertyDouble", -179000000000000000000D), createPrimitive("PropertyDuration", 6), + createPrimitive("PropertyGuid", UUID.fromString("01234567-89ab-cdef-0123-456789abcdef")), + createPrimitive("PropertyInt16", Short.MAX_VALUE), + createPrimitive("PropertyInt32", Integer.MAX_VALUE), + createPrimitive("PropertyInt64", Long.MAX_VALUE), createPrimitive("PropertySByte", Byte.MAX_VALUE), + createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59))))).addProperty( + createComplex("PropertyCompNav", createPrimitive("PropertyInt16", 1), + createKeyNavAllPrimComplexValue("PropertyComp"))) .addProperty(createComplexCollection("CollPropertyComp")) - .addProperty(createComplexCollection("CollPropertyCompNav", - Arrays.asList(createPrimitive("PropertyInt16", 1)))) - .addProperty(createPrimitiveCollection("CollPropertyString", 1, 2)) - .addProperty(createComplex("PropertyCompTwoPrim", createPrimitive("PropertyInt16", 11), - createPrimitive("PropertyString", "11"))); + .addProperty(createComplexCollection("CollPropertyCompNav", Arrays.asList(createPrimitive("PropertyInt16", 1)))) + .addProperty(createPrimitiveCollection("CollPropertyString", 1, 2)).addProperty( + createComplex("PropertyCompTwoPrim", createPrimitive("PropertyInt16", 11), + createPrimitive("PropertyString", "11"))); } private Property createKeyNavAllPrimComplexValue(final String name) { - return createComplex(name, - createPrimitive("PropertyString", "First Resource - positive values"), + return createComplex(name, createPrimitive("PropertyString", "First Resource - positive values"), createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119, -85, -51, -17 }), - createPrimitive("PropertyBoolean", true), - createPrimitive("PropertyByte", 255), + createPrimitive("PropertyBoolean", true), createPrimitive("PropertyByte", 255), createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 7, 16, 23)), createPrimitive("PropertyDateTimeOffset", getTimestamp(2012, 12, 3, 7, 16, 23, 0)), - createPrimitive("PropertyDecimal", 34), - createPrimitive("PropertySingle", 179000000000000000000D), - createPrimitive("PropertyDouble", -179000000000000000000D), - createPrimitive("PropertyDuration", 6), + createPrimitive("PropertyDecimal", 34), createPrimitive("PropertySingle", 179000000000000000000D), + createPrimitive("PropertyDouble", -179000000000000000000D), createPrimitive("PropertyDuration", 6), createPrimitive("PropertyGuid", UUID.fromString("01234567-89ab-cdef-0123-456789abcdef")), - createPrimitive("PropertyInt16", Short.MAX_VALUE), - createPrimitive("PropertyInt32", Integer.MAX_VALUE), - createPrimitive("PropertyInt64", Long.MAX_VALUE), - createPrimitive("PropertySByte", Byte.MAX_VALUE), + createPrimitive("PropertyInt16", Short.MAX_VALUE), createPrimitive("PropertyInt32", Integer.MAX_VALUE), + createPrimitive("PropertyInt64", Long.MAX_VALUE), createPrimitive("PropertySByte", Byte.MAX_VALUE), createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59))); } @@ -210,8 +182,7 @@ public class DataCreator { private EntitySet createESCompCollComp() { final EntitySet entitySet = new EntitySetImpl(); - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)) + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)) .addProperty(createComplex("PropertyComp", createComplexCollection("CollPropertyComp", Arrays .asList(createPrimitive("PropertyInt16", 555), createPrimitive("PropertyString", "1 Test Complex in Complex Property")), Arrays @@ -220,9 +191,8 @@ public class DataCreator { .asList(createPrimitive("PropertyInt16", 777), createPrimitive("PropertyString", "3 Test Complex in Complex Property")))))); - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", 12345)) - .addProperty(createComplex("PropertyComp", createComplexCollection("CollPropertyComp", Arrays + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", 12345)).addProperty( + createComplex("PropertyComp", createComplexCollection("CollPropertyComp", Arrays .asList(createPrimitive("PropertyInt16", 888), createPrimitive("PropertyString", "11 Test Complex in Complex Property")), Arrays .asList(createPrimitive("PropertyInt16", 999), @@ -236,20 +206,16 @@ public class DataCreator { private EntitySet createESTwoPrim() { EntitySet entitySet = new EntitySetImpl(); - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", 32766)) + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", 32766)) .addProperty(createPrimitive("PropertyString", "Test String1"))); - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", -365)) + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", -365)) .addProperty(createPrimitive("PropertyString", "Test String2"))); - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", -32766)) + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", -32766)) .addProperty(createPrimitive("PropertyString", null))); - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)) + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)) .addProperty(createPrimitive("PropertyString", "Test String4"))); return entitySet; @@ -289,16 +255,11 @@ public class DataCreator { .addProperty(createPrimitive("PropertyGuid", UUID.fromString("76543201-23ab-cdef-0123-456789dddfff"))) .addProperty(createPrimitive("PropertyTimeOfDay", getTime(23, 49, 14)))); - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", 0)) - .addProperty(createPrimitive("PropertyString", "")) - .addProperty(createPrimitive("PropertyBoolean", false)) - .addProperty(createPrimitive("PropertyByte", 0)) - .addProperty(createPrimitive("PropertySByte", 0)) - .addProperty(createPrimitive("PropertyInt32", 0)) - .addProperty(createPrimitive("PropertyInt64", 0)) - .addProperty(createPrimitive("PropertySingle", 0)) - .addProperty(createPrimitive("PropertyDouble", 0)) + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", 0)) + .addProperty(createPrimitive("PropertyString", "")).addProperty(createPrimitive("PropertyBoolean", false)) + .addProperty(createPrimitive("PropertyByte", 0)).addProperty(createPrimitive("PropertySByte", 0)) + .addProperty(createPrimitive("PropertyInt32", 0)).addProperty(createPrimitive("PropertyInt64", 0)) + .addProperty(createPrimitive("PropertySingle", 0)).addProperty(createPrimitive("PropertyDouble", 0)) .addProperty(createPrimitive("PropertyDecimal", 0)) .addProperty(createPrimitive("PropertyBinary", new byte[] {})) .addProperty(createPrimitive("PropertyDate", getDateTime(1970, 1, 1, 0, 0, 0))) @@ -315,24 +276,17 @@ public class DataCreator { Entity entity = new EntityImpl(); entity.addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)); - entity.addProperty(createComplex("PropertyComp", - createPrimitive("PropertyString", "First Resource - first"), + entity.addProperty(createComplex("PropertyComp", createPrimitive("PropertyString", "First Resource - first"), createPrimitive("PropertyBinary", new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }), - createPrimitive("PropertyBoolean", true), - createPrimitive("PropertyByte", 255), + createPrimitive("PropertyBoolean", true), createPrimitive("PropertyByte", 255), createPrimitive("PropertyDate", getDateTime(2012, 10, 3, 0, 0, 0)), createPrimitive("PropertyDateTimeOffset", getTimestamp(2012, 10, 3, 7, 16, 23, 123456700)), - createPrimitive("PropertyDecimal", 34.27), - createPrimitive("PropertySingle", 1.79000000E+20), - createPrimitive("PropertyDouble", -1.7900000000000000E+19), - createPrimitive("PropertyDuration", 6), - createPrimitive("PropertyGuid", GUID), - createPrimitive("PropertyInt16", Short.MAX_VALUE), - createPrimitive("PropertyInt32", Integer.MAX_VALUE), - createPrimitive("PropertyInt64", Long.MAX_VALUE), - createPrimitive("PropertySByte", Byte.MAX_VALUE), - createPrimitive("PropertyTimeOfDay", getTime(1, 0, 1)))); + createPrimitive("PropertyDecimal", 34.27), createPrimitive("PropertySingle", 1.79000000E+20), + createPrimitive("PropertyDouble", -1.7900000000000000E+19), createPrimitive("PropertyDuration", 6), + createPrimitive("PropertyGuid", GUID), createPrimitive("PropertyInt16", Short.MAX_VALUE), + createPrimitive("PropertyInt32", Integer.MAX_VALUE), createPrimitive("PropertyInt64", Long.MAX_VALUE), + createPrimitive("PropertySByte", Byte.MAX_VALUE), createPrimitive("PropertyTimeOfDay", getTime(1, 0, 1)))); entitySet.getEntities().add(entity); entity = new EntityImpl(); @@ -372,10 +326,9 @@ public class DataCreator { private EntitySet createESCollAllPrim() { EntitySet entitySet = new EntitySetImpl(); - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", 1)) - .addProperty(createPrimitiveCollection("CollPropertyString", - "Employee1@company.example", "Employee2@company.example", "Employee3@company.example")) + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", 1)).addProperty( + createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example", + "Employee3@company.example")) .addProperty(createPrimitiveCollection("CollPropertyBoolean", true, false, true)) .addProperty(createPrimitiveCollection("CollPropertyByte", 50, 200, 249)) .addProperty(createPrimitiveCollection("CollPropertySByte", -120, 120, 126)) @@ -383,28 +336,22 @@ public class DataCreator { .addProperty(createPrimitiveCollection("CollPropertyInt32", 23232323, 11223355, 10000001)) .addProperty(createPrimitiveCollection("CollPropertyInt64", 929292929292L, 333333333333L, 444444444444L)) .addProperty(createPrimitiveCollection("CollPropertySingle", 1.79000000E+03, 2.66000000E+04, 3.21000000E+03)) - .addProperty(createPrimitiveCollection("CollPropertyDouble", - -1.7900000000000000E+04, -2.7800000000000000E+07, 3.2100000000000000E+03)) - .addProperty(createPrimitiveCollection("CollPropertyDecimal", 12, -2, 1234)) - .addProperty(createPrimitiveCollection("CollPropertyBinary", - new byte[] { (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }, - new byte[] { 0x01, 0x23, 0x45 }, - new byte[] { 0x54, 0x67, (byte) 0x89 })) - .addProperty(createPrimitiveCollection("CollPropertyDate", - getDateTime(1958, 12, 3, 0, 0, 0), - getDateTime(1999, 8, 5, 0, 0, 0), - getDateTime(2013, 6, 25, 0, 0, 0))) - .addProperty(createPrimitiveCollection("CollPropertyDateTimeOffset", - getDateTime(2015, 8, 12, 3, 8, 34), - getDateTime(1970, 3, 28, 12, 11, 10), - getDateTime(1948, 2, 17, 9, 9, 9))) - .addProperty(createPrimitiveCollection("CollPropertyDuration", 13, 19680, 3600)) - .addProperty(createPrimitiveCollection("CollPropertyGuid", - UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"), - UUID.fromString("eeeeee67-89ab-cdef-0123-456789bbbbbb"), - UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc"))) - .addProperty(createPrimitiveCollection("CollPropertyTimeOfDay", - getTime(4, 14, 13), getTime(23, 59, 59), getTime(1, 12, 33)))); + .addProperty(createPrimitiveCollection("CollPropertyDouble", -1.7900000000000000E+04, -2.7800000000000000E+07, + 3.2100000000000000E+03)).addProperty(createPrimitiveCollection("CollPropertyDecimal", 12, -2, 1234)) + .addProperty( + createPrimitiveCollection("CollPropertyBinary", new byte[] { (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }, new + byte[] { 0x01, 0x23, 0x45 }, + new byte[] { 0x54, 0x67, (byte) 0x89 })).addProperty( + createPrimitiveCollection("CollPropertyDate", getDateTime(1958, 12, 3, 0, 0, 0), + getDateTime(1999, 8, 5, 0, 0, 0), getDateTime(2013, 6, 25, 0, 0, 0))).addProperty( + createPrimitiveCollection("CollPropertyDateTimeOffset", getDateTime(2015, 8, 12, 3, 8, 34), + getDateTime(1970, 3, 28, 12, 11, 10), getDateTime(1948, 2, 17, 9, 9, 9))) + .addProperty(createPrimitiveCollection("CollPropertyDuration", 13, 19680, 3600)).addProperty( + createPrimitiveCollection("CollPropertyGuid", UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"), + UUID.fromString("eeeeee67-89ab-cdef-0123-456789bbbbbb"), + UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc"))).addProperty( + createPrimitiveCollection("CollPropertyTimeOfDay", getTime(4, 14, 13), getTime(23, 59, 59), + getTime(1, 12, 33)))); Entity entity = new EntityImpl(); entity.getProperties().addAll(entitySet.getEntities().get(0).getProperties()); @@ -420,39 +367,31 @@ public class DataCreator { } private EntitySet createESMixPrimCollComp() { - @SuppressWarnings("unchecked") - final Property complexCollection = createComplexCollection("CollPropertyComp", + @SuppressWarnings("unchecked") final Property complexCollection = createComplexCollection("CollPropertyComp", Arrays.asList(createPrimitive("PropertyInt16", 123), createPrimitive("PropertyString", "TEST 1")), Arrays.asList(createPrimitive("PropertyInt16", 456), createPrimitive("PropertyString", "TEST 2")), Arrays.asList(createPrimitive("PropertyInt16", 789), createPrimitive("PropertyString", "TEST 3"))); EntitySet entitySet = new EntitySetImpl(); - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)) - .addProperty(createPrimitiveCollection("CollPropertyString", - "Employee1@company.example", "Employee2@company.example", "Employee3@company.example")) - .addProperty(createComplex("PropertyComp", - createPrimitive("PropertyInt16", 111), - createPrimitive("PropertyString", "TEST A"))) - .addProperty(complexCollection)); - - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", 7)) + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)) .addProperty( createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example", - "Employee3@company.example")) - .addProperty(createComplex("PropertyComp", createPrimitive("PropertyInt16", 222), - createPrimitive("PropertyString", "TEST B"))) - .addProperty(complexCollection)); + "Employee3@company.example")).addProperty( + createComplex("PropertyComp", createPrimitive("PropertyInt16", 111), + createPrimitive("PropertyString", "TEST A"))).addProperty(complexCollection)); - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", 0)) - .addProperty(createPrimitiveCollection("CollPropertyString", "Employee1@company.example", - "Employee2@company.example", "Employee3@company.example")) - .addProperty(createComplex("PropertyComp", createPrimitive("PropertyInt16", 333), - createPrimitive("PropertyString", "TEST C"))) - .addProperty(complexCollection)); + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", 7)).addProperty( + createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example", + "Employee3@company.example")).addProperty( + createComplex("PropertyComp", createPrimitive("PropertyInt16", 222), + createPrimitive("PropertyString", "TEST B"))).addProperty(complexCollection)); + + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16", 0)).addProperty( + createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example", + "Employee3@company.example")).addProperty( + createComplex("PropertyComp", createPrimitive("PropertyInt16", 333), + createPrimitive("PropertyString", "TEST C"))).addProperty(complexCollection)); return entitySet; } @@ -472,19 +411,15 @@ public class DataCreator { .addProperty(createPrimitive("PropertyDuration", 6)).addProperty(createPrimitive("PropertyGuid", GUID)) .addProperty(createPrimitive("PropertyTimeOfDay", getTime(2, 48, 21)))); - entitySet.getEntities().add(new EntityImpl() - .addProperty(createPrimitive("PropertyString", "Second")) - .addProperty(createPrimitive("PropertyBoolean", true)) - .addProperty(createPrimitive("PropertyByte", 254)) - .addProperty(createPrimitive("PropertySByte", 124)) - .addProperty(createPrimitive("PropertyInt16", 32764)) + entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyString", "Second")) + .addProperty(createPrimitive("PropertyBoolean", true)).addProperty(createPrimitive("PropertyByte", 254)) + .addProperty(createPrimitive("PropertySByte", 124)).addProperty(createPrimitive("PropertyInt16", 32764)) .addProperty(createPrimitive("PropertyInt32", 2147483644)) .addProperty(createPrimitive("PropertyInt64", 9223372036854775804L)) .addProperty(createPrimitive("PropertyDecimal", 34)) .addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0))) .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3, 7, 16, 23))) - .addProperty(createPrimitive("PropertyDuration", 6)) - .addProperty(createPrimitive("PropertyGuid", GUID)) + .addProperty(createPrimitive("PropertyDuration", 6)).addProperty(createPrimitive("PropertyGuid", GUID)) .addProperty(createPrimitive("PropertyTimeOfDay", getTime(2, 48, 21)))); return entitySet; @@ -496,8 +431,7 @@ public class DataCreator { Entity entity = new EntityImpl(); entity.addProperty(createPrimitive("PropertyInt16", 1)); entity.addProperty(createComplex("PropertyComp", - createComplex("PropertyComp", - createPrimitive("PropertyInt16", 123), + createComplex("PropertyComp", createPrimitive("PropertyInt16", 123), createPrimitive("PropertyString", "String 1")))); entitySet.getEntities().add(entity); @@ -514,26 +448,22 @@ public class DataCreator { private EntitySet createESMedia() { EntitySet entitySet = new EntitySetImpl(); - Entity entity = new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", 1)) + Entity entity = new EntityImpl().addProperty(createPrimitive("PropertyInt16", 1)) .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("darkturquoise"))); entity.setMediaContentType("image/svg+xml"); entitySet.getEntities().add(entity); - entity = new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", 2)) + entity = new EntityImpl().addProperty(createPrimitive("PropertyInt16", 2)) .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("royalblue"))); entity.setMediaContentType("image/svg+xml"); entitySet.getEntities().add(entity); - entity = new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", 3)) + entity = new EntityImpl().addProperty(createPrimitive("PropertyInt16", 3)) .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("crimson"))); entity.setMediaContentType("image/svg+xml"); entitySet.getEntities().add(entity); - entity = new EntityImpl() - .addProperty(createPrimitive("PropertyInt16", 4)) + entity = new EntityImpl().addProperty(createPrimitive("PropertyInt16", 4)) .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("black"))); entity.setMediaContentType("image/svg+xml"); entitySet.getEntities().add(entity); @@ -545,9 +475,7 @@ public class DataCreator { return ("\n" + "\n" + " \n" - + " \n" - + " \n" - + "\n").getBytes(Charset.forName("UTF-8")); + + " \n" + " \n" + "\n").getBytes(Charset.forName("UTF-8")); } private void linkESTwoPrim(Map data) { @@ -566,8 +494,8 @@ public class DataCreator { setLinks(entitySet.getEntities().get(0), "NavPropertyETTwoPrimMany", targetEntities.get(1)); setLink(entitySet.getEntities().get(0), "NavPropertyETTwoPrimOne", targetEntities.get(3)); - setLinks(entitySet.getEntities().get(2), "NavPropertyETTwoPrimMany", - targetEntities.get(0), targetEntities.get(2), targetEntities.get(3)); + setLinks(entitySet.getEntities().get(2), "NavPropertyETTwoPrimMany", targetEntities.get(0), targetEntities.get(2), + targetEntities.get(3)); } private void linkESKeyNav(Map data) { @@ -613,12 +541,9 @@ public class DataCreator { setLink(entitySet.getEntities().get(3), "NavPropertyETKeyNavOne", esKeyNavTargets.get(2)); // NavPropertyETKeyNavMany - setLinks(entitySet.getEntities().get(0), "NavPropertyETKeyNavMany", - esKeyNavTargets.get(0), esKeyNavTargets.get(1)); - setLinks(entitySet.getEntities().get(1), "NavPropertyETKeyNavMany", - esKeyNavTargets.get(0), esKeyNavTargets.get(1)); - setLinks(entitySet.getEntities().get(2), "NavPropertyETKeyNavMany", - esKeyNavTargets.get(1), esKeyNavTargets.get(2)); + setLinks(entitySet.getEntities().get(0), "NavPropertyETKeyNavMany", esKeyNavTargets.get(0), esKeyNavTargets.get(1)); + setLinks(entitySet.getEntities().get(1), "NavPropertyETKeyNavMany", esKeyNavTargets.get(0), esKeyNavTargets.get(1)); + setLinks(entitySet.getEntities().get(2), "NavPropertyETKeyNavMany", esKeyNavTargets.get(1), esKeyNavTargets.get(2)); // NavPropertyETTwoKeyNavOne setLink(entitySet.getEntities().get(0), "NavPropertyETTwoKeyNavOne", esTwoKeyNavTargets.get(0)); @@ -626,8 +551,8 @@ public class DataCreator { setLink(entitySet.getEntities().get(3), "NavPropertyETTwoKeyNavOne", esTwoKeyNavTargets.get(2)); // NavPropertyETTwoKeyNavMany - setLinks(entitySet.getEntities().get(0), "NavPropertyETTwoKeyNavMany", - esTwoKeyNavTargets.get(0), esTwoKeyNavTargets.get(1)); + setLinks(entitySet.getEntities().get(0), "NavPropertyETTwoKeyNavMany", esTwoKeyNavTargets.get(0), + esTwoKeyNavTargets.get(1)); setLinks(entitySet.getEntities().get(1), "NavPropertyETTwoKeyNavMany", esTwoKeyNavTargets.get(0)); setLinks(entitySet.getEntities().get(2), "NavPropertyETTwoKeyNavMany", esTwoKeyNavTargets.get(1)); } @@ -640,6 +565,10 @@ public class DataCreator { return new PropertyImpl(null, name, ValueType.COLLECTION_PRIMITIVE, Arrays.asList(values)); } + protected static Property createComplex(final String name, String type, final Property... properties) { + return createComplex(name, properties); + } + protected static Property createComplex(final String name, final Property... properties) { ComplexValue complexValue = new ComplexValueImpl(); for (final Property property : properties) { @@ -648,6 +577,11 @@ public class DataCreator { return new PropertyImpl(null, name, ValueType.COMPLEX, complexValue); } + protected static Property createComplexCollection(final String name, String type, final List... + propertiesList) { + return createComplexCollection(name, propertiesList); + } + protected static Property createComplexCollection(final String name, final List... propertiesList) { List complexCollection = new ArrayList(); for (final List properties : propertiesList) { diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java index 43183535f..64263274a 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java @@ -49,9 +49,12 @@ public class ActionProvider { public static final FullQualifiedName nameBAETTwoKeyNavRTETTwoKeyNav = new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETTwoKeyNavRTETTwoKeyNav"); - public static final FullQualifiedName nameBAETAllPrimRT = + public static final FullQualifiedName nameBAESAllPrimRT = new FullQualifiedName(SchemaProvider.NAMESPACE, "BAESAllPrimRT"); + public static final FullQualifiedName nameBAETAllPrimRT = + new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETAllPrimRT"); + // Unbound Actions public static final FullQualifiedName nameUARTString = new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTString"); @@ -75,76 +78,70 @@ public class ActionProvider { public static final FullQualifiedName nameUARTTwoParam = new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTTwoParam"); + public List getActions(final FullQualifiedName actionName) throws ODataException { if (actionName.equals(nameUARTString)) { - return Arrays.asList( - new Action().setName(nameUARTString.getName()) - .setReturnType(new ReturnType().setType(PropertyProvider.nameString)) - ); + return Collections.singletonList( + new Action().setName(nameUARTString.getName()) + .setReturnType(new ReturnType().setType(PropertyProvider.nameString))); + } else if (actionName.equals(nameUARTCollStringTwoParam)) { - return Arrays.asList( - new Action().setName(nameUARTCollStringTwoParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16), - new Parameter().setName("ParameterDuration").setType(PropertyProvider.nameDuration))) - .setReturnType(new ReturnType().setType(PropertyProvider.nameString).setCollection(true)) - ); + return Collections.singletonList( + new Action().setName(nameUARTCollStringTwoParam.getName()) + .setParameters(Arrays.asList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16), + new Parameter().setName("ParameterDuration").setType(PropertyProvider.nameDuration))) + .setReturnType(new ReturnType().setType(PropertyProvider.nameString).setCollection(true))); } else if (actionName.equals(nameUARTCTTwoPrimParam)) { - return Arrays.asList( - new Action().setName(nameUARTCTTwoPrimParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16) - .setNullable(false))) - .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false)) - ); - + return Collections.singletonList( + new Action().setName(nameUARTCTTwoPrimParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16) + .setNullable(false))) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))); + } else if (actionName.equals(nameUARTCollCTTwoPrimParam)) { - return Arrays.asList( - new Action().setName(nameUARTCollCTTwoPrimParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) - .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true)) - ); + return Collections.singletonList( + new Action().setName(nameUARTCollCTTwoPrimParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))); } else if (actionName.equals(nameUARTETTwoKeyTwoPrimParam)) { - return Arrays.asList( - new Action().setName(nameUARTETTwoKeyTwoPrimParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) - .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim)) - ); + return Collections.singletonList( + new Action().setName(nameUARTETTwoKeyTwoPrimParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim))); } else if (actionName.equals(nameUARTCollETKeyNavParam)) { - return Arrays.asList( - new Action().setName(nameUARTCollETKeyNavParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) - .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true)) - ); + return Collections.singletonList( + new Action().setName(nameUARTCollETKeyNavParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))); } else if (actionName.equals(nameUARTETAllPrimParam)) { - return Arrays.asList( - new Action().setName(nameUARTETAllPrimParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterDate").setType(PropertyProvider.nameDate))) - .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETAllPrim)) - ); + return Collections.singletonList( + new Action().setName(nameUARTETAllPrimParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterDate").setType(PropertyProvider.nameDate))) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETAllPrim))); } else if (actionName.equals(nameUARTCollETAllPrimParam)) { - return Arrays.asList( - new Action().setName(nameUARTCollETAllPrimParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterTimeOfDay") - .setType(PropertyProvider.nameTimeOfDay))) - .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true)) - ); + return Collections.singletonList( + new Action().setName(nameUARTCollETAllPrimParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterTimeOfDay") + .setType(PropertyProvider.nameTimeOfDay))) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true))); } else if (actionName.equals(nameUART)) { return Collections.singletonList(new Action().setName(nameUART.getName())); @@ -186,26 +183,22 @@ public class ActionProvider { } else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) { return Arrays.asList( new Action().setName("BAESAllPrimRTETAllPrim") - .setParameters( - Arrays.asList( - new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim) - .setCollection(true).setNullable(false))) + .setParameters(Arrays.asList( + new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim) + .setCollection(true).setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETAllPrim)) - ); + new ReturnType().setType(EntityTypeProvider.nameETAllPrim))); } else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) { return Arrays.asList( new Action().setName("BAESTwoKeyNavRTESTwoKeyNav") - .setParameters( - Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true).setNullable(false))) + .setParameters(Arrays.asList( + new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) - ); + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))); } else if(actionName.equals(nameBAESTwoKeyNavRTESKeyNav)) { return Arrays.asList( @@ -214,12 +207,12 @@ public class ActionProvider { .setEntitySetPath("BindingParam/NavPropertyETKeyNavMany") .setParameters(Arrays.asList( new Parameter().setName("ParameterETTwoKeyNav") - .setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true) - .setNullable(false) - )) - .setReturnType(new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true)) - ); + .setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true) + .setNullable(false))) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))); + } else if (actionName.equals(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)) { return Arrays.asList( new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav") @@ -228,20 +221,19 @@ public class ActionProvider { .setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) - ); + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))); } else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) { return Arrays.asList( new Action().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav") - .setParameters( - Arrays.asList( - new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType( - EntityTypeProvider.nameETTwoBaseTwoKeyNav).setNullable(false))) + .setParameters(Arrays.asList( + new Parameter().setName("ParameterETTwoBaseTwoKeyNav") + .setType(EntityTypeProvider.nameETTwoBaseTwoKeyNav) + .setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav)) - ); + new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav))); + } else if(actionName.equals(nameBAETAllPrimRT)) { return Arrays.asList( new Action().setName("BAETAllPrimRT") @@ -250,17 +242,19 @@ public class ActionProvider { new Parameter().setName("ParameterETAllPrim") .setNullable(false) .setType(EntityTypeProvider.nameETAllPrim) - )), - new Action().setName("BAETAllPrimRT") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterETAllPrim") - .setNullable(false) - .setCollection(true) - .setType(EntityTypeProvider.nameETAllPrim) - )) - ); - } + ))); + } else if(actionName.equals(nameBAESAllPrimRT)) { + return Arrays.asList( + new Action().setName("BAESAllPrimRT") + .setBound(true) + .setParameters(Arrays.asList( + new Parameter().setName("ParameterETAllPrim") + .setNullable(false) + .setCollection(true) + .setType(EntityTypeProvider.nameETAllPrim) + )) + ); + } return null; } diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java index 12cdb6f14..9b982aa22 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java @@ -98,7 +98,9 @@ public class ContainerProvider { entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompMixPrimCollComp")); entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESFourKeyAlias")); entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMixEnumDefCollComp")); - + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoBaseTwoKeyNav")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESKeyNavCont")); + // Singletons List singletons = new ArrayList(); container.setSingletons(singletons); @@ -135,6 +137,7 @@ public class ContainerProvider { functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTAllPrimTwoParam")); functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTESMixPrimCollCompTwoParam")); functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollETMixPrimCollCompTwoParam")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINRTCollETMixPrimCollCompTwoParam")); functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollCTTwoPrim")); functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTESMedia")); functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollESMedia")); @@ -144,7 +147,9 @@ public class ContainerProvider { functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTString")); functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollESTwoKeyNavParam")); functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollCTTwoPrimParam")); - + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINRTCollCTNavFiveProp")); + functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollESKeyNavContParam")); + return container; } @@ -363,9 +368,6 @@ public class ContainerProvider { new NavigationPropertyBinding() .setPath("CollPropertyCompNav/NavPropertyETMediaMany") .setTarget("ESMedia"), - new NavigationPropertyBinding() - .setPath("CollPropertyCompNav/NavPropertyETTwoKeyNavMany") - .setTarget("ESTwoKeyNav"), new NavigationPropertyBinding() .setPath("NavPropertyETTwoBaseTwoKeyNavOne") .setTarget("ESBaseTwoKeyNav"), @@ -563,7 +565,13 @@ public class ContainerProvider { .setName(name) .setFunction(FunctionProvider.nameUFCRTESMixPrimCollCompTwoParam) .setIncludeInServiceDocument(true); - + + } else if(name.equals("FINRTCollETMixPrimCollCompTwoParam")) { + return new FunctionImport() + .setName(name) + .setFunction(FunctionProvider.nameUFNRTCollETMixPrimCollCompTwoParam) + .setIncludeInServiceDocument(true); + } else if (name.equals("FICRTCollETMixPrimCollCompTwoParam")) { return new FunctionImport() .setName(name) @@ -625,10 +633,22 @@ public class ContainerProvider { .setName(name) .setFunction(FunctionProvider.nameUFCRTCollCTTwoPrimParam) .setIncludeInServiceDocument(true); - + + } else if(name.equals("FINRTCollCTNavFiveProp")) { + return new FunctionImport() + .setName(name) + .setFunction(FunctionProvider.nameUFNRTCollCTNavFiveProp) + .setIncludeInServiceDocument(true); + + } else if(name.equals("FICRTCollESKeyNavContParam")) { + return new FunctionImport() + .setName(name) + .setFunction(FunctionProvider.nameUFCRTCollETKeyNavContParam) + .setEntitySet("ESKeyNavCont") + .setIncludeInServiceDocument(true); } } - + return null; } diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/FunctionProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/FunctionProvider.java index 84f57ff52..bcf08633a 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/FunctionProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/FunctionProvider.java @@ -176,6 +176,9 @@ public class FunctionProvider { public static final FullQualifiedName nameUFNRTCollCTNavFiveProp = new FullQualifiedName(SchemaProvider.NAMESPACE, "UFNRTCollCTNavFiveProp"); + public static final FullQualifiedName nameUFNRTCollETMixPrimCollCompTwoParam + = new FullQualifiedName(SchemaProvider.NAMESPACE, "UFNRTCollETMixPrimCollCompTwoParam"); + public List getFunctions(final FullQualifiedName functionName) throws ODataException { if (functionName.equals(nameUFNRTInt16)) { @@ -332,6 +335,20 @@ public class FunctionProvider { new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim).setNullable(false)) ); + } else if(functionName.equals(nameUFNRTCollETMixPrimCollCompTwoParam)) { + return Arrays.asList( + new Function() + .setName("UFNRTCollETMixPrimCollCompTwoParam") + .setParameters(Arrays.asList( + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false), + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false))) + .setComposable(false) + .setBound(false) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTMixPrimCollComp) + .setNullable(false) + .setCollection(true)) + ); } else if (functionName.equals(nameUFCRTCTTwoPrimParam)) { return Arrays.asList( new Function() @@ -855,7 +872,7 @@ public class FunctionProvider { Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) .setCollection(true).setNullable(false), - new Parameter().setName("ParameterComplex").setType(ComplexTypeProvider.nameCTTwoPrim) + new Parameter().setName("ParameterComp").setType(ComplexTypeProvider.nameCTTwoPrim) .setNullable(false))) .setComposable(true) .setReturnType( diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java index ff2ad6507..07fbd25b3 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java @@ -733,7 +733,7 @@ public class PropertyProvider { .setType(EntityTypeProvider.nameETKeyNav); public static final NavigationProperty navPropertyETTwoKeyNavContOneCT_ETTwoKeyNav = new NavigationProperty() - .setName("NavPropertyETKeyNavContOne") + .setName("NavPropertyETTwoKeyNavContOne") .setContainsTarget(true) .setType(EntityTypeProvider.nameETTwoKeyNav); diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java index ad3693cfa..b8e5ad386 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java @@ -185,6 +185,7 @@ public class SchemaProvider { functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTStringParam)); functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESKeyNavRTETKeyNavParam)); functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTETTwoKeyNavParam)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFNRTCollETMixPrimCollCompTwoParam)); // functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESTwoKeyNavParam)); // EntityContainer diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java index 80668eb10..58777abc9 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java @@ -57,6 +57,29 @@ public class ODataJsonDeserializerActionParametersTest extends AbstractODataDese assertEquals(BigDecimal.valueOf(3669753), parameter.getValue()); } + @Test + public void boundEmpty() throws Exception { + final String input = "{}"; + final List parameters = deserialize(input, "BAETAllPrimRT", "ETAllPrim"); + assertNotNull(parameters); + assertTrue(parameters.isEmpty()); + } + + @Test(expected = DeserializerException.class) + public void bindingParameter() throws Exception { + deserialize("{\"ParameterETAllPrim\":{\"PropertyInt16\":42}}", "BAETAllPrimRT", "ETAllPrim"); + } + + @Test(expected = DeserializerException.class) + public void wrongName() throws Exception { + deserialize("{\"ParameterWrong\":null}", "UARTParam"); + } + + @Test(expected = DeserializerException.class) + public void nullNotNullable() throws Exception { + deserialize("{\"ParameterInt16\":null}", "UARTCTTwoPrimParam"); + } + @Test(expected = DeserializerException.class) public void missingParameter() throws Exception { deserialize("{}", "UARTCTTwoPrimParam"); @@ -77,4 +100,12 @@ public class ODataJsonDeserializerActionParametersTest extends AbstractODataDese .actionParameters(new ByteArrayInputStream(input.getBytes()), edm.getUnboundAction(new FullQualifiedName("Namespace1_Alias", actionName))); } + + private List deserialize(final String input, final String actionName, final String typeName) + throws DeserializerException { + return OData.newInstance().createDeserializer(ODataFormat.JSON) + .actionParameters(new ByteArrayInputStream(input.getBytes()), + edm.getBoundAction(new FullQualifiedName("Namespace1_Alias", actionName), + new FullQualifiedName("Namespace1_Alias", typeName), false)); + } } diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java index f5304566d..4d67fcdca 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java @@ -286,7 +286,7 @@ public class FilterValidator implements TestValidator { * Validates the serialized filterTree against a given filterString * The given expected filterString is compressed before to allow better readable code in the unit tests * @param toBeCompr - * @return + * @return {@link FilterValidator} */ public FilterValidator isCompr(final String toBeCompr) { return is(compress(toBeCompr)); diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java index aeb130969..da65ff029 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java @@ -57,7 +57,7 @@ public class ParserValidator { * Used in fast LL Parsing: * Don't stop the parsing process when the slower full context parsing (with prediction mode SLL) is * required - * @return + * @return {@link ParserValidator} */ public ParserValidator aFC() { allowFullContext = true; @@ -68,7 +68,7 @@ public class ParserValidator { * Used in fast LL Parsing: * Allows ContextSensitifity Errors which occur often when using the slower full context parsing * and indicate that there is a context sensitivity ( which may not be an error). - * @return + * @return {@link ParserValidator} */ public ParserValidator aCS() { allowContextSensitifity = true; @@ -78,7 +78,7 @@ public class ParserValidator { /** * Used in fast LL Parsing: * Allows ambiguities - * @return + * @return {@link ParserValidator} */ public ParserValidator aAM() { allowAmbiguity = true;