You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Daniel Horvath (JIRA)" <ji...@apache.org> on 2017/07/07 12:19:00 UTC
[jira] [Comment Edited] (OLINGO-1149) Function Import should return
collection of EDMSimpleType
[ 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:18 PM:
-----------------------------------------------------------------
Hello Archana,
I am trying with the following declarations, neither of them are working:
{{@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
}}}
OR
{{@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
}}}
I am getting the following result:
HTTP Status code: 500 Internal Server Error
{{<?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>}}
The exception happens when Olingo tries to build the JPAEdmFunctionImport in the buildEdmReturnType(FunctionImport, Method, EdmFunctionImport) methods SIMPLE part (Line: 270-274):
{{case SIMPLE:
EdmSimpleTypeKind edmSimpleTypeKind = JPATypeConvertor.convertToEdmSimpleType(methodReturnType, null);
functionReturnType.setTypeName(edmSimpleTypeKind.getFullQualifiedName());
break;}}
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:
@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
}
OR
@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
}
I am getting the following result:
HTTP Status code: 500 Internal Server Error
<?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>
The exception happens when Olingo tries to build the JPAEdmFunctionImport in the buildEdmReturnType(FunctionImport, Method, EdmFunctionImport) methods SIMPLE part (Line: 270-274):
case SIMPLE:
EdmSimpleTypeKind edmSimpleTypeKind = JPATypeConvertor.convertToEdmSimpleType(methodReturnType, null);
functionReturnType.setTypeName(edmSimpleTypeKind.getFullQualifiedName());
break;
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)