← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22239: minor stats update

 

------------------------------------------------------------
revno: 22239
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2016-03-10 21:02:37 +0700
message:
  minor stats update
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/feedback/Stats.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleValidation.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-api/src/main/java/org/hisp/dhis/feedback/Stats.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/feedback/Stats.java	2016-03-10 13:43:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/feedback/Stats.java	2016-03-10 14:02:37 +0000
@@ -28,6 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 import org.hisp.dhis.common.DxfNamespaces;
 
@@ -37,12 +39,71 @@
 @JacksonXmlRootElement( localName = "stats", namespace = DxfNamespaces.DXF_2_0 )
 public class Stats
 {
+    private int created;
+
+    private int updated;
+
+    private int deleted;
+
+    private int ignored;
+
     public Stats()
     {
     }
 
     public void merge( Stats stats )
     {
-
+        created += stats.getCreated();
+        updated += stats.getUpdated();
+        deleted += stats.getDeleted();
+        ignored += stats.getIgnored();
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public int getCreated()
+    {
+        return created;
+    }
+
+    public void incCreated()
+    {
+        created++;
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public int getUpdated()
+    {
+        return updated;
+    }
+
+    public void incUpdated()
+    {
+        updated++;
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public int getDeleted()
+    {
+        return deleted;
+    }
+
+    public void incDeleted()
+    {
+        deleted++;
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public int getIgnored()
+    {
+        return ignored;
+    }
+
+    public void incIgnored()
+    {
+        ignored++;
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleValidation.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleValidation.java	2016-03-10 13:17:12 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleValidation.java	2016-03-10 14:02:37 +0000
@@ -72,6 +72,7 @@
 
         ObjectErrorReports objectErrorReports = objectErrorReportsMap.get( objectClass );
         objectErrorReports.addObjectErrorReport( objectErrorReport );
+        objectErrorReports.getStats().incIgnored();
     }
 
     public List<ObjectErrorReport> getAllObjectErrorReports( Class<?> klass )