dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42436
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21701: Data value import, implemented DELETE import strategy
------------------------------------------------------------
revno: 21701
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-01-12 13:49:50 +0100
message:
Data value import, implemented DELETE import strategy
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingKey.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultStyleManager.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importSummary.vm
--
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/user/UserSettingKey.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingKey.java 2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingKey.java 2016-01-12 12:49:50 +0000
@@ -45,10 +45,10 @@
UI_LOCALE( "keyUiLocale", Locale.class ),
DB_LOCALE( "keyDbLocale", Locale.class ),
ANALYSIS_DISPLAY_PROPERTY( "keyAnalysisDisplayProperty", "name", String.class ),
- CURRENT_DOMAIN_TYPE( "currentDomainType" ),
- AUTO_SAVE_CASE_ENTRY_FORM( "autoSaveCaseEntryForm", Boolean.FALSE, Boolean.class ),
- AUTO_SAVE_TRACKED_ENTITY_REGISTRATION_ENTRY_FORM( "autoSavetTrackedEntityForm", Boolean.FALSE, Boolean.class ),
- AUTO_SAVE_DATA_ENTRY_FORM( "autoSaveDataEntryForm", Boolean.FALSE, Boolean.class ),
+ CURRENT_DOMAIN_TYPE( "keyCurrentDomainType" ),
+ AUTO_SAVE_CASE_ENTRY_FORM( "keyAutoSaveCaseEntryForm", Boolean.FALSE, Boolean.class ),
+ AUTO_SAVE_TRACKED_ENTITY_REGISTRATION_ENTRY_FORM( "keyAutoSavetTrackedEntityForm", Boolean.FALSE, Boolean.class ),
+ AUTO_SAVE_DATA_ENTRY_FORM( "keyAutoSaveDataEntryForm", Boolean.FALSE, Boolean.class ),
TRACKER_DASHBOARD_LAYOUT( "keyTrackerDashboardLayout" );
private final String name;
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultStyleManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultStyleManager.java 2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultStyleManager.java 2016-01-12 12:49:50 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.i18n.I18nManager;
import org.hisp.dhis.user.UserSettingKey;
import org.hisp.dhis.user.UserSettingService;
+import org.hisp.dhis.util.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.google.common.collect.Lists;
@@ -103,12 +104,7 @@
{
String style = (String) userSettingService.getUserSetting( UserSettingKey.STYLE );
- if ( style != null )
- {
- return style;
- }
-
- return getSystemStyle();
+ return ObjectUtils.firstNonNull( style, getSystemStyle() );
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2016-01-12 12:49:50 +0000
@@ -669,6 +669,7 @@
int importCount = 0;
int updateCount = 0;
+ int deleteCount = 0;
int totalCount = 0;
// ---------------------------------------------------------------------
@@ -897,6 +898,15 @@
updateCount++;
}
+ else if ( strategy.isDelete() )
+ {
+ if ( !dryRun )
+ {
+ batchHandler.deleteObject( internalValue );
+ }
+
+ deleteCount++;
+ }
}
else
{
@@ -915,9 +925,9 @@
batchHandler.flush();
- int ignores = totalCount - importCount - updateCount;
+ int ignores = totalCount - importCount - updateCount - deleteCount;
- summary.setImportCount( new ImportCount( importCount, updateCount, ignores, 0 ) );
+ summary.setImportCount( new ImportCount( importCount, updateCount, ignores, deleteCount ) );
summary.setStatus( ImportStatus.SUCCESS );
summary.setDescription( "Import process completed successfully" );
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2015-10-02 11:27:19 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2016-01-12 12:49:50 +0000
@@ -385,6 +385,7 @@
available_mapLegendSets=Available Map Legend Sets
selected_mapLegendSets=Selected Map Legend Sets
maps=Maps
+deleted=Deleted
available_maps=Available Maps
selected_maps=Selected Maps
option_sets=Option sets
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm 2015-12-04 10:44:33 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm 2016-01-12 12:49:50 +0000
@@ -34,7 +34,8 @@
<td><select id="strategy" name="strategy" style="width:190px">
<option value="NEW_AND_UPDATES">$i18n.getString( "new_and_updates" )</option>
<option value="NEW">$i18n.getString( "new_only" )</option>
- <option value="UPDATES">$i18n.getString( "updates_only" )</option>
+ <option value="UPDATES">$i18n.getString( "updates_only" )</option>
+ <option value="DELETE">$i18n.getString( "delete" )</option>
</select></td>
</tr>
<tr>
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importSummary.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importSummary.vm 2015-02-20 12:35:55 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importSummary.vm 2016-01-12 12:49:50 +0000
@@ -23,6 +23,10 @@
<td>${summary.importCount.updated}</td>
</tr>
<tr>
+ <td>$i18n.getString( "deleted" )</td>
+ <td>${summary.importCount.deleted}</td>
+</tr>
+<tr>
<td>$i18n.getString( "ignored" )</td>
<td>${summary.importCount.ignored}</td>
</tr>