dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24584
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12084: minor fixes to importSummary
------------------------------------------------------------
revno: 12084
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-09-13 15:27:19 +0200
message:
minor fixes to importSummary
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/person/AbstractPersonService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummaries.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummary.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-dxf2/src/main/java/org/hisp/dhis/dxf2/event/person/AbstractPersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/person/AbstractPersonService.java 2013-09-13 13:06:54 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/person/AbstractPersonService.java 2013-09-13 13:27:19 +0000
@@ -313,6 +313,7 @@
public ImportSummary savePerson( Person person )
{
ImportSummary importSummary = new ImportSummary();
+ importSummary.setDataValueCount( null );
List<ImportConflict> importConflicts = new ArrayList<ImportConflict>();
importConflicts.addAll( checkForRequiredIdentifiers( person ) );
@@ -322,7 +323,8 @@
if ( !importConflicts.isEmpty() )
{
- importSummary.getDataValueCount().incrementIgnored();
+ importSummary.setStatus( ImportStatus.ERROR );
+ importSummary.getImportCount().incrementIgnored();
return importSummary;
}
@@ -336,7 +338,7 @@
importSummary.setStatus( ImportStatus.SUCCESS );
importSummary.setReference( patient.getUid() );
- importSummary.getDataValueCount().incrementImported();
+ importSummary.getImportCount().incrementImported();
return importSummary;
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummaries.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummaries.java 2013-09-05 13:09:59 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummaries.java 2013-09-13 13:27:19 +0000
@@ -57,9 +57,19 @@
public void addImportSummary( ImportSummary importSummary )
{
- imported += importSummary.getDataValueCount().getImported();
- updated += importSummary.getDataValueCount().getUpdated();
- ignored += importSummary.getDataValueCount().getIgnored();
+ if ( importSummary.getDataValueCount() != null )
+ {
+ imported += importSummary.getDataValueCount().getImported();
+ updated += importSummary.getDataValueCount().getUpdated();
+ ignored += importSummary.getDataValueCount().getIgnored();
+ }
+
+ if ( importSummary.getImportCount() != null )
+ {
+ imported += importSummary.getImportCount().getImported();
+ updated += importSummary.getImportCount().getUpdated();
+ ignored += importSummary.getImportCount().getIgnored();
+ }
importSummaries.add( importSummary );
}
@@ -78,21 +88,21 @@
}
@JsonProperty
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
public int getImported()
{
return imported;
}
@JsonProperty
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
public int getUpdated()
{
return updated;
}
@JsonProperty
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
public int getIgnored()
{
return ignored;
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummary.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummary.java 2013-09-05 13:09:59 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummary.java 2013-09-13 13:27:19 +0000
@@ -44,8 +44,11 @@
private String description;
+ /* we want to phase out this at some point, use importCount instead */
private ImportCount dataValueCount = new ImportCount();
+ private ImportCount importCount = new ImportCount();
+
private List<ImportConflict> conflicts = new ArrayList<ImportConflict>();
private String dataSetComplete;
@@ -101,6 +104,18 @@
}
@JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public ImportCount getImportCount()
+ {
+ return importCount;
+ }
+
+ public void setImportCount( ImportCount importCount )
+ {
+ this.importCount = importCount;
+ }
+
+ @JsonProperty
@JacksonXmlElementWrapper( localName = "conflicts", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "conflict", namespace = DxfNamespaces.DXF_2_0 )
public List<ImportConflict> getConflicts()