← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6438: Added ignores objects to import summary

 

------------------------------------------------------------
revno: 6438
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-03-29 14:02:12 +0200
message:
  Added ignores objects to import summary
modified:
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalue/DefaultDataValueService.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueController.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/datavalue/DefaultDataValueService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalue/DefaultDataValueService.java	2012-03-29 09:59:05 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalue/DefaultDataValueService.java	2012-03-29 12:02:12 +0000
@@ -81,11 +81,14 @@
         BatchHandler<DataValue> batchHandler = batchHandlerFactory.createBatchHandler( DataValueBatchHandler.class ).init();
 
         int importCount = 0;
-        int updateCount = 0;                
+        int updateCount = 0;
+        int totalCount = 0;
         
         for ( org.hisp.dhis.dxf2.datavalue.DataValue dataValue : dataValues.getDataValues() )
         {
             DataValue internalValue = new DataValue();
+
+            totalCount++;
             
             DataElement dataElement = dataElementMap.get( dataValue.getDataElement() );
             OrganisationUnit orgUnit = orgUnitMap.get( dataValue.getOrgUnit() );
@@ -135,7 +138,7 @@
                     }
 
                     updateCount++;
-                }
+                }                
             }
             else
             {
@@ -151,7 +154,9 @@
             }
         }
         
-        summary.getCounts().add( new ImportCount( DataValue.class.getSimpleName(), importCount, updateCount ) );
+        int ignores = totalCount - importCount - updateCount;
+        
+        summary.getCounts().add( new ImportCount( DataValue.class.getSimpleName(), importCount, updateCount, ignores ) );
         
         batchHandler.flush();
         

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java	2012-03-29 09:59:05 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java	2012-03-29 12:02:12 +0000
@@ -39,12 +39,15 @@
     private int imports;
     
     private int updates;
+    
+    private int ignores;
 
-    public ImportCount( String object, int imports, int updates )
+    public ImportCount( String object, int imports, int updates, int ignores )
     {
         this.object = object;
         this.imports = imports;
         this.updates = updates;
+        this.ignores = ignores;
     }
     
     @JsonProperty
@@ -82,4 +85,16 @@
     {
         this.updates = updates;
     }
+
+    @JsonProperty
+    @JacksonXmlProperty( isAttribute=true )
+    public int getIgnores()
+    {
+        return ignores;
+    }
+
+    public void setIgnores( int ignores )
+    {
+        this.ignores = ignores;
+    }    
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueController.java	2012-03-29 09:59:05 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueController.java	2012-03-29 12:02:12 +0000
@@ -68,11 +68,10 @@
                                 @RequestParam(required=false, defaultValue="NEW_AND_UPDATES") String strategy,
                                 HttpServletResponse response, 
                                 InputStream input,
-                                Model model )
-        throws IOException
+                                Model model ) throws IOException
     {
-        IdentifiableProperty _idScheme = IdentifiableProperty.valueOf( idScheme );        
-        ImportStrategy _strategy = ImportStrategy.valueOf( strategy );
+        IdentifiableProperty _idScheme = IdentifiableProperty.valueOf( idScheme.toUpperCase() );        
+        ImportStrategy _strategy = ImportStrategy.valueOf( strategy.toUpperCase() );
         
         DataValues dataValues = JacksonUtils.fromXml( input, DataValues.class );