gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject [37/50] [abbrv] git commit: Rework UNION type handling: keep original storage type computed from field name
Date Wed, 04 Jun 2014 16:36:54 GMT
Rework UNION type handling: keep original storage type computed from field name


Project: http://git-wip-us.apache.org/repos/asf/gora/repo
Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/2202a2bc
Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/2202a2bc
Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/2202a2bc

Branch: refs/heads/master
Commit: 2202a2bc644b9ae21d0531adec165ce353cfa8e4
Parents: ff4abfc
Author: Damien Raude-Morvan <damien@dictanova.com>
Authored: Thu May 22 15:44:14 2014 +0200
Committer: Damien Raude-Morvan <damien@dictanova.com>
Committed: Thu May 22 15:45:00 2014 +0200

----------------------------------------------------------------------
 .../apache/gora/mongodb/store/MongoStore.java    | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/2202a2bc/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoStore.java
----------------------------------------------------------------------
diff --git a/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoStore.java b/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoStore.java
index 2d07c05..e209ec2 100644
--- a/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoStore.java
+++ b/gora-mongodb/src/main/java/org/apache/gora/mongodb/store/MongoStore.java
@@ -689,13 +689,11 @@ public class MongoStore<K, T extends PersistentBase> extends
       if (!type0.equals(type1)
           && (type0.equals(Type.NULL) || type1.equals(Type.NULL))) {
         Schema innerSchema = fieldSchema.getTypes().get(1);
-        DocumentFieldType innerStoreType = mapping
-            .getDocumentFieldType(innerSchema.getName());
         LOG.debug(
             "Load from DBObject (UNION), schemaType:{}, docField:{}, storeType:{}",
-            new Object[] { innerSchema.getType(), docf, innerStoreType });
-        result = fromDBObject(innerSchema, innerStoreType, field, docf,
-            easybson); // Deserialize as if schema was ["type"]
+            new Object[] { innerSchema.getType(), docf, storeType });
+        // Deserialize as if schema was ["type"]
+        result = fromDBObject(innerSchema, storeType, field, docf, easybson);
       } else {
         throw new IllegalStateException(
             "MongoStore doesn't support 3 types union field yet. Please update your mapping");
@@ -937,16 +935,11 @@ public class MongoStore<K, T extends PersistentBase> extends
       if (!type0.equals(type1)
           && (type0.equals(Schema.Type.NULL) || type1.equals(Schema.Type.NULL)))
{
         Schema innerSchema = fieldSchema.getTypes().get(1);
-        DocumentFieldType innerStoreType = mapping
-            .getDocumentFieldType(innerSchema.getName());
         LOG.debug(
             "Transform value to DBObject (UNION), schemaType:{}, type1:{}, storeType:{}",
-            new Object[] { innerSchema.getType(), type1, innerStoreType });
-        result = toDBObject(innerSchema, type1, innerStoreType, value); // Deserialize
-                                                                        // as if
-                                                                        // schema
-                                                                        // was
-                                                                        // ["type"]
+            new Object[] { innerSchema.getType(), type1, storeType });
+        // Deserialize as if schema was ["type"]
+        result = toDBObject(innerSchema, type1, storeType, value);
       } else {
         throw new IllegalStateException(
             "MongoStore doesn't support 3 types union field yet. Please update your mapping");


Mime
View raw message