dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16880
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6548: Renamed some props in ImportCount
------------------------------------------------------------
revno: 6548
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-04-11 21:17:22 +0200
message:
Renamed some props in ImportCount
modified:
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/metadata/importers/AbstractImporter.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportDataValueTask.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/importsummary/ImportCount.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java 2012-04-11 11:40:51 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java 2012-04-11 19:17:22 +0000
@@ -36,23 +36,23 @@
{
private String object;
- private int imports;
-
- private int updates;
-
- private int ignores;
+ private int imported;
+
+ private int updated;
+
+ private int ignored;
public ImportCount( String object )
{
this.object = object;
}
- public ImportCount( String object, int imports, int updates, int ignores )
+ public ImportCount( String object, int imported, int updated, int ignored )
{
this.object = object;
- this.imports = imports;
- this.updates = updates;
- this.ignores = ignores;
+ this.imported = imported;
+ this.updated = updated;
+ this.ignored = ignored;
}
@JsonProperty
@@ -69,46 +69,46 @@
@JsonProperty
@JacksonXmlProperty( isAttribute = true )
- public int getImports()
- {
- return imports;
- }
-
- public void setImports( int imports )
- {
- this.imports = imports;
- }
-
- @JsonProperty
- @JacksonXmlProperty( isAttribute = true )
- public int getUpdates()
- {
- return updates;
- }
-
- public void setUpdates( int updates )
- {
- this.updates = updates;
- }
-
- @JsonProperty
- @JacksonXmlProperty( isAttribute = true )
- public int getIgnores()
- {
- return ignores;
- }
-
- public void setIgnores( int ignores )
- {
- this.ignores = ignores;
+ public int getImported()
+ {
+ return imported;
+ }
+
+ public void setImported( int imported )
+ {
+ this.imported = imported;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( isAttribute = true )
+ public int getUpdated()
+ {
+ return updated;
+ }
+
+ public void setUpdated( int updated )
+ {
+ this.updated = updated;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( isAttribute = true )
+ public int getIgnored()
+ {
+ return ignored;
+ }
+
+ public void setIgnored( int ignored )
+ {
+ this.ignored = ignored;
}
@Override
public String toString()
{
return "[object='" + object + "'" +
- ", imports=" + imports +
- ", updates=" + updates +
- ", ignores=" + ignores + "]";
+ ", imports=" + imported +
+ ", updates=" + updated +
+ ", ignores=" + ignored + "]";
}
}
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java 2012-04-11 16:18:25 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java 2012-04-11 19:17:22 +0000
@@ -62,11 +62,11 @@
// Current import counts
//-------------------------------------------------------------------------------------------------------
- protected int imports;
-
- protected int updates;
-
- protected int ignores;
+ protected int imported;
+
+ protected int updated;
+
+ protected int ignored;
//-------------------------------------------------------------------------------------------------------
// Mappings from identifier (uid, name, code) to a db object.
@@ -149,7 +149,6 @@
if ( ReflectionUtils.isType( field, IdentifiableObject.class ) )
{
IdentifiableObject identifiableObject = ReflectionUtils.invokeGetterMethod( field.getName(), object );
- // we now have the identifiableObject, and can make sure that the reference is OK
log.info( identifiableObject );
}
else
@@ -159,7 +158,6 @@
if ( b )
{
Collection<IdentifiableObject> identifiableObjects = ReflectionUtils.invokeGetterMethod( field.getName(), object );
- // we now have the collection, and can make sure that references are OK
log.info( identifiableObjects );
}
}
@@ -218,9 +216,9 @@
{
ImportCount importCount = new ImportCount( getObjectName() );
- importCount.setImports( imports );
- importCount.setUpdates( updates );
- importCount.setIgnores( ignores );
+ importCount.setImported( imported );
+ importCount.setUpdated( updated );
+ importCount.setIgnored( ignored );
return importCount;
}
@@ -231,9 +229,9 @@
private void reset( T type )
{
- imports = 0;
- updates = 0;
- ignores = 0;
+ imported = 0;
+ updated = 0;
+ ignored = 0;
uidMap = manager.getIdMap( (Class<T>) type.getClass(), IdentifiableObject.IdentifiableProperty.UID );
codeMap = manager.getIdMap( (Class<T>) type.getClass(), IdentifiableObject.IdentifiableProperty.CODE );
@@ -257,7 +255,7 @@
if ( conflict != null )
{
- ignores++;
+ ignored++;
}
return conflict;
@@ -278,7 +276,7 @@
return conflict;
}
- imports++;
+ imported++;
}
else if ( ImportStrategy.UPDATES.equals( options.getImportStrategy() ) )
{
@@ -289,7 +287,7 @@
return conflict;
}
- updates++;
+ updated++;
}
else if ( ImportStrategy.NEW_AND_UPDATES.equals( options.getImportStrategy() ) )
{
@@ -302,7 +300,7 @@
return conflict;
}
- updates++;
+ updated++;
}
else
{
@@ -314,7 +312,7 @@
return conflict;
}
- imports++;
+ imported++;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportDataValueTask.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportDataValueTask.java 2012-04-11 13:49:03 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportDataValueTask.java 2012-04-11 19:17:22 +0000
@@ -1,9 +1,37 @@
package org.hisp.dhis.importexport.action.util;
+/*
+ * Copyright (c) 2011, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import java.io.InputStream;
import org.hisp.dhis.common.IdentifiableObject.IdentifiableProperty;
import org.hisp.dhis.dxf2.datavalueset.DataValueSetService;
+import org.hisp.dhis.dxf2.metadata.ImportOptions;
import org.hisp.dhis.importexport.ImportStrategy;
public class ImportDataValueTask
@@ -25,6 +53,6 @@
@Override
public void run()
{
- dataValueSetService.saveDataValueSet( in, IdentifiableProperty.UID, IdentifiableProperty.UID, dryRun, strategy );
+ dataValueSetService.saveDataValueSet( in, new ImportOptions( IdentifiableProperty.UID, IdentifiableProperty.UID, dryRun, strategy ) );
}
}