You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/11/27 05:29:37 UTC

olingo-odata2 git commit: [OLINGO-828] - Override default naming if mapping is provided for an element

Repository: olingo-odata2
Updated Branches:
  refs/heads/master 843fba144 -> c6631df2b


[OLINGO-828] - Override default naming if mapping is provided for an
element

Signed-off-by: Chandan V A <ch...@sap.com>

Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/c6631df2
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/c6631df2
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/c6631df2

Branch: refs/heads/master
Commit: c6631df2b380aa0eed8a05ccef1849bfe6ce5b16
Parents: 843fba1
Author: Chandan V A <ch...@sap.com>
Authored: Fri Nov 27 09:59:23 2015 +0530
Committer: Chandan V A <ch...@sap.com>
Committed: Fri Nov 27 09:59:23 2015 +0530

----------------------------------------------------------------------
 .../processor/core/access/model/JPAEdmNameBuilder.java   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/c6631df2/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
index fb7a964..a5984f1 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
@@ -430,6 +430,8 @@ public class JPAEdmNameBuilder {
       final JPAEdmPropertyView propertyView,
       final JPAEdmNavigationPropertyView navPropertyView, final boolean skipDefaultNaming, final int count) {
 
+    boolean overrideSkipDefaultNaming = false;
+
     String toName = null;
     String fromName = null;
     String navPropName = null;
@@ -470,6 +472,9 @@ public class JPAEdmNameBuilder {
       toName = mappingModelAccess.mapJPAEntityType(targetEntityTypeName);
       fromName = mappingModelAccess
           .mapJPAEntityType(jpaEntityTypeName);
+      if (navPropName != null) {
+        overrideSkipDefaultNaming = true;
+      }
     }
     if (toName == null) {
       toName = targetEntityTypeName;
@@ -478,8 +483,10 @@ public class JPAEdmNameBuilder {
     if (fromName == null) {
       fromName = jpaEntityTypeName;
     }
-
-    if (skipDefaultNaming == false) {
+    /*
+     * Navigation Property name was provided in mapping then don't try to default the name
+     */
+    if (overrideSkipDefaultNaming == false && skipDefaultNaming == false) {
       if (navPropName == null) {
         navPropName = toName.concat(NAVIGATION_NAME);
       }