[ 
https://issues.apache.org/jira/browse/OLINGO-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Boris Fierlings updated OLINGO-1492:
------------------------------------
    Description: 
org.apache.olingo.server.core.ODataDispatcher throws a 
ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,                            
ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED) when 
dispatching a function or action which is returning an enum.

Adding a "case ENUM:" in function handleFunctionDispatching like this:

    private void handleFunctionDispatching(final ODataRequest request, final 
ODataResponse response,
            final UriResourceFunction uriResourceFunction) throws 
ODataApplicationException, ODataLibraryException
    {
        EdmFunction function = uriResourceFunction.getFunction();
        if (function == null)
        {
            function = 
uriResourceFunction.getFunctionImport().getUnboundFunctions().get(0);
        }
        final EdmReturnType returnType = function.getReturnType();
        switch (returnType.getType().getKind())
        {
            case ENTITY:
                handleEntityDispatching(request, response,
                        returnType.isCollection() && 
uriResourceFunction.getKeyPredicates().isEmpty(), false);
                break;
            case PRIMITIVE:
            case ENUM:
                handlePrimitiveDispatching(request, response, 
returnType.isCollection());
                break;
            case COMPLEX:
                handleComplexDispatching(request, response, 
returnType.isCollection());
                break;
            default:
                throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
                        
ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
        }
    }


and similar in function {color:#172b4d}handleActionDispatching {color}solves 
the problem.

  was:
org.apache.olingo.server.core.ODataDispatcher throws a 
ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,                            
ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED) when 
dispatching a function or action which is returning an enum.

Adding a "case ENUM:" in function handleFunctionDispatching like this:

    private void handleFunctionDispatching(final ODataRequest request, final 
ODataResponse response,
            final UriResourceFunction uriResourceFunction) throws 
ODataApplicationException, ODataLibraryException
    {
        EdmFunction function = uriResourceFunction.getFunction();
        if (function == null)
        {
            function = 
uriResourceFunction.getFunctionImport().getUnboundFunctions().get(0);
        }
        final EdmReturnType returnType = function.getReturnType();
        switch (returnType.getType().getKind())
        {
            case ENTITY:
                handleEntityDispatching(request, response,
                        returnType.isCollection() && 
uriResourceFunction.getKeyPredicates().isEmpty(), false);
                break;
            case PRIMITIVE:
            case ENUM:
                handlePrimitiveDispatching(request, response, 
returnType.isCollection());
                break;
            case COMPLEX:
                handleComplexDispatching(request, response, 
returnType.isCollection());
                break;
            default:
                throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
                        
ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
        }
    }{{
}}

and similar in function {color:#172b4d}handleActionDispatching {color}solves 
the problem.


> Function & Action returning an enum throw an exception during dispatching
> -------------------------------------------------------------------------
>
>                 Key: OLINGO-1492
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1492
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-server
>    Affects Versions: (Java) V4 4.7.1
>            Reporter: Boris Fierlings
>            Priority: Major
>
> org.apache.olingo.server.core.ODataDispatcher throws a 
> ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,                            
> ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED) when 
> dispatching a function or action which is returning an enum.
> Adding a "case ENUM:" in function handleFunctionDispatching like this:
>     private void handleFunctionDispatching(final ODataRequest request, final 
> ODataResponse response,
>             final UriResourceFunction uriResourceFunction) throws 
> ODataApplicationException, ODataLibraryException
>     {
>         EdmFunction function = uriResourceFunction.getFunction();
>         if (function == null)
>         {
>             function = 
> uriResourceFunction.getFunctionImport().getUnboundFunctions().get(0);
>         }
>         final EdmReturnType returnType = function.getReturnType();
>         switch (returnType.getType().getKind())
>         {
>             case ENTITY:
>                 handleEntityDispatching(request, response,
>                         returnType.isCollection() && 
> uriResourceFunction.getKeyPredicates().isEmpty(), false);
>                 break;
>             case PRIMITIVE:
>             case ENUM:
>                 handlePrimitiveDispatching(request, response, 
> returnType.isCollection());
>                 break;
>             case COMPLEX:
>                 handleComplexDispatching(request, response, 
> returnType.isCollection());
>                 break;
>             default:
>                 throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
>                         
> ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
>         }
>     }
> and similar in function {color:#172b4d}handleActionDispatching {color}solves 
> the problem.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to