You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ra...@apache.org on 2021/09/16 11:03:33 UTC
[olingo-odata2] branch master updated: [OLINGO-1543]Fix for
Function Import Returning Complex Type in JPA
This is an automated email from the ASF dual-hosted git repository.
ramyav pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/olingo-odata2.git
The following commit(s) were added to refs/heads/master by this push:
new c0b13fa [OLINGO-1543]Fix for Function Import Returning Complex Type in JPA
c0b13fa is described below
commit c0b13fa95cba63adb99fbd02d23af57b8bf86583
Author: ramya vasanth <ra...@sap.com>
AuthorDate: Thu Sep 16 16:33:09 2021 +0530
[OLINGO-1543]Fix for Function Import Returning Complex Type in JPA
---
.../core/ODataJPAResponseBuilderDefault.java | 34 ++++++++++++----------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderDefault.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderDefault.java
index 80cea7d..d259774 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderDefault.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderDefault.java
@@ -317,9 +317,9 @@ public final class ODataJPAResponseBuilderDefault implements ODataJPAResponseBui
if (selectedItems != null && !selectedItems.isEmpty()) {
edmEntityList =
jpaResultParser.parse2EdmEntityList(resultList,
- buildSelectItemList(selectedItems, (EdmEntityType) edmType));
+ buildSelectItemList(selectedItems, (EdmStructuralType) edmType));
} else {
- edmEntityList = jpaResultParser.parse2EdmEntityList(resultList, (EdmEntityType) edmType);
+ edmEntityList = jpaResultParser.parse2EdmEntityList(resultList, (EdmStructuralType) edmType);
}
expandList = resultsView.getExpand();
if (expandList != null && !expandList.isEmpty()) {
@@ -697,8 +697,8 @@ public final class ODataJPAResponseBuilderDefault implements ODataJPAResponseBui
return entityFeedPropertiesBuilder.build();
}
- private static List<EdmProperty> buildSelectItemList(final List<SelectItem> selectItems, final EdmEntityType entity)
- throws ODataJPARuntimeException {
+ private static List<EdmProperty> buildSelectItemList(final List<SelectItem> selectItems,
+ final EdmStructuralType entity) throws ODataJPARuntimeException {
boolean flag = false;
List<EdmProperty> selectPropertyList = new ArrayList<EdmProperty>();
try {
@@ -712,19 +712,21 @@ public final class ODataJPAResponseBuilderDefault implements ODataJPAResponseBui
}
}
}
- for (EdmProperty keyProperty : entity.getKeyProperties()) {
- flag = true;
- for (SelectItem selectedItem : selectItems) {
- if (!selectedItem.isStar() && keyProperty.equals(selectedItem.getProperty())) {
- flag = false;
- break;
- }
- }
- if (flag) {
- selectPropertyList.add(keyProperty);
- }
+ if (entity instanceof EdmEntityType) {
+ EdmEntityType edmEntity = (EdmEntityType)entity;
+ for (EdmProperty keyProperty : edmEntity.getKeyProperties()) {
+ flag = true;
+ for (SelectItem selectedItem : selectItems) {
+ if (!selectedItem.isStar() && keyProperty.equals(selectedItem.getProperty())) {
+ flag = false;
+ break;
+ }
+ }
+ if (flag) {
+ selectPropertyList.add(keyProperty);
+ }
+ }
}
-
} catch (EdmException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}