Repository: olingo-odata4 Updated Branches: refs/heads/master c0e032d48 -> 08ffd2019
[OLINGO-659] Fix URIResource toString() ,methods Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/08ffd201 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/08ffd201 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/08ffd201 Branch: refs/heads/master Commit: 08ffd20199777f5d1c6e3266d3eeedf83b5daad8 Parents: c0e032d Author: Christian Amend <[email protected]> Authored: Fri Aug 21 16:03:06 2015 +0200 Committer: Christian Amend <[email protected]> Committed: Fri Aug 21 16:03:40 2015 +0200 ---------------------------------------------------------------------- .../org/apache/olingo/server/api/OData.java | 7 +++- .../server/api/ODataApplicationException.java | 17 +++++++-- .../apache/olingo/server/api/ODataRequest.java | 2 +- .../olingo/server/api/ODataServerError.java | 2 +- .../server/api/etag/PreconditionException.java | 3 ++ .../api/etag/ServiceMetadataETagSupport.java | 3 ++ .../apache/olingo/server/api/package-info.java | 37 ++++++++++++++++++++ .../server/api/processor/package-info.java | 34 ++++++++++++++++++ .../serializer/BatchSerializerException.java | 3 ++ .../serializer/ReferenceSerializerOptions.java | 3 ++ .../apache/olingo/server/api/uri/UriInfo.java | 36 +++++++++++++++++++ .../olingo/server/api/uri/UriResource.java | 11 ++++-- .../server/api/uri/UriResourcePartTyped.java | 5 +++ .../olingo/server/api/uri/package-info.java | 28 +++++++++++++++ .../server/core/uri/UriResourceActionImpl.java | 14 ++++++-- .../uri/UriResourceComplexPropertyImpl.java | 7 +++- .../server/core/uri/UriResourceCountImpl.java | 7 +++- .../core/uri/UriResourceEntitySetImpl.java | 8 ++++- .../core/uri/UriResourceFunctionImpl.java | 7 +++- .../server/core/uri/UriResourceItImpl.java | 7 +++- .../core/uri/UriResourceLambdaAllImpl.java | 7 +++- .../core/uri/UriResourceLambdaAnyImpl.java | 7 +++- .../core/uri/UriResourceLambdaVarImpl.java | 7 +++- .../uri/UriResourceNavigationPropertyImpl.java | 7 +++- .../uri/UriResourcePrimitivePropertyImpl.java | 7 +++- .../server/core/uri/UriResourceRefImpl.java | 6 +++- .../server/core/uri/UriResourceRootImpl.java | 7 +++- .../core/uri/UriResourceSingletonImpl.java | 7 +++- .../uri/UriResourceStartingTypeFilterImpl.java | 7 +++- .../server/core/uri/UriResourceTypedImpl.java | 14 +++++--- .../server/core/uri/UriResourceValueImpl.java | 7 +++- .../core/uri/UriResourceWithKeysImpl.java | 12 ++++--- .../server/core/uri/UriResourceImplTest.java | 12 ++++++- 33 files changed, 314 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java index c8e5eee..f21cfb5 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java @@ -48,6 +48,10 @@ public abstract class OData { private static final String IMPLEMENTATION = "org.apache.olingo.server.core.ODataImpl"; + /** + * Use this method to create a new OData instance. Each thread/request should keep its own instance. + * @return a new OData instance + */ public static OData newInstance() { try { final Class<?> clazz = Class.forName(OData.IMPLEMENTATION); @@ -74,7 +78,8 @@ public abstract class OData { public abstract ODataSerializer createSerializer(ContentType contentType) throws SerializerException; /** - * Creates a new serializer object for rendering content in a fixed format, e.g., for binary output. + * Creates a new serializer object for rendering content in a fixed format, e.g., for binary output or multipart/mixed + * outpu. * Serializers are used in Processor implementations. */ public abstract FixedFormatSerializer createFixedFormatSerializer(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java index 15e600e..3e92820 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -97,14 +97,27 @@ public class ODataApplicationException extends ODataException { this.oDataErrorCode = oDataErrorCode; } + /** + * Will return the status code which will be used as a status code for the HTTP response. If not set the default is a + * 500 Internal Server Error. + * @return status code for this exception + */ public int getStatusCode() { return statusCode; } + /** + * Returns the Locale which was used for the error message. The default is null. + * @return locale used for the error message + */ public Locale getLocale() { return locale; } + /** + * This method will return the error code specified by the application. The default is null. + * @return the applications error code. + */ public String getODataErrorCode() { return oDataErrorCode; } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java index 669e069..7e806ea 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java @@ -231,7 +231,7 @@ public class ODataRequest { /** * Sets the HTTP protocol used - * @param 2protocol + * @param protocol * @see #getProtocol() */ public void setProtocol(String protocol) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java index 5e74af9..b9c6dcb 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java @@ -26,7 +26,7 @@ import org.apache.olingo.commons.api.ex.ODataError; import org.apache.olingo.commons.api.ex.ODataErrorDetail; /** - * Server error. + * Class to hold all server relevant error information. */ public class ODataServerError extends ODataError { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/PreconditionException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/PreconditionException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/PreconditionException.java index 8e9c84f..efa606c 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/PreconditionException.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/PreconditionException.java @@ -20,6 +20,9 @@ package org.apache.olingo.server.api.etag; import org.apache.olingo.server.api.ODataLibraryException; +/** + * This exception is thrown for invalid precondition error cases. + */ public class PreconditionException extends ODataLibraryException { private static final long serialVersionUID = -8112658467394158700L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/ServiceMetadataETagSupport.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/ServiceMetadataETagSupport.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/ServiceMetadataETagSupport.java index 76e60f2..430fce5 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/ServiceMetadataETagSupport.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/ServiceMetadataETagSupport.java @@ -18,6 +18,9 @@ */ package org.apache.olingo.server.api.etag; +/** + * Register implementations for this interface in oder to support etags for the metadata document and service document. + */ public interface ServiceMetadataETagSupport { /** http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/package-info.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/package-info.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/package-info.java new file mode 100644 index 0000000..2cdb677 --- /dev/null +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/package-info.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +/** + * Olingo Server API + * <p> + * OData Library is a protocol implementation of the OData V4.0 standard. For details of this standard + * see <a href="http://odata.org">odata.org</a>. + * <p> + * This API is intended to help implement an OData service. An OData service consists of a metadata provider + * implementation and an OData processor implementation. + * <p> + * An OData service can be exposed by a web application using the standard java servlet API. See the Olingo tutorials + * section on how to implement a V4 service for further information: + * <a href="http://olingo.apache.org/doc/odata4/index.html">http://olingo.apache.org/doc/odata4/index.html + * <p> + * The main entry point is the org.apache.olingo.server.api.OData class. Use the newInstance() method to create a new + * object and start providing your service from there. + * + */ +package org.apache.olingo.server.api; + http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/package-info.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/package-info.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/package-info.java new file mode 100644 index 0000000..bc21fd0 --- /dev/null +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/package-info.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +/** + * Olingo Processors + * <p> + * Processors are used to handle OData requests and send back the OData reponse. Before a specific processor is called + * the Olingo library will parse the URI and validate it. Afterwards the Processor which matches the return type is + * called. E.g.: If a primitive property is requested by the URI we will call the PrimitveProcessor.read method. + * <p> + * Processors can be registered at the {@link org.apache.olingo.server.api.ODataHttpHandler} object. Per default we will + * have the {@link org.apache.olingo.server.api.processor.DefaultProcessor} registered to perform basic functionality + * like delivering the metadata and service document as well as rendering an OData error. + * <br>In case an application would like to perform custom tasks for these cases a new + * {@link org.apache.olingo.server.api.processor.ServiceDocumentProcessor} can be registered in order to overwrite the + * default behaviour. + */ +package org.apache.olingo.server.api.processor; + http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/BatchSerializerException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/BatchSerializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/BatchSerializerException.java index fe37950..ddef3ae 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/BatchSerializerException.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/BatchSerializerException.java @@ -19,6 +19,9 @@ package org.apache.olingo.server.api.serializer; +/** + * Thrown for invalid batch payloads. + */ public class BatchSerializerException extends SerializerException { private static final long serialVersionUID = 2634433974342796905L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java index 189367a..e3a82cc 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java @@ -20,6 +20,9 @@ package org.apache.olingo.server.api.serializer; import org.apache.olingo.commons.api.data.ContextURL; +/** + * Use this options calls to pass additional information to the reference serializer. + */ public final class ReferenceSerializerOptions { private ContextURL contextURL; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.java index ead6113..d12c524 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.java @@ -31,21 +31,57 @@ public interface UriInfo extends UriInfoService, UriInfoAll, UriInfoBatch, UriInfoCrossjoin, UriInfoEntityId, UriInfoMetadata, UriInfoResource { + /** + * See {@link UriInfoKind} for more details which kinds are allowed. + * @return the kind of this URI info object. + */ UriInfoKind getKind(); + /** + * Convenience casting method. + * @return this as a {@link UriInfoService} object + */ UriInfoService asUriInfoService(); + /** + * Convenience casting method. + * @return this as a {@link UriInfoAll} object + */ UriInfoAll asUriInfoAll(); + /** + * Convenience casting method. + * @return this as a {@link UriInfoBatch} object + */ UriInfoBatch asUriInfoBatch(); + /** + * Convenience casting method. + * @return this as a {@link UriInfoCrossjoin} object + */ UriInfoCrossjoin asUriInfoCrossjoin(); + /** + * Convenience casting method. + * @return this as a {@link UriInfoEntityId} object + */ UriInfoEntityId asUriInfoEntityId(); + /** + * Convenience casting method. + * @return this as a {@link UriInfoMetadata} object + */ UriInfoMetadata asUriInfoMetadata(); + /** + * Convenience casting method. + * @return this as a {@link UriInfoResource} object + */ UriInfoResource asUriInfoResource(); + /** + * A collection of all system query options which were in the URI. + * @return a collection of all system query options used. + */ Collection<SystemQueryOption> getSystemQueryOptions(); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java index acafa57..016cbcb 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -29,6 +29,13 @@ public interface UriResource { */ UriResourceKind getKind(); + /** + * In case of an EntitySet this method will return the EntitySet name. In Case of $ref this method will return '$ref" + * as a String. + * @return the value of this URI Resource Segment + */ + String getSegmentValue(); + @Override String toString(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java index 5ff183c..407623e 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java @@ -38,6 +38,11 @@ public interface UriResourcePartTyped extends UriResource { /** * @return String representation of the type */ + public String getSegmentValue(final boolean includeFilters); + + /** + * @return String representation of the type + */ String toString(boolean includeFilters); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/package-info.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/package-info.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/package-info.java new file mode 100644 index 0000000..2a0aab6 --- /dev/null +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/package-info.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +/** + * Olingo URI + * <p> + * The URI package is used to condense all information about the OData path used to query the data. + * <br> In order to support filter and orderby statements the + * {@link org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor} has to be implemented by an + * application. + */ +package org.apache.olingo.server.api.uri; + http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java index 6acb6ea..008d693 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java @@ -74,14 +74,24 @@ public class UriResourceActionImpl extends UriResourceImpl implements UriResourc } return null; } + + @Override + public String getSegmentValue(final boolean includeFilters){ + return actionImport == null ? (action == null ? "" : action.getName()) : actionImport.getName(); + } @Override + public String getSegmentValue(){ + return getSegmentValue(false); + } + + @Override public String toString(final boolean includeFilters) { - return actionImport == null ? (action == null ? "" : action.getName()) : actionImport.getName(); + return getSegmentValue(includeFilters); } @Override public String toString() { - return toString(false); + return getSegmentValue(); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java index f7a8502..63db69c 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java @@ -63,8 +63,13 @@ public class UriResourceComplexPropertyImpl extends UriResourceTypedImpl impleme } @Override - public String toString() { + public String getSegmentValue(){ return property.getName(); } + + @Override + public String toString() { + return getSegmentValue(); + } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java index 14f43ec..e1859a6 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java @@ -26,10 +26,15 @@ public class UriResourceCountImpl extends UriResourceImpl implements UriResource public UriResourceCountImpl() { super(UriResourceKind.count); } + + @Override + public String getSegmentValue(){ + return "$count"; + } @Override public String toString() { - return "$count"; + return getSegmentValue(); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java index a769ad6..4675964 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java @@ -55,9 +55,15 @@ public class UriResourceEntitySetImpl extends UriResourceWithKeysImpl implements public boolean isCollection() { return keyPredicates == null; } + + @Override + public String getSegmentValue(){ + return edmEntitySet.getName(); + } + @Override public String toString() { - return edmEntitySet.getName(); + return getSegmentValue(); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java index 6f23d23..072230e 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java @@ -95,7 +95,7 @@ public class UriResourceFunctionImpl extends UriResourceWithKeysImpl implements } @Override - public String toString() { + public String getSegmentValue(){ if (functionImport != null) { return functionImport.getName(); } else if (function != null) { @@ -103,6 +103,11 @@ public class UriResourceFunctionImpl extends UriResourceWithKeysImpl implements } return ""; } + + @Override + public String toString() { + return getSegmentValue(); + } public boolean isParameterListFilled() { return isParameterListFilled; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java index b28ddf8..fc31910 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java @@ -56,10 +56,15 @@ public class UriResourceItImpl extends UriResourceWithKeysImpl implements UriRes this.isCollection = isCollection; return this; } + + @Override + public String getSegmentValue(){ + return "$it"; + } @Override public String toString() { - return "$it"; + return getSegmentValue(); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java index 08f0347..b57d12c 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java @@ -68,10 +68,15 @@ public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements Ur this.expression = expression; return this; } + + @Override + public String getSegmentValue(){ + return "all"; + } @Override public String toString() { - return "all"; + return getSegmentValue(); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java index 81059dd..49be2fe 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java @@ -68,9 +68,14 @@ public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements Ur this.expression = expression; return this; } + + @Override + public String getSegmentValue(){ + return "any"; + } @Override public String toString() { - return "any"; + return getSegmentValue(); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java index f71fe04..f7fa6fc 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java @@ -64,7 +64,12 @@ public class UriResourceLambdaVarImpl extends UriResourceTypedImpl implements Ur } @Override - public String toString() { + public String getSegmentValue(){ return variableText; } + + @Override + public String toString() { + return getSegmentValue(); + } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java index 3da7aef..1a4fa44 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java @@ -54,10 +54,15 @@ public class UriResourceNavigationPropertyImpl extends UriResourceWithKeysImpl i } return navigationProperty.isCollection(); } + + @Override + public String getSegmentValue(){ + return navigationProperty.getName(); + } @Override public String toString() { - return navigationProperty.getName(); + return getSegmentValue(); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java index d599b9b..d470ef4 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java @@ -50,10 +50,15 @@ public class UriResourcePrimitivePropertyImpl extends UriResourceTypedImpl imple public boolean isCollection() { return property.isCollection(); } + + @Override + public String getSegmentValue(){ + return property.getName(); + } @Override public String toString() { - return property.getName(); + return getSegmentValue(); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java index a0cdc3e..0c45f9a 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java @@ -27,10 +27,14 @@ public class UriResourceRefImpl extends UriResourceImpl implements UriResourceRe super(UriResourceKind.ref); } + @Override + public String getSegmentValue(){ + return "$ref"; + } @Override public String toString() { - return "$ref"; + return getSegmentValue(); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java index 0db0a01..5d8737f 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java @@ -53,10 +53,15 @@ public class UriResourceRootImpl extends UriResourceWithKeysImpl implements UriR this.isCollection = isCollection; return this; } + + @Override + public String getSegmentValue(){ + return "$root"; + } @Override public String toString() { - return "$root"; + return getSegmentValue(); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java index cc9c606..72289f6 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java @@ -62,10 +62,15 @@ public class UriResourceSingletonImpl extends UriResourceTypedImpl implements Ur public boolean isCollection() { return false; } + + @Override + public String getSegmentValue(){ + return singleton.getName(); + } @Override public String toString() { - return singleton.getName(); + return getSegmentValue(); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java index 152f44c..24d3713 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java @@ -59,8 +59,13 @@ public class UriResourceStartingTypeFilterImpl extends UriResourceWithKeysImpl { } @Override - public String toString() { + public String getSegmentValue(){ return type.getNamespace() + "." + type.getName(); } + + @Override + public String toString() { + return getSegmentValue(); + } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java index cef7098..d6710ad 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java @@ -40,15 +40,19 @@ public abstract class UriResourceTypedImpl extends UriResourceImpl implements Ur return this; } - @Override - public String toString(final boolean includeFilters) { + public String getSegmentValue(final boolean includeFilters) { if (includeFilters) { if (typeFilter != null) { - return toString() + "/" + typeFilter.getFullQualifiedName().toString(); + return getSegmentValue() + "/" + typeFilter.getFullQualifiedName().toString(); } else { - return toString(); + return getSegmentValue(); } } - return toString(); + return getSegmentValue(); + } + + @Override + public String toString(final boolean includeFilters) { + return getSegmentValue(includeFilters); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java index 7611ecb..73f86c4 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java @@ -29,8 +29,13 @@ public class UriResourceValueImpl extends UriResourceImpl implements UriResource } @Override - public String toString() { + public String getSegmentValue(){ return "$value"; } + @Override + public String toString() { + return getSegmentValue(); + } + } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java index 320ad0d..2e7fdb5 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java @@ -71,8 +71,7 @@ public abstract class UriResourceWithKeysImpl extends UriResourceImpl implements } @Override - public String toString(final boolean includeFilters) { - + public String getSegmentValue(final boolean includeFilters) { if (includeFilters) { StringBuilder tmp = new StringBuilder(); if (collectionTypeFilter != null) { @@ -88,11 +87,16 @@ public abstract class UriResourceWithKeysImpl extends UriResourceImpl implements } if (tmp.length() != 0) { - return toString() + "/" + tmp.toString(); + return getSegmentValue() + "/" + tmp.toString(); } } - return toString(); + return getSegmentValue(); + } + + @Override + public String toString(final boolean includeFilters) { + return getSegmentValue(includeFilters); } private String getFQN(final EdmType type) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/08ffd201/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java ---------------------------------------------------------------------- diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java index e9f16ea..cad1458 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java @@ -267,6 +267,11 @@ public class UriResourceImplTest { @Override public String toString() { + return getSegmentValue(); + } + + @Override + public String getSegmentValue() { return "mock"; } } @@ -342,10 +347,15 @@ public class UriResourceImplTest { this.type = type; return this; } + + @Override + public String getSegmentValue() { + return "mock"; + } @Override public String toString() { - return "mock"; + return getSegmentValue(); } }
