← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6357: minor fixes to jacksonutils

 

------------------------------------------------------------
revno: 6357
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-03-22 16:24:25 +0100
message:
  minor fixes to jacksonutils
removed:
  dhis-2/dhis-services/dhis-service-options/
  dhis-2/dhis-services/dhis-service-options/bin/
modified:
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java	2012-03-22 15:14:01 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java	2012-03-22 15:24:25 +0000
@@ -57,28 +57,23 @@
 
     static
     {
-        jsonMapper.setSerializationInclusion( JsonInclude.Include.NON_NULL );
-        jsonMapper.configure( SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false );
-        jsonMapper.configure( SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false );
-        jsonMapper.configure( SerializationFeature.FAIL_ON_EMPTY_BEANS, false );
-        jsonMapper.disable( MapperFeature.AUTO_DETECT_FIELDS );
-        jsonMapper.disable( MapperFeature.AUTO_DETECT_CREATORS );
-        jsonMapper.disable( MapperFeature.AUTO_DETECT_GETTERS );
-        jsonMapper.disable( MapperFeature.AUTO_DETECT_SETTERS );
-        jsonMapper.disable( MapperFeature.AUTO_DETECT_IS_GETTERS );
+        ObjectMapper[] objectMappers = new ObjectMapper[]{ jsonMapper, xmlMapper };
+
+        for ( ObjectMapper objectMapper : objectMappers )
+        {
+            objectMapper.setSerializationInclusion( JsonInclude.Include.NON_NULL );
+            objectMapper.configure( SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false );
+            objectMapper.configure( SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false );
+            objectMapper.configure( SerializationFeature.FAIL_ON_EMPTY_BEANS, false );
+            objectMapper.disable( MapperFeature.AUTO_DETECT_FIELDS );
+            objectMapper.disable( MapperFeature.AUTO_DETECT_CREATORS );
+            objectMapper.disable( MapperFeature.AUTO_DETECT_GETTERS );
+            objectMapper.disable( MapperFeature.AUTO_DETECT_SETTERS );
+            objectMapper.disable( MapperFeature.AUTO_DETECT_IS_GETTERS );
+        }
 
         jsonMapper.getJsonFactory().enable( JsonGenerator.Feature.QUOTE_FIELD_NAMES );
-
-        xmlMapper.setSerializationInclusion( JsonInclude.Include.NON_NULL );
         xmlMapper.configure( ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true );
-        xmlMapper.configure( SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false );
-        xmlMapper.configure( SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false );
-        xmlMapper.configure( SerializationFeature.FAIL_ON_EMPTY_BEANS, false );
-        xmlMapper.disable( MapperFeature.AUTO_DETECT_FIELDS );
-        xmlMapper.disable( MapperFeature.AUTO_DETECT_CREATORS );
-        xmlMapper.disable( MapperFeature.AUTO_DETECT_GETTERS );
-        xmlMapper.disable( MapperFeature.AUTO_DETECT_SETTERS );
-        xmlMapper.disable( MapperFeature.AUTO_DETECT_IS_GETTERS );
 
         // register view classes
         viewClasses.put( "default", IdentifiableObjectView.class );

=== removed directory 'dhis-2/dhis-services/dhis-service-options'
=== removed directory 'dhis-2/dhis-services/dhis-service-options/bin'