olingo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Horvath (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (OLINGO-1149) Function Import should return collection of EDMSimpleType
Date Fri, 07 Jul 2017 12:21:00 GMT

    [ https://issues.apache.org/jira/browse/OLINGO-1149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16077996#comment-16077996
] 

Daniel Horvath edited comment on OLINGO-1149 at 7/7/17 12:20 PM:
-----------------------------------------------------------------

Hello Archana,

I am trying with the following declarations, neither of them are working:


{code:java}
@EdmFunctionImport(name = "FunctionImportName", returnType = @ReturnType(type = Type.SIMPLE,
isCollection = true), httpMethod = HttpMethod.POST)
public Boolean[] functionImportName() throws NotAuthorizedException, ODataApplicationException
{
    //Implementation of the function import
}
{code}


OR


{code:java}
@EdmFunctionImport(name = "FunctionImportName", returnType = @ReturnType(type = Type.SIMPLE,
isCollection = true), httpMethod = HttpMethod.POST)
public List<Boolean>} functionImportName() throws NotAuthorizedException, ODataApplicationException
{
    //Implementation of the function import
}
{code}


I am getting the following result:
HTTP Status code: 500 Internal Server Error


{code:java}
<?xml version="1.0" ?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <code></code>
    <message xml:lang="en">An exception occurred.</message>
</error>
{code}


The exception happens when Olingo tries to build the JPAEdmFunctionImport in the buildEdmReturnType(FunctionImport,
Method, EdmFunctionImport) methods SIMPLE part (Line: 270-274):

{code:java}
case SIMPLE:
          EdmSimpleTypeKind edmSimpleTypeKind = JPATypeConvertor.convertToEdmSimpleType(methodReturnType,
null);
          functionReturnType.setTypeName(edmSimpleTypeKind.getFullQualifiedName());
break;
{code}

Here you can find the stack trace when the exception happens:
org.apache.olingo.odata2.core.edm.EdmImpl.getEntityContainer(EdmImpl.java:87),
org.apache.olingo.odata2.core.edm.EdmImpl.getDefaultEntityContainer(EdmImpl.java:194),
org.apache.olingo.odata2.core.uri.UriParserImpl.handleNormalInitialSegment(UriParserImpl.java:201),
org.apache.olingo.odata2.core.uri.UriParserImpl.handleResourcePath(UriParserImpl.java:184),
org.apache.olingo.odata2.core.uri.UriParserImpl.parseAll(UriParserImpl.java:124),
org.apache.olingo.odata2.core.ODataRequestHandler.handle(ODataRequestHandler.java:108),
org.apache.olingo.odata2.core.servlet.ODataServlet.handleRequest(ODataServlet.java:215),
org.apache.olingo.odata2.core.servlet.ODataServlet.handle(ODataServlet.java:118),
org.apache.olingo.odata2.core.servlet.ODataServlet.service(ODataServlet.java:85),

Best regards,
Daniel


was (Author: daniel.horvath):
Hello Archana,

I am trying with the following declarations, neither of them are working:


{code:java}
@EdmFunctionImport(name = "FunctionImportName", returnType = @ReturnType{color:red}(type =
Type.SIMPLE, isCollection = true){color}, httpMethod = HttpMethod.POST)
public {color:red}Boolean[]{color} functionImportName() throws NotAuthorizedException, ODataApplicationException
{
    //Implementation of the function import
}
{code}


OR


{code:java}
@EdmFunctionImport(name = "FunctionImportName", returnType = @ReturnType{color:red}(type =
Type.SIMPLE, isCollection = true){color}, httpMethod = HttpMethod.POST)
public {color:red}List<Boolean>{color} functionImportName() throws NotAuthorizedException,
ODataApplicationException {
    //Implementation of the function import
}
{code}


I am getting the following result:
HTTP Status code: 500 Internal Server Error


{code:java}
<?xml version="1.0" ?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <code></code>
    <message xml:lang="en">An exception occurred.</message>
</error>
{code}


The exception happens when Olingo tries to build the JPAEdmFunctionImport in the buildEdmReturnType(FunctionImport,
Method, EdmFunctionImport) methods SIMPLE part (Line: 270-274):

{code:java}
case SIMPLE:
          EdmSimpleTypeKind edmSimpleTypeKind = JPATypeConvertor.convertToEdmSimpleType(methodReturnType,
null);
          functionReturnType.setTypeName(edmSimpleTypeKind.getFullQualifiedName());
break;
{code}

Here you can find the stack trace when the exception happens:
org.apache.olingo.odata2.core.edm.EdmImpl.getEntityContainer(EdmImpl.java:87),
org.apache.olingo.odata2.core.edm.EdmImpl.getDefaultEntityContainer(EdmImpl.java:194),
org.apache.olingo.odata2.core.uri.UriParserImpl.handleNormalInitialSegment(UriParserImpl.java:201),
org.apache.olingo.odata2.core.uri.UriParserImpl.handleResourcePath(UriParserImpl.java:184),
org.apache.olingo.odata2.core.uri.UriParserImpl.parseAll(UriParserImpl.java:124),
org.apache.olingo.odata2.core.ODataRequestHandler.handle(ODataRequestHandler.java:108),
org.apache.olingo.odata2.core.servlet.ODataServlet.handleRequest(ODataServlet.java:215),
org.apache.olingo.odata2.core.servlet.ODataServlet.handle(ODataServlet.java:118),
org.apache.olingo.odata2.core.servlet.ODataServlet.service(ODataServlet.java:85),

Best regards,
Daniel

> Function Import should return collection of EDMSimpleType
> ---------------------------------------------------------
>
>                 Key: OLINGO-1149
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1149
>             Project: Olingo
>          Issue Type: Bug
>    Affects Versions: V2 2.0.7
>            Reporter: Daniel Horvath
>
> Hello Colleagues,
> According to the OData V2 specifications function import should be allowed to return
collection of EDMSimpleType:
> * If defined in CSDL 1.1, CSDL 2.0, or CSDL 3.0, the Type of FunctionImport ReturnType
MUST be an EDMSimpleType, EntityType, or ComplexType that is in scope or a collection of one
of these in-scope types. In CSDL 1.0, the ReturnType is a collection of either EDMSimpleType
or EntityType.
> (From document: https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MC-CSDL/%5bMC-CSDL%5d.pdf,
Section: 2.1.16 FunctionImport ReturnType, Page 34)
> Currently it is not possible. (tested in Olingo 2.0.7)
> If you have further questions, please feel free to contact me.
> Best regards,
> Daniel



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message