From bf0af2f22d4e6506ef1ce0e5f5508f8affaf6ce7 Mon Sep 17 00:00:00 2001
From: pkupczyk <pkupczyk>
Date: Wed, 30 May 2012 07:42:39 +0000
Subject: [PATCH] SP-70 / BIS-35: JSON-RPC - detect subtypes automatically
 (first implementation) SP-67 / BIS-35: Add Jackson annotations to all classes
 used in JSON-RPC interfaces (change @JsonTypeName to @JsonObject to make the
 annotation visible in JavaDoc)

SVN: 25391
---
 .../source/java/ch/systemsx/cisd/common/json/JsonObject.java | 5 +++++
 .../openbis/generic/shared/api/json/GenericObjectMapper.java | 4 +++-
 .../screening/shared/api/json/ScreeningObjectMapper.java     | 4 +++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/common/source/java/ch/systemsx/cisd/common/json/JsonObject.java b/common/source/java/ch/systemsx/cisd/common/json/JsonObject.java
index 43c0ab57b48..c5782500fcc 100644
--- a/common/source/java/ch/systemsx/cisd/common/json/JsonObject.java
+++ b/common/source/java/ch/systemsx/cisd/common/json/JsonObject.java
@@ -23,6 +23,11 @@ import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
 /**
+ * Annotation all JSON transfered classes should be marked with. It was originally created to
+ * replace @JsonTypeName annotation which was not visible in the documentation. With @JsonTypeName
+ * annotation it would be impossible for our users to find a logical type name of a class to be sent
+ * to JSON-RPC services.
+ * 
  * @author pkupczyk
  */
 @Target(
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/json/GenericObjectMapper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/json/GenericObjectMapper.java
index c0d380f3fcd..5390eb491b8 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/json/GenericObjectMapper.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/json/GenericObjectMapper.java
@@ -22,6 +22,8 @@ import ch.systemsx.cisd.common.api.server.json.JsonReflectionsSubTypeResolver;
 import ch.systemsx.cisd.common.api.server.json.JsonTypeAndClassAnnotationIntrospector;
 
 /**
+ * Jackson library object mapper used in generic OpenBIS.
+ * 
  * @author pkupczyk
  */
 public class GenericObjectMapper extends ObjectMapper
@@ -31,7 +33,7 @@ public class GenericObjectMapper extends ObjectMapper
     {
         setAnnotationIntrospector(new JsonTypeAndClassAnnotationIntrospector(
                 new GenericJsonClassValueToClassObjectsMapping()));
-        setSubtypeResolver(new JsonReflectionsSubTypeResolver());
+        setSubtypeResolver(JsonReflectionsSubTypeResolver.getDefaultInstance());
     }
 
 }
diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/json/ScreeningObjectMapper.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/json/ScreeningObjectMapper.java
index 7cf2099f533..fbe110a0aad 100644
--- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/json/ScreeningObjectMapper.java
+++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/json/ScreeningObjectMapper.java
@@ -22,6 +22,8 @@ import ch.systemsx.cisd.common.api.server.json.JsonReflectionsSubTypeResolver;
 import ch.systemsx.cisd.common.api.server.json.JsonTypeAndClassAnnotationIntrospector;
 
 /**
+ * Jackson library object mapper used in screening OpenBIS.
+ * 
  * @author pkupczyk
  */
 public class ScreeningObjectMapper extends ObjectMapper
@@ -31,7 +33,7 @@ public class ScreeningObjectMapper extends ObjectMapper
     {
         setAnnotationIntrospector(new JsonTypeAndClassAnnotationIntrospector(
                 new ScreeningJsonClassValueToClassObjectsMapping()));
-        setSubtypeResolver(new JsonReflectionsSubTypeResolver());
+        setSubtypeResolver(JsonReflectionsSubTypeResolver.getDefaultInstance());
     }
 
 }
-- 
GitLab