← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20115: Cleanup

 

------------------------------------------------------------
revno: 20115
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-09-13 23:54:23 +0200
message:
  Cleanup
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXConstants.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXException.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXPeriod.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/DefaultADXDataService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/FilterOptions.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/JacksonUtils.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/Options.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetStore.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/PipedImporter.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/StreamingCsvDataValueSet.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/StreamingJsonDataValueSet.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/EnrollmentStatus.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/JacksonEnrollmentService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JacksonEventService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/csv/DefaultCsvEventService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/AbstractEventRowService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/EventRow.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/Attribute.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/JacksonTrackedEntityInstanceService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/GmlConversionUtils.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultMetaDataDependencyService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/OpFactory.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/ops/InOp.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/DefaultPdfDataEntryFormService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfDataEntryFormUtil.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfFieldCell.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfFormFontSettings.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/adx/ADXPeriodTest.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/gml/GmlImportServiceTest.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/DefaultExportServiceTest.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dataelementhistory/DefaultHistoryRetriever.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsPrimitiveFromJsonFactory.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/LegendItem.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/LegendSet.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/MapUtils.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-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2015-09-13 17:49:03 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2015-09-13 21:54:23 +0000
@@ -135,7 +135,7 @@
     private TrackedEntityAttributeService attributeService;
     
     @Autowired
-    ProgramIndicatorService programIndicatorService;
+    private ProgramIndicatorService programIndicatorService;
     
     @Autowired
     private OrganisationUnitService organisationUnitService;

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXConstants.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXConstants.java	2015-07-03 17:24:16 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXConstants.java	2015-09-13 21:54:23 +0000
@@ -38,31 +38,31 @@
     // These are defined in the ADX standard
     //--------------------------------------------------------------------------
 
-    final String NAMESPACE = "urn:ihe:qrph:adx:2015";
-    
-    final String ROOT = "adx";
-
-    final String GROUP = "group";
-
-    final String DATASET = "dataSet";
-    
-    final String PERIOD = "period";
-    
-    final String ORGUNIT = "orgUnit";
-    
-    final String DATAELEMENT = "dataElement";
-
-    final String DATAVALUE = "dataValue";
-
-    final String VALUE = "value";
-
-    final String ANNOTATION = "annotation";
-    
-    //--------------------------------------------------------------------------
-    // DHIS2 specific
-    //--------------------------------------------------------------------------
-
-    final String CATOPTCOMBO = "categoryOptionCombo";
-    
-    final String ATTOPTCOMBO = "attributeOptionCombo";
+    String NAMESPACE = "urn:ihe:qrph:adx:2015";
+    
+    String ROOT = "adx";
+
+    String GROUP = "group";
+
+    String DATASET = "dataSet";
+    
+    String PERIOD = "period";
+    
+    String ORGUNIT = "orgUnit";
+    
+    String DATAELEMENT = "dataElement";
+
+    String DATAVALUE = "dataValue";
+
+    String VALUE = "value";
+
+    String ANNOTATION = "annotation";
+    
+    //--------------------------------------------------------------------------
+    // DHIS 2 specific
+    //--------------------------------------------------------------------------
+
+    String CATOPTCOMBO = "categoryOptionCombo";
+    
+    String ATTOPTCOMBO = "attributeOptionCombo";
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXException.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXException.java	2015-07-08 16:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXException.java	2015-09-13 21:54:23 +0000
@@ -29,8 +29,7 @@
 import org.hisp.dhis.dxf2.importsummary.ImportConflict;
 
 /**
- * A simple class for ADX checked exceptions
- * which can wrap an ImportConflict
+ * Simple class for ADX checked exceptions which can wrap an ImportConflict
  * 
  * @author bobj
  */
@@ -38,26 +37,29 @@
     extends Exception
 {
     protected String object;
-    
+
     public String getObject()
     {
         return object;
     }
+
+    public ADXException()
+    {
+    }
     
-    public ADXException(String msg) 
+    public ADXException( String msg )
     {
-        super(msg);
+        super( msg );
     }
 
-    // for wrapping ImportConflict
-    public ADXException(String object, String msg) 
+    public ADXException( String object, String msg )
     {
-        super(msg);
+        super( msg );
         this.object = object;
     }
-    
+
     public ImportConflict getImportConflict()
     {
-        return new ImportConflict(object, this.getMessage());
+        return new ImportConflict( object, this.getMessage() );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXPeriod.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXPeriod.java	2015-07-08 16:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/ADXPeriod.java	2015-09-13 21:54:23 +0000
@@ -68,7 +68,7 @@
         P1Y  // yearly, financialApril, financialJuly, financialOctober
     }
 
-    private static SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat( "yyyy-MM-dd" );
 
     public static Period parse( String periodString ) throws ADXException
     {
@@ -83,7 +83,7 @@
         {
             Period period = null;
             PeriodType periodType = null;
-            Date startDate = dateFormat.parse( tokens[0] );
+            Date startDate = DATE_FORMAT.parse( tokens[0] );
             Calendar cal = Calendar.getInstance();
             cal.setTime( startDate );
             Duration duration = Duration.valueOf( tokens[1] );
@@ -161,7 +161,7 @@
 
     public static String serialize( Period period )
     {
-        return dateFormat.format( period.getStartDate() ) + "/"
+        return DATE_FORMAT.format( period.getStartDate() ) + "/"
             + period.getPeriodType().getIso8601Duration();
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/DefaultADXDataService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/DefaultADXDataService.java	2015-08-31 08:23:12 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/DefaultADXDataService.java	2015-09-13 21:54:23 +0000
@@ -125,7 +125,6 @@
 
     @Override
     public ImportSummaries postData( InputStream in, ImportOptions importOptions )
-        throws IOException
     {
         XMLReader adxReader = XMLFactory.getXMLReader( in );
 
@@ -284,7 +283,7 @@
 
         DataElement dataElement = identifiableObjectManager.getObject( DataElement.class, dataElementIdScheme,dvAttributes.get( ADXConstants.DATAELEMENT));
         
-        if (dataElement == null)
+        if ( dataElement == null )
         {
             throw new ADXException(dvAttributes.get( ADXConstants.DATAELEMENT), "No matching dataelement");
         }
@@ -400,11 +399,12 @@
     {
         log.debug( "adx attributes: " + attributes );
 
-        if ( catCombo == categoryService.getDefaultDataElementCategoryCombo() )
+        if ( catCombo.isDefault() )
         {
             // nothing to do
             return;
         }
+        
         Map<String, DataElementCategory> categoryMap = createCategoryMap( catCombo );
 
         Map<String, String> attributeOptions = new HashMap<>();
@@ -430,7 +430,6 @@
 
     // TODO this should be part of staxwax library
     protected Map<String, String> readAttributes( XMLReader staxWaxReader )
-        throws XMLStreamException
     {
         Map<String, String> attributes = new HashMap<>();
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/FilterOptions.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/FilterOptions.java	2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/FilterOptions.java	2015-09-13 21:54:23 +0000
@@ -42,6 +42,10 @@
     // Constructors
     //--------------------------------------------------------------------------
 
+    public FilterOptions()
+    {
+    }
+    
     public FilterOptions( JSONObject restrictionsJson )
     {
         this.restrictionsJson = restrictionsJson;

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/JacksonUtils.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/JacksonUtils.java	2015-05-15 07:44:22 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/JacksonUtils.java	2015-09-13 21:54:23 +0000
@@ -51,15 +51,15 @@
  */
 public class JacksonUtils
 {
-    private final static ObjectMapper jsonMapper = new ObjectMapper();
-
-    private final static XmlMapper xmlMapper = new XmlMapper();
-
-    private final static Map<String, Class<?>> viewClasses = new HashMap<>();
+    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+
+    private static final XmlMapper XML_MAPPER = new XmlMapper();
+
+    private static final Map<String, Class<?>> VIEW_CLASSES = new HashMap<>();
 
     static
     {
-        ObjectMapper[] objectMappers = new ObjectMapper[]{ jsonMapper, xmlMapper };
+        ObjectMapper[] objectMappers = new ObjectMapper[]{ JSON_MAPPER, XML_MAPPER };
         // DateFormat format = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssZ" );
 
         for ( ObjectMapper objectMapper : objectMappers )
@@ -82,13 +82,13 @@
             objectMapper.disable( MapperFeature.AUTO_DETECT_IS_GETTERS );
         }
 
-        jsonMapper.getFactory().enable( JsonGenerator.Feature.QUOTE_FIELD_NAMES );
-        xmlMapper.configure( ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true );
+        JSON_MAPPER.getFactory().enable( JsonGenerator.Feature.QUOTE_FIELD_NAMES );
+        XML_MAPPER.configure( ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true );
 
         // Register view classes
 
-        viewClasses.put( "default", ExportView.class );
-        viewClasses.put( "export", ExportView.class );
+        VIEW_CLASSES.put( "default", ExportView.class );
+        VIEW_CLASSES.put( "export", ExportView.class );
     }
 
     /**
@@ -98,10 +98,10 @@
     {
         if ( viewName == null || !(viewName instanceof String && ((String) viewName).length() != 0) )
         {
-            return viewClasses.get( "default" );
+            return VIEW_CLASSES.get( "default" );
         }
 
-        return viewClasses.get( viewName );
+        return VIEW_CLASSES.get( viewName );
     }
 
     //--------------------------------------------------------------------------
@@ -110,12 +110,12 @@
 
     public static ObjectMapper getJsonMapper()
     {
-        return jsonMapper;
+        return JSON_MAPPER;
     }
 
     public static XmlMapper getXmlMapper()
     {
-        return xmlMapper;
+        return XML_MAPPER;
     }
 
     //--------------------------------------------------------------------------
@@ -124,12 +124,12 @@
 
     public static void toJson( OutputStream output, Object value ) throws IOException
     {
-        jsonMapper.writeValue( output, value );
+        JSON_MAPPER.writeValue( output, value );
     }
 
     public static String toJsonAsString( Object value ) throws IOException
     {
-        return jsonMapper.writeValueAsString( value );
+        return JSON_MAPPER.writeValueAsString( value );
     }
 
     /**
@@ -137,7 +137,7 @@
      */
     public static void toJsonWithView( OutputStream output, Object value, Class<?> viewClass ) throws IOException
     {
-        jsonMapper.writerWithView( viewClass ).writeValue( output, value );
+        JSON_MAPPER.writerWithView( viewClass ).writeValue( output, value );
     }
 
     /**
@@ -145,19 +145,19 @@
      */
     public static String toJsonWithViewAsString( Object value, Class<?> viewClass ) throws IOException
     {
-        return jsonMapper.writerWithView( viewClass ).writeValueAsString( value );
+        return JSON_MAPPER.writerWithView( viewClass ).writeValueAsString( value );
     }
 
     @SuppressWarnings( "unchecked" )
     public static <T> T fromJson( InputStream input, Class<?> clazz ) throws IOException
     {
-        return (T) jsonMapper.readValue( input, clazz );
+        return (T) JSON_MAPPER.readValue( input, clazz );
     }
 
     @SuppressWarnings( "unchecked" )
     public static <T> T fromJson( String input, Class<?> clazz ) throws IOException
     {
-        return (T) jsonMapper.readValue( input, clazz );
+        return (T) JSON_MAPPER.readValue( input, clazz );
     }
 
     //--------------------------------------------------------------------------
@@ -166,12 +166,12 @@
 
     public static void toXml( OutputStream output, Object value ) throws IOException
     {
-        xmlMapper.writeValue( output, value );
+        XML_MAPPER.writeValue( output, value );
     }
 
     public static String toXmlAsString( Object value ) throws IOException
     {
-        return xmlMapper.writeValueAsString( value );
+        return XML_MAPPER.writeValueAsString( value );
     }
 
     /**
@@ -179,7 +179,7 @@
      */
     public static void toXmlWithView( OutputStream output, Object value, Class<?> viewClass ) throws IOException
     {
-        xmlMapper.writerWithView( viewClass ).writeValue( output, value );
+        XML_MAPPER.writerWithView( viewClass ).writeValue( output, value );
     }
 
     /**
@@ -187,24 +187,24 @@
      */
     public static String toXmlWithViewAsString( Object value, Class<?> viewClass ) throws IOException
     {
-        return xmlMapper.writerWithView( viewClass ).writeValueAsString( value );
+        return XML_MAPPER.writerWithView( viewClass ).writeValueAsString( value );
     }
 
     @SuppressWarnings( "unchecked" )
     public static <T> T fromXml( InputStream input, Class<?> clazz ) throws IOException
     {
-        return (T) xmlMapper.readValue( input, clazz );
+        return (T) XML_MAPPER.readValue( input, clazz );
     }
 
     @SuppressWarnings( "unchecked" )
     public static <T> T fromXml( String input, Class<?> clazz ) throws IOException
     {
-        return (T) xmlMapper.readValue( input, clazz );
+        return (T) XML_MAPPER.readValue( input, clazz );
     }
 
     @SuppressWarnings( "unchecked" )
     public static <T> T fromJson( InputStream inputStream, TypeReference<?> typeReference ) throws IOException
     {
-        return (T) jsonMapper.readValue( inputStream, typeReference );
+        return (T) JSON_MAPPER.readValue( inputStream, typeReference );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/Options.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/Options.java	2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/Options.java	2015-09-13 21:54:23 +0000
@@ -39,6 +39,9 @@
  */
 public class Options
 {
+    private static final String[] DATE_PATTERNS = new String[] {
+        "yyyy-MM-dd", "yyyy-MM", "yyyyMMdd", "yyyyMM", "yyyy" };
+    
     //--------------------------------------------------------------------------
     // Static helpers
     //--------------------------------------------------------------------------
@@ -47,7 +50,7 @@
     {
         if ( str == null )
         {
-            str = defaultValue;
+            return defaultValue;
         }
 
         return str;
@@ -60,15 +63,7 @@
             return null;
         }
 
-        String patterns[] = new String[]{
-            "yyyy-MM-dd",
-            "yyyy-MM",
-            "yyyyMMdd",
-            "yyyyMM",
-            "yyyy"
-        };
-
-        for ( String pattern : patterns )
+        for ( String pattern : DATE_PATTERNS )
         {
             Date date = getDateByPattern( str, pattern );
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetStore.java	2015-06-01 23:12:38 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetStore.java	2015-09-13 21:54:23 +0000
@@ -39,11 +39,11 @@
  */
 public interface DataValueSetStore
 {
-    public void writeDataValueSetXml( DataExportParams params, Date completeDate, OutputStream out );
-
-    public void writeDataValueSetJson( DataExportParams params, Date completeDate, OutputStream out );
-
-    public void writeDataValueSetCsv( DataExportParams params, Date completeDate, Writer writer );
+    void writeDataValueSetXml( DataExportParams params, Date completeDate, OutputStream out );
+
+    void writeDataValueSetJson( DataExportParams params, Date completeDate, OutputStream out );
+
+    void writeDataValueSetCsv( DataExportParams params, Date completeDate, Writer writer );
 
     void writeDataValueSetJson( Date lastUpdated, OutputStream outputStream, IdSchemes idSchemes );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/PipedImporter.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/PipedImporter.java	2015-07-04 16:18:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/PipedImporter.java	2015-09-13 21:54:23 +0000
@@ -33,6 +33,7 @@
 import java.io.PipedOutputStream;
 import java.util.concurrent.Callable;
 
+import org.apache.commons.io.IOUtils;
 import org.hisp.dhis.dxf2.common.ImportOptions;
 import org.hisp.dhis.dxf2.importsummary.ImportStatus;
 import org.hisp.dhis.dxf2.importsummary.ImportSummary;
@@ -58,8 +59,7 @@
     private final Authentication authentication;
 
     public PipedImporter( DataValueSetService dataValueSetService, ImportOptions importOptions,
-        PipedOutputStream pipeOut )
-        throws IOException
+        PipedOutputStream pipeOut ) throws IOException
     {
         this.dataValueSetService = dataValueSetService;
         pipeIn = new PipedInputStream( pipeOut, PIPE_BUFFER_SIZE );
@@ -69,7 +69,6 @@
 
     @Override
     public ImportSummary call()
-        throws Exception
     {
         ImportSummary result = null;
         SecurityContextHolder.getContext().setAuthentication( authentication );
@@ -84,8 +83,12 @@
             result.setStatus( ImportStatus.ERROR );
             result.setDescription( "Exception: " + ex.getMessage() );
         }
-        
-        pipeIn.close();
+        finally
+        {
+            IOUtils.closeQuietly( pipeIn );
+        }
+        
+        
         return result;
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/StreamingCsvDataValueSet.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/StreamingCsvDataValueSet.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/StreamingCsvDataValueSet.java	2015-09-13 21:54:23 +0000
@@ -74,7 +74,7 @@
         }
         catch ( IOException ex )
         {
-            throw new RuntimeException( ex );
+            throw new RuntimeException( "Failed to read record", ex );
         }
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/StreamingJsonDataValueSet.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/StreamingJsonDataValueSet.java	2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/StreamingJsonDataValueSet.java	2015-09-13 21:54:23 +0000
@@ -30,11 +30,13 @@
 
 import com.fasterxml.jackson.core.JsonGenerator;
 
+import org.apache.commons.io.IOUtils;
 import org.hisp.dhis.dxf2.datavalue.DataValue;
 import org.hisp.dhis.dxf2.common.JacksonUtils;
 
 import java.io.IOException;
 import java.io.OutputStream;
+
 import org.hisp.dhis.dxf2.datavalue.StreamingJsonDataValue;
 
 /**
@@ -55,7 +57,6 @@
         }
         catch ( IOException ignored )
         {
-            ignored.printStackTrace();
         }
     }
 
@@ -134,12 +135,15 @@
                 generator.writeEndArray();
             }
 
-            generator.writeEndObject();
-            generator.close();
+            generator.writeEndObject();            
         }
         catch ( IOException ignored )
         {
         }
+        finally
+        {
+            IOUtils.closeQuietly( generator );
+        }
     }
 
     private void writeObjectField( String fieldName, Object value )

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/EnrollmentStatus.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/EnrollmentStatus.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/EnrollmentStatus.java	2015-09-13 21:54:23 +0000
@@ -57,6 +57,6 @@
             }
         }
 
-        throw new IllegalArgumentException();
+        throw new IllegalArgumentException( "Enum value not found: " + status );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/JacksonEnrollmentService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/JacksonEnrollmentService.java	2015-07-08 03:04:42 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/JacksonEnrollmentService.java	2015-09-13 21:54:23 +0000
@@ -54,42 +54,42 @@
     // EnrollmentService Impl
     // -------------------------------------------------------------------------
 
-    private final static ObjectMapper xmlMapper = new XmlMapper();
+    private final static ObjectMapper XML_MAPPER = new XmlMapper();
 
-    private final static ObjectMapper jsonMapper = new ObjectMapper();
+    private final static ObjectMapper JSON_MAPPER = new ObjectMapper();
 
     @SuppressWarnings( "unchecked" )
     private static <T> T fromXml( InputStream inputStream, Class<?> clazz ) throws IOException
     {
-        return (T) xmlMapper.readValue( inputStream, clazz );
+        return (T) XML_MAPPER.readValue( inputStream, clazz );
     }
 
     @SuppressWarnings( "unchecked" )
     private static <T> T fromXml( String input, Class<?> clazz ) throws IOException
     {
-        return (T) xmlMapper.readValue( input, clazz );
+        return (T) XML_MAPPER.readValue( input, clazz );
     }
 
     @SuppressWarnings( "unchecked" )
     private static <T> T fromJson( InputStream inputStream, Class<?> clazz ) throws IOException
     {
-        return (T) jsonMapper.readValue( inputStream, clazz );
+        return (T) JSON_MAPPER.readValue( inputStream, clazz );
     }
 
     @SuppressWarnings( "unchecked" )
     private static <T> T fromJson( String input, Class<?> clazz ) throws IOException
     {
-        return (T) jsonMapper.readValue( input, clazz );
+        return (T) JSON_MAPPER.readValue( input, clazz );
     }
 
     static
     {
-        xmlMapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
-        xmlMapper.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
-        xmlMapper.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
-        jsonMapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
-        jsonMapper.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
-        jsonMapper.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
+        XML_MAPPER.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
+        XML_MAPPER.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
+        XML_MAPPER.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
+        JSON_MAPPER.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
+        JSON_MAPPER.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
+        JSON_MAPPER.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2015-07-02 07:05:55 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2015-09-13 21:54:23 +0000
@@ -157,9 +157,9 @@
     @Autowired
     protected IdentifiableObjectManager manager;
 
-    protected final int FLUSH_FREQUENCY = 20;
+    protected static final int FLUSH_FREQUENCY = 20;
 
-    private static final ObjectMapper objectMapper = new ObjectMapper();
+    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
     private CachingMap<String, OrganisationUnit> organisationUnitCache = new CachingMap<>();
 
@@ -816,7 +816,7 @@
 
                 try
                 {
-                    List<Double> list = objectMapper.readValue( coordinate.getCoordinateString(),
+                    List<Double> list = OBJECT_MAPPER.readValue( coordinate.getCoordinateString(),
                         new TypeReference<List<Double>>()
                         {
                         } );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JacksonEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JacksonEventService.java	2015-05-28 18:21:56 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JacksonEventService.java	2015-09-13 21:54:23 +0000
@@ -63,30 +63,30 @@
     // EventService Impl
     // -------------------------------------------------------------------------
 
-    private final static ObjectMapper xmlMapper = new XmlMapper();
+    private final static ObjectMapper XML_MAPPER = new XmlMapper();
 
-    private final static ObjectMapper jsonMapper = new ObjectMapper();
+    private final static ObjectMapper JSON_MAPPER = new ObjectMapper();
 
     @SuppressWarnings( "unchecked" )
     private static <T> T fromXml( String input, Class<?> clazz ) throws IOException
     {
-        return (T) xmlMapper.readValue( input, clazz );
+        return (T) XML_MAPPER.readValue( input, clazz );
     }
 
     @SuppressWarnings( "unchecked" )
     private static <T> T fromJson( String input, Class<?> clazz ) throws IOException
     {
-        return (T) jsonMapper.readValue( input, clazz );
+        return (T) JSON_MAPPER.readValue( input, clazz );
     }
 
     static
     {
-        xmlMapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
-        xmlMapper.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
-        xmlMapper.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
-        jsonMapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
-        jsonMapper.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
-        jsonMapper.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
+        XML_MAPPER.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
+        XML_MAPPER.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
+        XML_MAPPER.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
+        JSON_MAPPER.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
+        JSON_MAPPER.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
+        JSON_MAPPER.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java	2015-09-03 09:36:38 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java	2015-09-13 21:54:23 +0000
@@ -67,7 +67,7 @@
     @Autowired
     private JdbcTemplate jdbcTemplate;
 
-    private static final ObjectMapper objectMapper = new ObjectMapper();
+    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
     @Override
     public List<Event> getEvents( EventSearchParams params, List<OrganisationUnit> organisationUnits )
@@ -135,7 +135,7 @@
 
                         try
                         {
-                            List<Double> list = objectMapper.readValue( coordinate.getCoordinateString(),
+                            List<Double> list = OBJECT_MAPPER.readValue( coordinate.getCoordinateString(),
                                 new TypeReference<List<Double>>()
                                 {
                                 } );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/csv/DefaultCsvEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/csv/DefaultCsvEventService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/csv/DefaultCsvEventService.java	2015-09-13 21:54:23 +0000
@@ -52,19 +52,19 @@
  */
 public class DefaultCsvEventService implements CsvEventService
 {
-    private static CsvMapper csvMapper = new CsvMapper();
+    private static CsvMapper CSV_MAPPER = new CsvMapper();
 
-    private static CsvSchema csvSchema = csvMapper.schemaFor( CsvEventDataValue.class ).withLineSeparator( "\n" );
+    private static CsvSchema CSV_SCHEMA = CSV_MAPPER.schemaFor( CsvEventDataValue.class ).withLineSeparator( "\n" );
 
     static
     {
-        csvMapper.enable( CsvParser.Feature.WRAP_AS_ARRAY );
+        CSV_MAPPER.enable( CsvParser.Feature.WRAP_AS_ARRAY );
     }
 
     @Override
     public void writeEvents( OutputStream outputStream, Events events, boolean withHeader ) throws IOException
     {
-        ObjectWriter writer = csvMapper.writer( csvSchema.withUseHeader( withHeader ) );
+        ObjectWriter writer = CSV_MAPPER.writer( CSV_SCHEMA.withUseHeader( withHeader ) );
 
         List<CsvEventDataValue> dataValues = new ArrayList<>();
 
@@ -111,8 +111,8 @@
     {
         Events events = new Events();
 
-        ObjectReader reader = csvMapper.reader( CsvEventDataValue.class )
-            .with( csvSchema.withSkipFirstDataRow( skipFirst ) );
+        ObjectReader reader = CSV_MAPPER.reader( CsvEventDataValue.class )
+            .with( CSV_SCHEMA.withSkipFirstDataRow( skipFirst ) );
 
         MappingIterator<CsvEventDataValue> iterator = reader.readValues( inputStream );
         Event event = new Event();

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/AbstractEventRowService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/AbstractEventRowService.java	2015-05-19 07:46:07 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/AbstractEventRowService.java	2015-09-13 21:54:23 +0000
@@ -28,11 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-
-import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.dxf2.events.event.EventSearchParams;
 import org.hisp.dhis.dxf2.events.event.EventService;
-import org.hisp.dhis.dxf2.events.trackedentity.TrackedEntityInstanceService;
 import org.springframework.beans.factory.annotation.Autowired;
 
 /**
@@ -48,12 +45,6 @@
     @Autowired
     private EventService eventService;
 
-    @Autowired
-    private IdentifiableObjectManager manager;
-
-    @Autowired
-    private TrackedEntityInstanceService trackedEntityInstanceService;
-
     @Override
     public EventRows getEventRows( EventSearchParams params )
     {               

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/EventRow.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/EventRow.java	2015-09-03 09:03:51 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/EventRow.java	2015-09-13 21:54:23 +0000
@@ -257,33 +257,67 @@
     public boolean equals( Object o )
     {
         if ( this == o )
+        {
             return true;
+        }
+        
         if ( o == null || getClass() != o.getClass() )
+        {
             return false;
+        }
 
         EventRow eventRow1 = (EventRow) o;
 
         if ( event != null ? !event.equals( eventRow1.event ) : eventRow1.event != null )
-            return false;
-        if ( attributes != null ? !attributes.equals( eventRow1.attributes ) : eventRow1.attributes != null ) 
-            return false;
-        if ( dataValues != null ? !dataValues.equals( eventRow1.dataValues ) : eventRow1.dataValues != null ) 
-            return false;        
+        {
+            return false;
+        }
+        
+        if ( attributes != null ? !attributes.equals( eventRow1.attributes ) : eventRow1.attributes != null )
+        {
+            return false;
+        }
+        
+        if ( dataValues != null ? !dataValues.equals( eventRow1.dataValues ) : eventRow1.dataValues != null )
+        {
+            return false;
+        }
+        
         if ( eventDate != null ? !eventDate.equals( eventRow1.eventDate ) : eventRow1.eventDate != null )
+        {
             return false;
+        }
+        
         if ( dueDate != null ? !dueDate.equals( eventRow1.dueDate ) : eventRow1.dueDate != null )
+        {
             return false;
+        }
+        
         if ( orgUnitName != null ? !orgUnitName.equals( eventRow1.orgUnitName ) : eventRow1.orgUnitName != null )
-            return false;        
+        {
+            return false;
+        }
+        
         if ( orgUnit != null ? !orgUnit.equals( eventRow1.orgUnit ) : eventRow1.orgUnit != null )
+        {
             return false;
+        }
+        
         if ( trackedEntityInstance != null ? !trackedEntityInstance.equals( eventRow1.trackedEntityInstance )
             : eventRow1.trackedEntityInstance != null )
+        {
             return false;
+        }
+        
         if ( program != null ? !program.equals( eventRow1.program ) : eventRow1.program != null )
+        {
             return false;
+        }
+        
         if ( programStage != null ? !programStage.equals( eventRow1.programStage ) : eventRow1.programStage != null )
+        {
             return false;
+        }
 
         return true;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2015-09-13 21:54:23 +0000
@@ -361,10 +361,6 @@
         {
             teiService.deleteTrackedEntityInstance( entityInstance );
         }
-        else
-        {
-            throw new IllegalArgumentException();
-        }
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/Attribute.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/Attribute.java	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/Attribute.java	2015-09-13 21:54:23 +0000
@@ -137,15 +137,29 @@
         Attribute attribute1 = (Attribute) o;
 
         if ( attribute != null ? !attribute.equals( attribute1.attribute ) : attribute1.attribute != null )
+        {
             return false;
+        }
+        
         if ( displayName != null ? !displayName.equals( attribute1.displayName ) : attribute1.displayName != null )
+        {
             return false;
+        }
+        
         if ( valueType != null ? !valueType.equals( attribute1.valueType ) : attribute1.valueType != null )
+        {
             return false;
+        }
+        
         if ( code != null ? !code.equals( attribute1.code ) : attribute1.code != null )
+        {
             return false;
+        }
+        
         if ( value != null ? !value.equals( attribute1.value ) : attribute1.value != null )
+        {
             return false;
+        }
 
         return true;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/JacksonTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/JacksonTrackedEntityInstanceService.java	2015-06-08 10:05:46 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/JacksonTrackedEntityInstanceService.java	2015-09-13 21:54:23 +0000
@@ -55,42 +55,42 @@
     // Implementation
     // -------------------------------------------------------------------------
 
-    private final static ObjectMapper xmlMapper = new XmlMapper();
+    private static final ObjectMapper XML_MAPPER = new XmlMapper();
 
-    private final static ObjectMapper jsonMapper = new ObjectMapper();
+    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
 
     @SuppressWarnings( "unchecked" )
     private static <T> T fromXml( InputStream inputStream, Class<?> clazz ) throws IOException
     {
-        return (T) xmlMapper.readValue( inputStream, clazz );
+        return (T) XML_MAPPER.readValue( inputStream, clazz );
     }
 
     @SuppressWarnings( "unchecked" )
     private static <T> T fromXml( String input, Class<?> clazz ) throws IOException
     {
-        return (T) xmlMapper.readValue( input, clazz );
+        return (T) XML_MAPPER.readValue( input, clazz );
     }
 
     @SuppressWarnings( "unchecked" )
     private static <T> T fromJson( InputStream inputStream, Class<?> clazz ) throws IOException
     {
-        return (T) jsonMapper.readValue( inputStream, clazz );
+        return (T) JSON_MAPPER.readValue( inputStream, clazz );
     }
 
     @SuppressWarnings( "unchecked" )
     private static <T> T fromJson( String input, Class<?> clazz ) throws IOException
     {
-        return (T) jsonMapper.readValue( input, clazz );
+        return (T) JSON_MAPPER.readValue( input, clazz );
     }
 
     static
     {
-        xmlMapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
-        xmlMapper.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
-        xmlMapper.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
-        jsonMapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
-        jsonMapper.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
-        jsonMapper.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
+        XML_MAPPER.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
+        XML_MAPPER.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
+        XML_MAPPER.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
+        JSON_MAPPER.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
+        JSON_MAPPER.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
+        JSON_MAPPER.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java	2015-07-13 11:12:16 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java	2015-09-13 21:54:23 +0000
@@ -315,11 +315,11 @@
     private void updateFields( FieldMap fieldMap, Class<?> klass )
     {
         // we need two run this (at least) two times, since some of the presets might contain other presets
-        _updateFields( fieldMap, klass, true );
-        _updateFields( fieldMap, klass, false );
+        updateFields( fieldMap, klass, true );
+        updateFields( fieldMap, klass, false );
     }
 
-    private void _updateFields( FieldMap fieldMap, Class<?> klass, boolean expandOnly )
+    private void updateFields( FieldMap fieldMap, Class<?> klass, boolean expandOnly )
     {
         Schema schema = schemaService.getDynamicSchema( klass );
         List<String> cleanupFields = Lists.newArrayList();

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/GmlConversionUtils.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/GmlConversionUtils.java	2015-03-31 08:46:53 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/GmlConversionUtils.java	2015-09-13 21:54:23 +0000
@@ -57,12 +57,12 @@
 
         StringBuilder sb = new StringBuilder();
 
-        for ( String c : coordinates.trim().split( "\\s" ) )
+        for ( String coordinate : coordinates.trim().split( "\\s" ) )
         {
-            String[] p = c.split( "," );
+            String[] point = coordinate.split( "," );
 
-            String lat = parseCoordinate( p[0], nDecimals, NF ),
-                   lon = parseCoordinate( p[1], nDecimals, NF );
+            String lat = parseCoordinate( point[0], nDecimals, NF ),
+                   lon = parseCoordinate( point[1], nDecimals, NF );
 
             sb.append( "[" ).append( lat ).append( "," ).append( lon ).append( "]," );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultMetaDataDependencyService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultMetaDataDependencyService.java	2015-05-30 13:36:07 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultMetaDataDependencyService.java	2015-09-13 21:54:23 +0000
@@ -58,7 +58,6 @@
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.schema.Schema;
 import org.hisp.dhis.schema.SchemaService;
 import org.hisp.dhis.system.util.ReflectionUtils;
@@ -97,9 +96,6 @@
     private ConstantService constantService;
 
     @Autowired
-    private OrganisationUnitService organisationUnitService;
-
-    @Autowired
     private SchemaService schemaService;
 
     //--------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2015-09-13 21:54:23 +0000
@@ -372,7 +372,7 @@
     @Override
     public <T> T getObject( T object )
     {
-        Set<T> objects = _findMatches( object );
+        Set<T> objects = findMatches( object );
 
         if ( objects.size() == 1 )
         {
@@ -409,7 +409,7 @@
     @Override
     public <T> Set<T> getObjects( T object )
     {
-        return _findMatches( object );
+        return findMatches( object );
     }
 
     @Override
@@ -448,7 +448,7 @@
     //-------------------------------------------------------------------------------------------------------
 
     @SuppressWarnings( "unchecked" )
-    private <T> Set<T> _findMatches( T object )
+    private <T> Set<T> findMatches( T object )
     {
         Set<T> objects = new HashSet<>();
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2015-08-19 14:42:27 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2015-09-13 21:54:23 +0000
@@ -940,7 +940,7 @@
 
         private User user;
 
-        public NonIdentifiableObjects( User user )
+        private NonIdentifiableObjects( User user )
         {
             this.user = user;
         }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/OpFactory.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/OpFactory.java	2015-03-09 08:11:37 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/OpFactory.java	2015-09-13 21:54:23 +0000
@@ -52,7 +52,7 @@
  */
 public class OpFactory
 {
-    protected static Map<String, Class<? extends Op>> register = Maps.newHashMap();
+    protected static Map<String, Class<? extends Op>> REGISTER = Maps.newHashMap();
 
     static
     {
@@ -78,17 +78,17 @@
 
     public static void register( String type, Class<? extends Op> opClass )
     {
-        register.put( type.toLowerCase(), opClass );
+        REGISTER.put( type.toLowerCase(), opClass );
     }
 
     public static boolean canCreate( String type )
     {
-        return register.containsKey( type.toLowerCase() );
+        return REGISTER.containsKey( type.toLowerCase() );
     }
 
     public static Op create( String type )
     {
-        Class<? extends Op> opClass = register.get( type.toLowerCase() );
+        Class<? extends Op> opClass = REGISTER.get( type.toLowerCase() );
 
         try
         {

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/ops/InOp.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/ops/InOp.java	2015-06-05 03:07:51 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/ops/InOp.java	2015-09-13 21:54:23 +0000
@@ -65,41 +65,41 @@
             String s1 = getValue( String.class, item );
             String s2 = (String) object;
 
-            return (s1 != null && s2.equals( s1 ));
+            return s1 != null && s2.equals( s1 );
         }
         else if ( Boolean.class.isInstance( object ) )
         {
             Boolean s1 = getValue( Boolean.class, item );
             Boolean s2 = (Boolean) object;
 
-            return (s1 != null && s2.equals( s1 ));
+            return s1 != null && s2.equals( s1 );
         }
         else if ( Integer.class.isInstance( object ) )
         {
             Integer s1 = getValue( Integer.class, item );
             Integer s2 = (Integer) object;
 
-            return (s1 != null && s2.equals( s1 ));
+            return s1 != null && s2.equals( s1 );
         }
         else if ( Float.class.isInstance( object ) )
         {
             Float s1 = getValue( Float.class, item );
             Float s2 = (Float) object;
 
-            return (s1 != null && s2.equals( s1 ));
+            return s1 != null && s2.equals( s1 );
         }
         else if ( Date.class.isInstance( object ) )
         {
             Date s1 = getValue( Date.class, item );
             Date s2 = (Date) object;
 
-            return (s1 != null && s2.equals( s1 ));
+            return s1 != null && s2.equals( s1 );
         }
         else if ( Enum.class.isInstance( object ) )
         {
             String s2 = String.valueOf( object );
 
-            return (item != null && s2.equals( item ));
+            return item != null && s2.equals( item );
         }
 
         return false;

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/DefaultPdfDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/DefaultPdfDataEntryFormService.java	2015-09-10 16:35:55 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/DefaultPdfDataEntryFormService.java	2015-09-13 21:54:23 +0000
@@ -28,24 +28,14 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.lowagie.text.Chunk;
-import com.lowagie.text.Document;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.Element;
-import com.lowagie.text.Font;
-import com.lowagie.text.Paragraph;
-import com.lowagie.text.Phrase;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.pdf.PdfAnnotation;
-import com.lowagie.text.pdf.PdfAppearance;
-import com.lowagie.text.pdf.PdfBorderDictionary;
-import com.lowagie.text.pdf.PdfContentByte;
-import com.lowagie.text.pdf.PdfFormField;
-import com.lowagie.text.pdf.PdfPCell;
-import com.lowagie.text.pdf.PdfPTable;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.text.pdf.RadioCheckField;
-import com.lowagie.text.pdf.TextField;
+import java.awt.Color;
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.List;
+
 import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -74,18 +64,28 @@
 import org.hisp.dhis.program.ProgramStageService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.awt.*;
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.List;
+import com.lowagie.text.Chunk;
+import com.lowagie.text.Document;
+import com.lowagie.text.DocumentException;
+import com.lowagie.text.Element;
+import com.lowagie.text.Font;
+import com.lowagie.text.Paragraph;
+import com.lowagie.text.Phrase;
+import com.lowagie.text.Rectangle;
+import com.lowagie.text.pdf.PdfAnnotation;
+import com.lowagie.text.pdf.PdfAppearance;
+import com.lowagie.text.pdf.PdfBorderDictionary;
+import com.lowagie.text.pdf.PdfContentByte;
+import com.lowagie.text.pdf.PdfFormField;
+import com.lowagie.text.pdf.PdfPCell;
+import com.lowagie.text.pdf.PdfPTable;
+import com.lowagie.text.pdf.PdfWriter;
+import com.lowagie.text.pdf.RadioCheckField;
+import com.lowagie.text.pdf.TextField;
 
 /**
  * @author James Chang
  */
-
 public class DefaultPdfDataEntryFormService
     implements PdfDataEntryFormService
 {
@@ -125,14 +125,13 @@
     private OptionService optionService;
 
     // -------------------------------------------------------------------------
-    // METHODS / CLASSES
+    // PdfDataEntryFormService implementation
     // -------------------------------------------------------------------------
 
     @Override
     public void generatePDFDataEntryForm( Document document, PdfWriter writer, String dataSetUid, int typeId,
         Rectangle pageSize, PdfFormFontSettings pdfFormFontSettings, I18nFormat format )
     {
-
         try
         {
             this.pdfFormFontSettings = pdfFormFontSettings;
@@ -150,13 +149,14 @@
             {
                 setProgramStage_DocumentContent( document, writer, dataSetUid );
             }
-
+        }
+        catch ( Exception ex )
+        {
+            throw new RuntimeException( ex );
+        }
+        finally
+        {
             document.close();
-
-        }
-        catch ( Exception ex )
-        {
-            ex.printStackTrace();
         }
     }
 
@@ -167,7 +167,7 @@
 
         if ( dataSet == null )
         {
-            throw new Exception( "Error - DataSet not found for UID " + dataSetUid );
+            throw new RuntimeException( "Error - DataSet not found for UID " + dataSetUid );
         }
 
         // Get I18n locale language translated version of DataSet
@@ -324,7 +324,7 @@
 
         if ( programStage == null )
         {
-            throw new Exception( "Error - ProgramStage not found for UID " + programStageUid );
+            throw new RuntimeException( "Error - ProgramStage not found for UID " + programStageUid );
         }
         else
         {

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfDataEntryFormUtil.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfDataEntryFormUtil.java	2015-07-06 10:12:37 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfDataEntryFormUtil.java	2015-09-13 21:54:23 +0000
@@ -84,15 +84,15 @@
 
     private static final Color COLOR_CELLBORDER = Color.getHSBColor( 0.0f, 0.0f, 0.863f);
 
-    public final static float CELL_MIN_HEIGHT_DEFAULT = 14;
-
-    public final static float CONTENT_HEIGHT_DEFAULT = 12;
-
-    public final static int CELL_COLUMN_TYPE_LABEL = 0;
-
-    public final static int CELL_COLUMN_TYPE_ENTRYFIELD = 1;
-
-    public final static int CELL_COLUMN_TYPE_HEADER = 2;
+    public static final float CELL_MIN_HEIGHT_DEFAULT = 14;
+
+    public static final float CONTENT_HEIGHT_DEFAULT = 12;
+
+    public static final int CELL_COLUMN_TYPE_LABEL = 0;
+
+    public static final int CELL_COLUMN_TYPE_ENTRYFIELD = 1;
+
+    public static final int CELL_COLUMN_TYPE_HEADER = 2;
 
     private static final String DATAVALUE_IMPORT_STOREBY = "admin";
 
@@ -193,7 +193,7 @@
     }
 
     /**
-	 * Creates data value set from Input Stream (PDF) for PDF data import
+     * Creates data value set from Input Stream (PDF) for PDF data import
      */
     public static DataValueSet getDataValueSet( InputStream in )
     {
@@ -211,27 +211,26 @@
 
             if ( form != null )
             {
-
                 // Process OrgUnitUID and PeriodID from the PDF Form
 
-                String orgUnitUID = form.getField( PdfDataEntryFormUtil.LABELCODE_ORGID ).trim();
-                String periodID = form.getField( PdfDataEntryFormUtil.LABELCODE_PERIODID ).trim();
+                String orgUnitUid = form.getField( PdfDataEntryFormUtil.LABELCODE_ORGID ).trim();
+                String periodId = form.getField( PdfDataEntryFormUtil.LABELCODE_PERIODID ).trim();
 
-                if ( periodID == "" )
+                if ( periodId == null || periodId.isEmpty() )
                 {
                     throw new IllegalArgumentException( ERROR_EMPTY_PERIOD );
                 }
 
-                if ( orgUnitUID == "" )
+                if ( orgUnitUid == null || orgUnitUid.isEmpty() )
                 {
                     throw new IllegalArgumentException( ERROR_EMPTY_ORG_UNIT );
                 }
 
-                Period period = PeriodType.getPeriodFromIsoString( periodID );
+                Period period = PeriodType.getPeriodFromIsoString( periodId );
                 
                 if ( period == null )
                 {
-                    throw new IllegalArgumentException( ERROR_INVALID_PERIOD + periodID );
+                    throw new IllegalArgumentException( ERROR_INVALID_PERIOD + periodId );
                 }
                 
                 // Loop Through the Fields and get data.
@@ -250,7 +249,7 @@
 
                         dataValue.setDataElement( strArrFldName[1] );
                         dataValue.setCategoryOptionCombo( strArrFldName[2] );
-                        dataValue.setOrgUnit( orgUnitUID );
+                        dataValue.setOrgUnit( orgUnitUid );
                         dataValue.setPeriod( period.getIsoDate() );
                         
                         dataValue.setValue( fieldValueFormat( strArrFldName, form.getField( fldName ) ) );     

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfFieldCell.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfFieldCell.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfFieldCell.java	2015-09-13 21:54:23 +0000
@@ -55,29 +55,29 @@
 public class PdfFieldCell
     implements PdfPCellEvent
 {
-    public final static int TYPE_DEFAULT = 0;
-
-    public final static int TYPE_BUTTON = 1;
-
-    public final static int TYPE_TEXT_ORGUNIT = 2;
-
-    public final static int TYPE_TEXT_NUMBER = 3;
-
-    public final static int TYPE_CHECKBOX = 4;
-
-    public final static int TYPE_RADIOBUTTON = 5;
-
-    public final static int TPYE_LABEL = 6;
-
-    public final static String TPYEDEFINE_NAME = "T";    
+    public static final int TYPE_DEFAULT = 0;
+
+    public static final int TYPE_BUTTON = 1;
+
+    public static final int TYPE_TEXT_ORGUNIT = 2;
+
+    public static final int TYPE_TEXT_NUMBER = 3;
+
+    public static final int TYPE_CHECKBOX = 4;
+
+    public static final int TYPE_RADIOBUTTON = 5;
+
+    public static final int TPYE_LABEL = 6;
+
+    public static final String TPYEDEFINE_NAME = "T";    
     
-    private final static float RADIOBUTTON_WIDTH = 10.0f;
-
-    private final static float RADIOBUTTON_TEXTOFFSET = 3.0f;
-
-    private final static float offSetTop = 0.5f;
-
-    private final static float offSetLeft = 3.0f;
+    private static final float RADIOBUTTON_WIDTH = 10.0f;
+
+    private static final float RADIOBUTTON_TEXTOFFSET = 3.0f;
+
+    private static final float OFFSET_TOP = 0.5f;
+
+    private static final float OFFSET_LEFT = 3.0f;
     
     private PdfFormField parent;
 
@@ -222,10 +222,10 @@
                 float extraCheckBoxOffset_Top = 1.5f;
                 
                 formField.setWidget(
-                    new Rectangle( rect.getLeft() + offSetLeft + extraCheckBoxOffset_Left
-                        , rect.getTop() - height - offSetTop - extraCheckBoxOffset_Top
-                        , rect.getLeft() + width + offSetLeft + extraCheckBoxOffset_Left
-                        , rect.getTop() - offSetTop - extraCheckBoxOffset_Top ),
+                    new Rectangle( rect.getLeft() + OFFSET_LEFT + extraCheckBoxOffset_Left
+                        , rect.getTop() - height - OFFSET_TOP - extraCheckBoxOffset_Top
+                        , rect.getLeft() + width + OFFSET_LEFT + extraCheckBoxOffset_Left
+                        , rect.getTop() - OFFSET_TOP - extraCheckBoxOffset_Top ),
                     PdfAnnotation.HIGHLIGHT_NONE );
             }            
             else
@@ -240,7 +240,7 @@
                 // TYPE_TEXT_NUMBER and TYPE_CHECKBOX cases included as well here
                 
                 formField.setWidget(
-                    new Rectangle( rect.getLeft() + offSetLeft, rect.getTop() - height - offSetTop, rect.getLeft() + width + offSetLeft, rect.getTop() - offSetTop ),
+                    new Rectangle( rect.getLeft() + OFFSET_LEFT, rect.getTop() - height - OFFSET_TOP, rect.getLeft() + width + OFFSET_LEFT, rect.getTop() - OFFSET_TOP ),
                     PdfAnnotation.HIGHLIGHT_NONE );
 
             }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfFormFontSettings.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfFormFontSettings.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/pdfform/PdfFormFontSettings.java	2015-09-13 21:54:23 +0000
@@ -39,27 +39,27 @@
 
 public class PdfFormFontSettings
 {
-    public final static int FONTTYPE_BODY = 0;
-
-    public final static int FONTTYPE_TITLE = 1;
-
-    public final static int FONTTYPE_DESCRIPTION = 2;
-
-    public final static int FONTTYPE_SECTIONHEADER = 3;
-
-    public final static int FONTTYPE_FOOTER = 4;
-
-    private final static float FONTSIZE_BODY = 10;
-
-    private final static float FONTSIZE_TITLE = 16;
-
-    private final static float FONTSIZE_DESCRIPTION = 11;
-
-    private final static float FONTSIZE_SECTIONHEADER = 14;
-
-    private final static float FONTSIZE_FOOTER = 8;
-
-    private final static String FONTFAMILY = "HELVETICA";
+    public static final int FONTTYPE_BODY = 0;
+
+    public static final int FONTTYPE_TITLE = 1;
+
+    public static final int FONTTYPE_DESCRIPTION = 2;
+
+    public static final int FONTTYPE_SECTIONHEADER = 3;
+
+    public static final int FONTTYPE_FOOTER = 4;
+
+    private static final float FONTSIZE_BODY = 10;
+
+    private static final float FONTSIZE_TITLE = 16;
+
+    private static final float FONTSIZE_DESCRIPTION = 11;
+
+    private static final float FONTSIZE_SECTIONHEADER = 14;
+
+    private static final float FONTSIZE_FOOTER = 8;
+
+    private static final String FONTFAMILY = "HELVETICA";
 
     private final Map<Integer, Font> fontTypeMap = new HashMap<>();
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java	2015-09-09 12:28:08 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java	2015-09-13 21:54:23 +0000
@@ -28,23 +28,29 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.apache.commons.lang3.StringUtils.trimToNull;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_LAST_SUCCESSFUL_DATA_SYNC;
+
+import java.io.IOException;
+import java.util.Date;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.commons.util.CodecUtils;
 import org.hisp.dhis.configuration.Configuration;
 import org.hisp.dhis.configuration.ConfigurationService;
 import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.dxf2.common.IdSchemes;
+import org.hisp.dhis.dxf2.common.ImportSummaryResponseExtractor;
+import org.hisp.dhis.dxf2.common.JacksonUtils;
 import org.hisp.dhis.dxf2.datavalueset.DataValueSetService;
 import org.hisp.dhis.dxf2.importsummary.ImportStatus;
 import org.hisp.dhis.dxf2.importsummary.ImportSummary;
 import org.hisp.dhis.dxf2.metadata.ImportService;
 import org.hisp.dhis.dxf2.metadata.MetaData;
-import org.hisp.dhis.dxf2.common.IdSchemes;
-import org.hisp.dhis.dxf2.common.ImportSummaryResponseExtractor;
-import org.hisp.dhis.dxf2.common.JacksonUtils;
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
-import org.hisp.dhis.commons.util.CodecUtils;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpEntity;
@@ -54,7 +60,6 @@
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.client.ClientHttpRequest;
-import org.springframework.scheduling.TaskScheduler;
 import org.springframework.web.client.HttpClientErrorException;
 import org.springframework.web.client.HttpServerErrorException;
 import org.springframework.web.client.RequestCallback;
@@ -62,12 +67,6 @@
 import org.springframework.web.client.ResponseExtractor;
 import org.springframework.web.client.RestTemplate;
 
-import java.io.IOException;
-import java.util.Date;
-
-import static org.apache.commons.lang3.StringUtils.trimToNull;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_LAST_SUCCESSFUL_DATA_SYNC;
-
 /**
  * @author Lars Helge Overland
  */
@@ -100,9 +99,6 @@
     @Autowired
     private RestTemplate restTemplate;
 
-    @Autowired
-    private TaskScheduler taskScheduler;
-
     // -------------------------------------------------------------------------
     // SynchronizatonManager implementation
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/adx/ADXPeriodTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/adx/ADXPeriodTest.java	2015-07-08 16:24:28 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/adx/ADXPeriodTest.java	2015-09-13 21:54:23 +0000
@@ -39,8 +39,7 @@
  */
 public class ADXPeriodTest
 {
-
-    private Period p;
+    private Period period;
 
     public ADXPeriodTest()
     {
@@ -51,20 +50,20 @@
     {
         try 
         {
-            p = ADXPeriod.parse( "2015-01-01/P1Y" );
-            assertEquals( "2015", p.getIsoDate() );
-            p = ADXPeriod.parse( "2015-01-01/P1M" );
-            assertEquals( "201501", p.getIsoDate() );
-            p = ADXPeriod.parse( "2015-01-01/P1D" );
-            assertEquals( "20150101", p.getIsoDate() );
-            p = ADXPeriod.parse( "2015-01-01/P1Q" );
-            assertEquals( "2015Q1", p.getIsoDate() );
-            p = ADXPeriod.parse( "2015-04-01/P1Q" );
-            assertEquals( "2015Q2", p.getIsoDate() );
-            p = ADXPeriod.parse( "2015-01-01/P7D" );
-            assertEquals( "2015W1", p.getIsoDate() );
-            p = ADXPeriod.parse( "2015-01-05/P7D" );
-            assertEquals( "2015W2", p.getIsoDate() );
+            period = ADXPeriod.parse( "2015-01-01/P1Y" );
+            assertEquals( "2015", period.getIsoDate() );
+            period = ADXPeriod.parse( "2015-01-01/P1M" );
+            assertEquals( "201501", period.getIsoDate() );
+            period = ADXPeriod.parse( "2015-01-01/P1D" );
+            assertEquals( "20150101", period.getIsoDate() );
+            period = ADXPeriod.parse( "2015-01-01/P1Q" );
+            assertEquals( "2015Q1", period.getIsoDate() );
+            period = ADXPeriod.parse( "2015-04-01/P1Q" );
+            assertEquals( "2015Q2", period.getIsoDate() );
+            period = ADXPeriod.parse( "2015-01-01/P7D" );
+            assertEquals( "2015W1", period.getIsoDate() );
+            period = ADXPeriod.parse( "2015-01-05/P7D" );
+            assertEquals( "2015W2", period.getIsoDate() );
         }
         catch (ADXException ex)
         {
@@ -77,7 +76,7 @@
     {
         try
         {
-            p = ADXPeriod.parse( "2014-01-01/P1" );
+            period = ADXPeriod.parse( "2014-01-01/P1" );
             fail( "Should have thrown exception parsing 2015-01-01/P1" );
         } 
         catch ( Exception ex )
@@ -91,14 +90,14 @@
     {
         try
         {
-            p = ADXPeriod.parse( "2015-01-01/P1Y" );
-            assertEquals( "2015", p.getIsoDate() );
-            p = ADXPeriod.parse( "2015-04-01/P1Y" );
-            assertEquals( "2015April", p.getIsoDate() );
-            p = ADXPeriod.parse( "2015-07-01/P1Y" );
-            assertEquals( "2015July", p.getIsoDate() );
-            p = ADXPeriod.parse( "2015-10-01/P1Y" );
-            assertEquals( "2015Oct", p.getIsoDate() );
+            period = ADXPeriod.parse( "2015-01-01/P1Y" );
+            assertEquals( "2015", period.getIsoDate() );
+            period = ADXPeriod.parse( "2015-04-01/P1Y" );
+            assertEquals( "2015April", period.getIsoDate() );
+            period = ADXPeriod.parse( "2015-07-01/P1Y" );
+            assertEquals( "2015July", period.getIsoDate() );
+            period = ADXPeriod.parse( "2015-10-01/P1Y" );
+            assertEquals( "2015Oct", period.getIsoDate() );
         }
         catch (ADXException ex)
         {
@@ -111,7 +110,7 @@
     {
         try
         {
-            p = ADXPeriod.parse( "2014-02-01/P1Y" );
+            period = ADXPeriod.parse( "2014-02-01/P1Y" );
             fail( "Should have thrown exception parsing 2014-02-01/P1Y" );
         } 
         catch ( Exception ex )
@@ -123,19 +122,19 @@
     @Test
     public void testSerialize()
     {
-        p = PeriodType.getPeriodFromIsoString( "2015" );
-        assertEquals( "2015-01-01/P1Y", ADXPeriod.serialize( p ) );
-        p = PeriodType.getPeriodFromIsoString( "201503" );
-        assertEquals( "2015-03-01/P1M", ADXPeriod.serialize( p ) );
-        p = PeriodType.getPeriodFromIsoString( "2015W1" );
-        assertEquals( "2014-12-29/P7D", ADXPeriod.serialize( p ) );
-        p = PeriodType.getPeriodFromIsoString( "2015Q2" );
-        assertEquals( "2015-04-01/P1Q", ADXPeriod.serialize( p ) );
-        p = PeriodType.getPeriodFromIsoString( "2015April" );
-        assertEquals( "2015-04-01/P1Y", ADXPeriod.serialize( p ) );
-        p = PeriodType.getPeriodFromIsoString( "2015S2" );
-        assertEquals( "2015-07-01/P6M", ADXPeriod.serialize( p ) );
-        p = PeriodType.getPeriodFromIsoString( "2015AprilS2" );
-        assertEquals( "2015-10-01/P6M", ADXPeriod.serialize( p ) );
+        period = PeriodType.getPeriodFromIsoString( "2015" );
+        assertEquals( "2015-01-01/P1Y", ADXPeriod.serialize( period ) );
+        period = PeriodType.getPeriodFromIsoString( "201503" );
+        assertEquals( "2015-03-01/P1M", ADXPeriod.serialize( period ) );
+        period = PeriodType.getPeriodFromIsoString( "2015W1" );
+        assertEquals( "2014-12-29/P7D", ADXPeriod.serialize( period ) );
+        period = PeriodType.getPeriodFromIsoString( "2015Q2" );
+        assertEquals( "2015-04-01/P1Q", ADXPeriod.serialize( period ) );
+        period = PeriodType.getPeriodFromIsoString( "2015April" );
+        assertEquals( "2015-04-01/P1Y", ADXPeriod.serialize( period ) );
+        period = PeriodType.getPeriodFromIsoString( "2015S2" );
+        assertEquals( "2015-07-01/P6M", ADXPeriod.serialize( period ) );
+        period = PeriodType.getPeriodFromIsoString( "2015AprilS2" );
+        assertEquals( "2015-10-01/P6M", ADXPeriod.serialize( period ) );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/gml/GmlImportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/gml/GmlImportServiceTest.java	2015-08-30 17:07:42 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/gml/GmlImportServiceTest.java	2015-09-13 21:54:23 +0000
@@ -74,7 +74,7 @@
 
     @Autowired
     private OrganisationUnitService organisationUnitService;
-
+    
     @Autowired
     private UserService userService;
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/DefaultExportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/DefaultExportServiceTest.java	2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/DefaultExportServiceTest.java	2015-09-13 21:54:23 +0000
@@ -38,13 +38,9 @@
 import org.hisp.dhis.DhisConvenienceTest;
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.dxf2.datavalueset.DataValueSetService;
 import org.hisp.dhis.dxf2.common.JacksonUtils;
 import org.hisp.dhis.dxf2.common.Options;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -68,9 +64,6 @@
     private DataElementService dataElementService;
 
     @Autowired
-    private DataElementCategoryService categoryService;
-
-    @Autowired
     private DataSetService dataSetService;
 
     @Autowired
@@ -79,15 +72,6 @@
     @Autowired
     private PeriodService periodService;
 
-    @Autowired
-    private DataValueSetService dataValueSetService;
-
-    @Autowired
-    private DataValueService dataValueService;
-
-    @Autowired
-    private CompleteDataSetRegistrationService registrationService;
-
     private DataElement deA;
 
     private DataElement deB;

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dataelementhistory/DefaultHistoryRetriever.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dataelementhistory/DefaultHistoryRetriever.java	2015-09-10 16:35:55 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dataelementhistory/DefaultHistoryRetriever.java	2015-09-13 21:54:23 +0000
@@ -183,13 +183,13 @@
         double value = Double.MAX_VALUE;
         List<DataElementHistoryPoint> historyPoints = history.getHistoryPoints();
 
-        for ( DataElementHistoryPoint DEPoint : historyPoints )
+        for ( DataElementHistoryPoint point : historyPoints )
         {
-            if ( DEPoint.getValue() != null )
+            if ( point.getValue() != null )
             {
-                if ( DEPoint.getValue() < value )
+                if ( point.getValue() < value )
                 {
-                    value = DEPoint.getValue();
+                    value = point.getValue();
                 }
             }
         }
@@ -210,13 +210,13 @@
         double value = Double.NEGATIVE_INFINITY;
         List<DataElementHistoryPoint> historyPoints = history.getHistoryPoints();
 
-        for ( DataElementHistoryPoint DEPoint : historyPoints )
+        for ( DataElementHistoryPoint point : historyPoints )
         {
-            if ( DEPoint.getValue() != null )
+            if ( point.getValue() != null )
             {
-                if ( DEPoint.getValue() > value )
+                if ( point.getValue() > value )
                 {
-                    value = DEPoint.getValue();
+                    value = point.getValue();
                 }
             }
         }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/interpretation/impl/DefaultInterpretationService.java	2015-09-13 21:54:23 +0000
@@ -191,7 +191,7 @@
     {
         User user = currentUserService.getCurrentUser();
 
-        long count;
+        long count = 0;
 
         if ( user != null && user.getLastCheckedInterpretations() != null )
         {

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java	2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java	2015-09-13 21:54:23 +0000
@@ -363,10 +363,10 @@
 
         // Draw the two images onto the final image with the legend to the left
         // and the map to the right
-        Graphics g = finalImage.getGraphics();
-        g.drawImage( titleImage, 0, 0, null );
-        g.drawImage( legendImage, 0, MapUtils.TITLE_HEIGHT, null );
-        g.drawImage( mapImage, legendImage.getWidth(), MapUtils.TITLE_HEIGHT, null );
+        Graphics graphics = finalImage.getGraphics();
+        graphics.drawImage( titleImage, 0, 0, null );
+        graphics.drawImage( legendImage, 0, MapUtils.TITLE_HEIGHT, null );
+        graphics.drawImage( mapImage, legendImage.getWidth(), MapUtils.TITLE_HEIGHT, null );
 
         return finalImage;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsPrimitiveFromJsonFactory.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsPrimitiveFromJsonFactory.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsPrimitiveFromJsonFactory.java	2015-09-13 21:54:23 +0000
@@ -48,7 +48,7 @@
 public class GeoToolsPrimitiveFromJsonFactory
 {
     // Factory creating GeoTools geometric primitives
-    private static final GeometryFactory factory = JTSFactoryFinder.getGeometryFactory( null );
+    private static final GeometryFactory FACTORY = JTSFactoryFinder.getGeometryFactory( null );
 
     /**
      * Create a GeoTools geometric point primitive from coordinates in json.
@@ -58,7 +58,7 @@
      */
     public static Point createPointFromJson( JsonNode json )
     {
-        return factory.createPoint( createCoordinateFromJson( json ) );
+        return FACTORY.createPoint( createCoordinateFromJson( json ) );
     }
 
     /**
@@ -99,7 +99,7 @@
         }
 
         // Create the multi-polygon from factory
-        return factory.createMultiPolygon( polygons );
+        return FACTORY.createMultiPolygon( polygons );
     }
 
     /**
@@ -137,7 +137,7 @@
         }
 
         // Create the polygon from factory
-        return factory.createPolygon( sh, holes );
+        return FACTORY.createPolygon( sh, holes );
     }
 
     /**
@@ -163,6 +163,6 @@
         }
 
         // Create the linear-ring from factory
-        return factory.createLinearRing( coords );
+        return FACTORY.createLinearRing( coords );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/LegendItem.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/LegendItem.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/LegendItem.java	2015-09-13 21:54:23 +0000
@@ -59,13 +59,13 @@
         String label = String.format( "%.2f - %.2f (%d)", interval.getValueLow(), interval.getValueHigh(), interval
             .getMembers().size() );
         Stroke s = new BasicStroke( 1.0f );
-        Rectangle r = new Rectangle( 0, 0, WIDTH, HEIGHT );
+        Rectangle rect = new Rectangle( 0, 0, WIDTH, HEIGHT );
 
         g.setColor( interval.getColor() );
-        g.fill( r );
+        g.fill( rect );
         g.setPaint( Color.BLACK );
         g.setStroke( s );
-        g.draw( r );
+        g.draw( rect );
 
         g.setColor( Color.BLACK );
         g.setFont( Legend.PLAIN_FONT );

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/LegendSet.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/LegendSet.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/LegendSet.java	2015-09-13 21:54:23 +0000
@@ -87,16 +87,16 @@
         int imageWidth = LEGEND_TOTAL_WIDTH;
         int imageHeight = calculateImageHeight();
         BufferedImage image = new BufferedImage( imageWidth, imageHeight, BufferedImage.TYPE_INT_ARGB );
-        Graphics2D g = (Graphics2D) image.getGraphics();
+        Graphics2D graphics = (Graphics2D) image.getGraphics();
 
-        g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
-        g.translate( LEGEND_MARGIN_LEFT, 0 );
+        graphics.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
+        graphics.translate( LEGEND_MARGIN_LEFT, 0 );
 
         // Draw legends
         for ( Legend legend : legends )
         {
-            legend.draw( g, format );
-            g.translate( 0, LEGEND_MARGIN_BOTTOM );
+            legend.draw( graphics, format );
+            graphics.translate( 0, LEGEND_MARGIN_BOTTOM );
         }
 
         return image;

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/MapUtils.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/MapUtils.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/MapUtils.java	2015-09-13 21:54:23 +0000
@@ -188,11 +188,11 @@
         // Create an image and get the graphics context from it
         
         BufferedImage image = new BufferedImage( imageBounds.width, imageBounds.height, BufferedImage.TYPE_INT_ARGB );
-        Graphics2D g = (Graphics2D) image.getGraphics();
+        Graphics2D graphics = (Graphics2D) image.getGraphics();
 
-        g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
+        graphics.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
         
-        renderer.paint( g, imageBounds, mapBounds );
+        renderer.paint( graphics, imageBounds, mapBounds );
 
         mapContent.dispose();
         
@@ -293,13 +293,13 @@
     {
         String str = "Error creating map image: " + error;
         BufferedImage image = new BufferedImage( 500, 25, BufferedImage.TYPE_INT_RGB );
-        Graphics2D g = image.createGraphics();
-
-        g.setColor( Color.WHITE );
-        g.fill( new Rectangle( 500, 25 ) );
-
-        g.setColor( Color.RED );
-        g.drawString( str, 1, 12 );
+        Graphics2D graphics = image.createGraphics();
+
+        graphics.setColor( Color.WHITE );
+        graphics.fill( new Rectangle( 500, 25 ) );
+
+        graphics.setColor( Color.RED );
+        graphics.drawString( str, 1, 12 );
 
         return image;
     }