You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2017/03/26 15:03:55 UTC

[3/4] polygene-java git commit: Fix value type lookup in JSON entity store helpers

Fix value type lookup in JSON entity store helpers

POLYGENE-105


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/82a00392
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/82a00392
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/82a00392

Branch: refs/heads/serialization-3.0
Commit: 82a003924c7592b253e0c8b4781d1d1e56583a4a
Parents: 7bd93ad
Author: Paul Merlin <pa...@apache.org>
Authored: Sun Mar 26 17:02:31 2017 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Sun Mar 26 17:02:31 2017 +0200

----------------------------------------------------------------------
 .../apache/polygene/spi/entitystore/helpers/JSONEntityState.java | 4 +++-
 .../spi/entitystore/helpers/JSONMapEntityStoreMixin.java         | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/82a00392/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONEntityState.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONEntityState.java b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONEntityState.java
index e4b5c05..151f144 100644
--- a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONEntityState.java
+++ b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONEntityState.java
@@ -120,6 +120,7 @@ public final class JSONEntityState
                 // TODO This rely on _type explicitely :(
                 // Needed because of this mess that is JsonEntityState
                 ValueType propertyValueType = null;
+                ModuleDescriptor propertyModule = module;
                 if( json.getValueType() == JsonValue.ValueType.OBJECT )
                 {
                     String typeInfo = ( (JsonObject) json ).getString( "_type", null );
@@ -129,6 +130,7 @@ public final class JSONEntityState
                         if( valueDescriptor != null )
                         {
                             propertyValueType = valueDescriptor.valueType();
+                            propertyModule = valueDescriptor.module();
                         }
                     }
                 }
@@ -145,7 +147,7 @@ public final class JSONEntityState
                 {
                     return null;
                 }
-                return serialization.fromJson( module, propertyValueType, json );
+                return serialization.fromJson( propertyModule, propertyValueType, json );
             }
         }
         catch( SerializationException e )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/82a00392/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONMapEntityStoreMixin.java b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
index a7f7690..2a0ddc3 100644
--- a/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
+++ b/core/spi/src/main/java/org/apache/polygene/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
@@ -453,7 +453,7 @@ public class JSONMapEntityStoreMixin
                 throw new NoSuchEntityTypeException( type, module.name(), module.typeLookup() );
             }
 
-            return new JSONEntityState( module, serialization,
+            return new JSONEntityState( entityDescriptor.module(), serialization,
                                         version, modified,
                                         EntityReference.create( identity ),
                                         status, entityDescriptor,
@@ -502,7 +502,7 @@ public class JSONMapEntityStoreMixin
                 EntityDescriptor entityDescriptor = module.entityDescriptor( type );
                 String version = data.getString( JSONKeys.VERSION );
                 Instant lastModified = Instant.ofEpochMilli( data.getJsonNumber( JSONKeys.MODIFIED ).longValueExact() );
-                return new JSONEntityState( module, serialization,
+                return new JSONEntityState( entityDescriptor.module(), serialization,
                                             version, lastModified,
                                             reference,
                                             EntityStatus.LOADED, entityDescriptor,