← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21633: SettingKey.getConfidential > isConfidential. Removed unused imports.

 

------------------------------------------------------------
revno: 21633
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2016-01-07 09:13:54 +0100
message:
  SettingKey.getConfidential > isConfidential. Removed unused imports.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SettingKey.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSetting.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultSystemSettingManager.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemSettingController.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/setting/SettingKey.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SettingKey.java	2016-01-06 19:24:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SettingKey.java	2016-01-07 08:13:54 +0000
@@ -235,5 +235,8 @@
         return clazz;
     }
 
-    public boolean getConfidential() { return confidential; }
+    public boolean isConfidential()
+    {
+        return confidential;
+    }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSetting.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSetting.java	2016-01-06 19:24:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSetting.java	2016-01-07 08:13:54 +0000
@@ -44,8 +44,6 @@
 
     private Serializable value;
 
-    private boolean confidential;
-
     // -------------------------------------------------------------------------
     // Constructor
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java	2016-01-06 19:24:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java	2016-01-07 08:13:54 +0000
@@ -40,8 +40,6 @@
 import org.apache.commons.mail.EmailException;
 import org.apache.commons.mail.HtmlEmail;
 import org.hisp.dhis.commons.util.DebugUtils;
-import org.hisp.dhis.external.conf.ConfigurationKey;
-import org.hisp.dhis.external.conf.DhisConfigurationProvider;
 import org.hisp.dhis.setting.SettingKey;
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.system.velocity.VelocityManager;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultSystemSettingManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultSystemSettingManager.java	2016-01-06 19:24:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultSystemSettingManager.java	2016-01-07 08:13:54 +0000
@@ -28,27 +28,31 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.collect.Lists;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
 import org.apache.commons.lang3.StringUtils;
-import org.hisp.dhis.external.conf.ConfigurationKey;
-import org.hisp.dhis.external.conf.DhisConfigurationProvider;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nManager;
 import org.hisp.dhis.system.util.ValidationUtils;
 import org.jasypt.encryption.pbe.PBEStringEncryptor;
-import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
-import org.jasypt.salt.StringFixedSaltGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.Resource;
-import java.io.Serializable;
-import java.util.*;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.collect.Lists;
 
 /**
  * @author Stian Strandli
@@ -105,7 +109,7 @@
 
         SystemSetting setting = systemSettingStore.getByName( name );
 
-        if ( NAME_KEY_MAP.containsKey( name ) && NAME_KEY_MAP.get( name ).getConfidential() )
+        if ( NAME_KEY_MAP.containsKey( name ) && NAME_KEY_MAP.get( name ).isConfidential() )
         {
             value = pbeStringEncryptor.encrypt( value.toString() );
         }
@@ -157,7 +161,7 @@
     {
         SystemSetting setting = systemSettingStore.getByName( name );
 
-        if ( NAME_KEY_MAP.containsKey( name ) && NAME_KEY_MAP.get( name ).getConfidential() )
+        if ( NAME_KEY_MAP.containsKey( name ) && NAME_KEY_MAP.get( name ).isConfidential() )
         {
 
             setting.setValue( pbeStringEncryptor.decrypt( setting.getValue().toString() ) );
@@ -195,7 +199,7 @@
 
         if ( setting != null && setting.hasValue() )
         {
-            return NAME_KEY_MAP.get( name ).getConfidential() ?
+            return NAME_KEY_MAP.get( name ).isConfidential() ?
                 Optional.of( pbeStringEncryptor.decrypt( setting.getValue().toString() ) ) :
                 Optional.of( setting.getValue() );
         }
@@ -215,7 +219,7 @@
          */
         return systemSettingStore.getAll().stream()
             .filter( systemSetting -> !NAME_KEY_MAP.containsKey( systemSetting.getName() ) ||
-                !NAME_KEY_MAP.get( systemSetting.getName() ).getConfidential() )
+                !NAME_KEY_MAP.get( systemSetting.getName() ).isConfidential() )
             .collect( Collectors.toList() );
 
     }
@@ -428,7 +432,6 @@
     @Override
     public boolean isConfidential( String name )
     {
-        return NAME_KEY_MAP.containsKey( name ) && NAME_KEY_MAP.get( name ).getConfidential();
+        return NAME_KEY_MAP.containsKey( name ) && NAME_KEY_MAP.get( name ).isConfidential();
     }
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java	2016-01-06 19:24:34 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/synch/DefaultSynchronizationManager.java	2016-01-07 08:13:54 +0000
@@ -46,8 +46,6 @@
 import org.hisp.dhis.dxf2.importsummary.ImportSummary;
 import org.hisp.dhis.dxf2.metadata.ImportService;
 import org.hisp.dhis.dxf2.metadata.MetaData;
-import org.hisp.dhis.external.conf.ConfigurationKey;
-import org.hisp.dhis.external.conf.DhisConfigurationProvider;
 import org.hisp.dhis.setting.SettingKey;
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.system.util.CodecUtils;
@@ -212,8 +210,6 @@
             return null;
         }
 
-        final Configuration config = configurationService.getConfiguration();
-
         String url = systemSettingManager.getSystemSetting(
             SettingKey.REMOTE_INSTANCE_URL ) + "/api/dataValueSets";
 
@@ -225,16 +221,13 @@
             public void doWithRequest( ClientHttpRequest request )
                 throws IOException
             {
+                String username = (String) systemSettingManager.getSystemSetting( SettingKey.REMOTE_INSTANCE_USERNAME );
+                String password = (String) systemSettingManager.getSystemSetting( SettingKey.REMOTE_INSTANCE_PASSWORD );
+                
                 request.getHeaders().setContentType( MediaType.APPLICATION_JSON );
-                request.getHeaders().add( HEADER_AUTHORIZATION,
-                    CodecUtils.getBasicAuthString(
-                        (String) systemSettingManager.getSystemSetting(
-                            SettingKey.REMOTE_INSTANCE_USERNAME ),
-                        (String) systemSettingManager.getSystemSetting(
-                            SettingKey.REMOTE_INSTANCE_PASSWORD ) ) );
+                request.getHeaders().add( HEADER_AUTHORIZATION, CodecUtils.getBasicAuthString( username, password ) );
 
-                dataValueSetService
-                    .writeDataValueSetJson( lastSuccessTime, request.getBody(), new IdSchemes() );
+                dataValueSetService.writeDataValueSetJson( lastSuccessTime, request.getBody(), new IdSchemes() );
             }
         };
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemSettingController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemSettingController.java	2016-01-06 19:24:34 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemSettingController.java	2016-01-07 08:13:54 +0000
@@ -32,7 +32,6 @@
 import java.io.Serializable;
 import java.util.Map;
 import java.util.Set;
-import java.util.function.Predicate;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;