← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19898: Import options, enforcing system setting for strict checking

 

------------------------------------------------------------
revno: 19898
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-08-31 09:11:10 +0200
message:
  Import options, enforcing system setting for strict checking
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/ImportOptions.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.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/common/ImportOptions.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/ImportOptions.java	2015-08-30 18:24:11 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/common/ImportOptions.java	2015-08-31 07:11:10 +0000
@@ -68,11 +68,11 @@
 
     private boolean sharing;
     
-    private Boolean strictPeriods;
+    private boolean strictPeriods;
 
-    private Boolean strictCategoryOptionCombos;
+    private boolean strictCategoryOptionCombos;
     
-    private Boolean strictAttributeOptionCombos;
+    private boolean strictAttributeOptionCombos;
     
     //--------------------------------------------------------------------------
     // Constructors
@@ -98,21 +98,6 @@
         return DEFAULT_OPTIONS;
     }
     
-    public boolean hasStrictPeriods()
-    {
-        return strictPeriods != null;
-    }
-    
-    public boolean hasStrictCategoryOptionCombos()
-    {
-        return strictCategoryOptionCombos != null;
-    }
-
-    public boolean hasStrictAttributeOptionCombos()
-    {
-        return strictAttributeOptionCombos != null;
-    }
-
     //--------------------------------------------------------------------------
     // Get methods
     //--------------------------------------------------------------------------
@@ -171,18 +156,18 @@
     {
         return sharing;
     }
-
-    public Boolean getStrictPeriods()
+    
+    public boolean isStrictPeriods()
     {
         return strictPeriods;
     }
 
-    public Boolean getStrictCategoryOptionCombos()
+    public boolean isStrictCategoryOptionCombos()
     {
         return strictCategoryOptionCombos;
     }
 
-    public Boolean getStrictAttributeOptionCombos()
+    public boolean isStrictAttributeOptionCombos()
     {
         return strictAttributeOptionCombos;
     }
@@ -251,19 +236,19 @@
         return this;
     }
 
-    public ImportOptions setStrictPeriods( Boolean strictPeriods )
+    public ImportOptions setStrictPeriods( boolean strictPeriods )
     {
         this.strictPeriods = strictPeriods;
         return this;
     }
 
-    public ImportOptions setStrictCategoryOptionCombos( Boolean strictCategoryOptionCombos )
+    public ImportOptions setStrictCategoryOptionCombos( boolean strictCategoryOptionCombos )
     {
         this.strictCategoryOptionCombos = strictCategoryOptionCombos;
         return this;
     }
 
-    public ImportOptions setStrictAttributeOptionCombos( Boolean strictAttributeOptionCombos )
+    public ImportOptions setStrictAttributeOptionCombos( boolean strictAttributeOptionCombos )
     {
         this.strictAttributeOptionCombos = strictAttributeOptionCombos;
         return this;

=== 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	2015-08-30 18:24:11 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java	2015-08-31 07:11:10 +0000
@@ -576,12 +576,9 @@
 
         boolean skipExistingCheck = importOptions.isSkipExistingCheck();
         
-        boolean strictPeriods = importOptions.hasStrictPeriods() ? importOptions.getStrictPeriods() : 
-            (Boolean) systemSettingManager.getSystemSetting( KEY_DATA_IMPORT_STRICT_PERIODS, false );
-        boolean strictCategoryOptionCombos = importOptions.hasStrictCategoryOptionCombos() ? importOptions.getStrictCategoryOptionCombos() :
-            (Boolean) systemSettingManager.getSystemSetting( KEY_DATA_IMPORT_STRICT_CATEGORY_OPTION_COMBOS, false );
-        boolean strictAttrOptionCombos = importOptions.hasStrictAttributeOptionCombos() ? importOptions.getStrictAttributeOptionCombos() :
-            (Boolean) systemSettingManager.getSystemSetting( KEY_DATA_IMPORT_STRICT_ATTRIBUTE_OPTION_COMBOS, false );
+        boolean strictPeriods = importOptions.isStrictPeriods() || (Boolean) systemSettingManager.getSystemSetting( KEY_DATA_IMPORT_STRICT_PERIODS, false );
+        boolean strictCategoryOptionCombos = importOptions.isStrictCategoryOptionCombos() || (Boolean) systemSettingManager.getSystemSetting( KEY_DATA_IMPORT_STRICT_CATEGORY_OPTION_COMBOS, false );
+        boolean strictAttrOptionCombos = importOptions.isStrictAttributeOptionCombos() || (Boolean) systemSettingManager.getSystemSetting( KEY_DATA_IMPORT_STRICT_ATTRIBUTE_OPTION_COMBOS, false );
         
         //----------------------------------------------------------------------
         // Create meta-data maps