You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2018/12/19 22:11:11 UTC

[27/30] tomee git commit: TOMEE-2330 fix issue with incorrect base URL for generated persistence units

TOMEE-2330 fix issue with incorrect base URL for generated persistence units


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/7f19ea9f
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/7f19ea9f
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/7f19ea9f

Branch: refs/heads/tomee-7.1.x
Commit: 7f19ea9fc6c5d690592430d9d591a5d891590a50
Parents: b90eb15
Author: Jonathan Gallimore <jg...@tomitribe.com>
Authored: Mon Dec 10 14:16:43 2018 +0000
Committer: Otavio Santana <ot...@gmail.com>
Committed: Mon Dec 17 14:02:40 2018 -0200

----------------------------------------------------------------------
 .../apache/openejb/config/CmpJpaConversion.java | 23 ++++++++++----------
 1 file changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/7f19ea9f/container/openejb-core/src/main/java/org/apache/openejb/config/CmpJpaConversion.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/CmpJpaConversion.java b/container/openejb-core/src/main/java/org/apache/openejb/config/CmpJpaConversion.java
index 4cbb3c8..2965abe 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/CmpJpaConversion.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/CmpJpaConversion.java
@@ -76,7 +76,6 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Properties;
 import java.util.Set;
 import java.util.TreeMap;
@@ -176,7 +175,7 @@ public class CmpJpaConversion implements DynamicDeployer {
             final Relationships relationships = ejbJar.getRelationships();
             if (relationships != null) {
 
-                final Map<String, Entity> entitiesByEjbName = new TreeMap<String, Entity>();
+                final Map<String, Entity> entitiesByEjbName = new TreeMap<>();
                 for (final Entity entity : cmpMappings.getEntity()) {
                     entitiesByEjbName.put(entity.getEjbName(), entity);
                 }
@@ -267,10 +266,10 @@ public class CmpJpaConversion implements DynamicDeployer {
 
     private String getPersistenceModuleId(final AppModule appModule) {
         if (appModule.getModuleId() != null) {
-            return Optional.ofNullable(appModule.getJarLocation()).orElse(appModule.getModuleId());
+            return appModule.getJarLocation();
         }
         for (final EjbModule ejbModule : appModule.getEjbModules()) {
-            return Optional.ofNullable(appModule.getJarLocation()).orElse(appModule.getModuleId());
+            return ejbModule.getJarLocation();
         }
         throw new IllegalStateException("Comp must be in an ejb module, this one has none: " + appModule);
     }
@@ -730,7 +729,7 @@ public class CmpJpaConversion implements DynamicDeployer {
      *                    primary key classes.
      */
     private Collection<MappedSuperclass> mapClass2x(final Mapping mapping, final EntityBean bean, final ClassLoader classLoader) {
-        final Set<String> allFields = new TreeSet<String>();
+        final Set<String> allFields = new TreeSet<>();
         // get an acculated set of the CMP fields. 
         for (final CmpField cmpField : bean.getCmpField()) {
             allFields.add(cmpField.getFieldName());
@@ -812,7 +811,7 @@ public class CmpJpaConversion implements DynamicDeployer {
         //
         // id: the primary key
         //
-        final Set<String> primaryKeyFields = new HashSet<String>();
+        final Set<String> primaryKeyFields = new HashSet<>();
 
 
         if (bean.getPrimkeyField() != null) {
@@ -898,7 +897,7 @@ public class CmpJpaConversion implements DynamicDeployer {
         }
         // all of the fields should now be identified by type, so return a set of 
         // the field mappings 
-        return new HashSet<MappedSuperclass>(superclassByField.values());
+        return new HashSet<>(superclassByField.values());
     }
 
 
@@ -921,7 +920,7 @@ public class CmpJpaConversion implements DynamicDeployer {
         final Class ejbClass = loadClass(classLoader, ejbClassName);
 
         // build a set of all field names
-        final Set<String> allFields = new TreeSet<String>();
+        final Set<String> allFields = new TreeSet<>();
         for (final CmpField cmpField : bean.getCmpField()) {
             allFields.add(cmpField.getFieldName());
         }
@@ -931,7 +930,7 @@ public class CmpJpaConversion implements DynamicDeployer {
         //
         // id: the primary key
         //
-        final Set<String> primaryKeyFields = new HashSet<String>();
+        final Set<String> primaryKeyFields = new HashSet<>();
         if (bean.getPrimkeyField() != null) {
             final String fieldName = bean.getPrimkeyField();
             final MappedSuperclass superclass = superclassByField.get(fieldName);
@@ -1002,7 +1001,7 @@ public class CmpJpaConversion implements DynamicDeployer {
 
         // all of the fields should now be identified by type, so return a set of 
         // the field mappings 
-        return new HashSet<MappedSuperclass>(superclassByField.values());
+        return new HashSet<>(superclassByField.values());
     }
 
 
@@ -1077,8 +1076,8 @@ public class CmpJpaConversion implements DynamicDeployer {
      * @return A map of fieldname-to-defining class relationships.
      */
     private Map<String, MappedSuperclass> mapFields(Class clazz, Set<String> persistantFields) {
-        persistantFields = new TreeSet<String>(persistantFields);
-        final Map<String, MappedSuperclass> fields = new TreeMap<String, MappedSuperclass>();
+        persistantFields = new TreeSet<>(persistantFields);
+        final Map<String, MappedSuperclass> fields = new TreeMap<>();
 
         // spin down the class hierarchy until we've either processed all of the fields
         // or we've reached the Object class.