Repository: olingo-odata4 Updated Branches: refs/heads/master 5c28df507 -> 5fb2b80e4
Enhancing the FunctionImport invoke API enhancement Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/5fb2b80e Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/5fb2b80e Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/5fb2b80e Branch: refs/heads/master Commit: 5fb2b80e404e6a65ff1d0dcfabaefbbdd182b0c6 Parents: 5c28df5 Author: Francesco Chicchiriccò <--global> Authored: Tue May 20 08:37:40 2014 +0200 Committer: Francesco Chicchiriccò <--global> Committed: Tue May 20 08:37:40 2014 +0200 ---------------------------------------------------------------------- .../request/invoke/EdmEnabledInvokeRequestFactory.java | 4 ++-- .../invoke/v3/EdmEnabledInvokeRequestFactoryImpl.java | 11 ++++++++++- .../invoke/v4/EdmEnabledInvokeRequestFactoryImpl.java | 11 ++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5fb2b80e/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java ---------------------------------------------------------------------- diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java index a29d124..d8d2538 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java @@ -25,7 +25,7 @@ import org.apache.olingo.commons.api.domain.ODataValue; public interface EdmEnabledInvokeRequestFactory extends InvokeRequestFactory { /** - * Gets an invoke request instance for the first function import with the given name (no overloading supported). + * Gets an invoke request instance for the function import with the given name and no parameters. * * @param <RES> OData domain object result, derived from return type defined in the function import * @param functionImportName operation to be invoked @@ -35,7 +35,7 @@ public interface EdmEnabledInvokeRequestFactory extends InvokeRequestFactory { String functionImportName); /** - * Gets an invoke request instance for the first function import with the given name (no overloading supported). + * Gets an invoke request instance for the function import with the given name and matching parameter names. * * @param <RES> OData domain object result, derived from return type defined in the function import * @param functionImportName operation to be invoked http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5fb2b80e/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/EdmEnabledInvokeRequestFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/EdmEnabledInvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/EdmEnabledInvokeRequestFactoryImpl.java index c6a6fd3..de22c30 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/EdmEnabledInvokeRequestFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/EdmEnabledInvokeRequestFactoryImpl.java @@ -18,6 +18,7 @@ */ package org.apache.olingo.client.core.communication.request.invoke.v3; +import java.util.ArrayList; import java.util.Map; import org.apache.olingo.client.api.communication.request.invoke.EdmEnabledInvokeRequestFactory; import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; @@ -26,6 +27,7 @@ import org.apache.olingo.commons.api.domain.ODataInvokeResult; import org.apache.olingo.commons.api.domain.ODataValue; import org.apache.olingo.commons.api.edm.EdmActionImport; import org.apache.olingo.commons.api.edm.EdmEntityContainer; +import org.apache.olingo.commons.api.edm.EdmFunction; import org.apache.olingo.commons.api.edm.EdmFunctionImport; import org.apache.olingo.commons.api.edm.EdmSchema; @@ -63,9 +65,16 @@ public class EdmEnabledInvokeRequestFactoryImpl throw new IllegalArgumentException("Could not find FunctionImport for name " + functionImportName); } + final EdmFunction function = edmClient.getCachedEdm(). + getUnboundFunction(efi.getFunctionFqn(), + parameters == null ? null : new ArrayList<String>(parameters.keySet())); + if (function == null) { + throw new IllegalArgumentException("Could not find Function " + efi.getFunctionFqn()); + } + return getInvokeRequest( edmClient.getURIBuilder().appendOperationCallSegment(functionImportName).build(), - efi.getUnboundFunctions().get(0), + function, parameters); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5fb2b80e/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/EdmEnabledInvokeRequestFactoryImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/EdmEnabledInvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/EdmEnabledInvokeRequestFactoryImpl.java index b33e225..4df6c3f 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/EdmEnabledInvokeRequestFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/EdmEnabledInvokeRequestFactoryImpl.java @@ -18,6 +18,7 @@ */ package org.apache.olingo.client.core.communication.request.invoke.v4; +import java.util.ArrayList; import java.util.Map; import org.apache.olingo.client.api.communication.request.invoke.EdmEnabledInvokeRequestFactory; import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; @@ -26,6 +27,7 @@ import org.apache.olingo.commons.api.domain.ODataInvokeResult; import org.apache.olingo.commons.api.domain.ODataValue; import org.apache.olingo.commons.api.edm.EdmActionImport; import org.apache.olingo.commons.api.edm.EdmEntityContainer; +import org.apache.olingo.commons.api.edm.EdmFunction; import org.apache.olingo.commons.api.edm.EdmFunctionImport; import org.apache.olingo.commons.api.edm.EdmSchema; @@ -63,9 +65,16 @@ public class EdmEnabledInvokeRequestFactoryImpl throw new IllegalArgumentException("Could not find FunctionImport for name " + functionImportName); } + final EdmFunction function = edmClient.getCachedEdm(). + getUnboundFunction(efi.getFunctionFqn(), + parameters == null ? null : new ArrayList<String>(parameters.keySet())); + if (function == null) { + throw new IllegalArgumentException("Could not find Function " + efi.getFunctionFqn()); + } + return getInvokeRequest( edmClient.getURIBuilder().appendOperationCallSegment(functionImportName).build(), - efi.getUnboundFunctions().get(0), + function, parameters); }
