← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22300: Unused code

 

------------------------------------------------------------
revno: 22300
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2016-03-14 15:46:23 +0100
message:
  Unused code
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/Preheat.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/preheat/DefaultPreheatService.java
  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/UserSettingController.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/preheat/Preheat.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/Preheat.java	2016-03-13 11:05:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/preheat/Preheat.java	2016-03-14 14:46:23 +0000
@@ -72,7 +72,6 @@
         this.user = user;
     }
 
-    @SuppressWarnings( "unchecked" )
     public <T extends IdentifiableObject> T get( PreheatIdentifier identifier, Class<? extends IdentifiableObject> klass, IdentifiableObject object )
     {
         return get( identifier, klass, identifier.getIdentifier( object ) );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/preheat/DefaultPreheatService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/preheat/DefaultPreheatService.java	2016-03-14 08:30:30 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/preheat/DefaultPreheatService.java	2016-03-14 14:46:23 +0000
@@ -415,7 +415,6 @@
     }
 
     @Override
-    @SuppressWarnings( "unchecked" )
     public Map<Class<? extends IdentifiableObject>, Map<String, Map<Object, String>>> collectUniqueness( Map<Class<? extends IdentifiableObject>, List<IdentifiableObject>> objects )
     {
         Map<Class<? extends IdentifiableObject>, Map<String, Map<Object, String>>> uniqueMap = new HashMap<>();
@@ -746,7 +745,6 @@
     }
 
     @Override
-    @SuppressWarnings( "unchecked" )
     public void connectReferences( Object object, Preheat preheat, PreheatIdentifier identifier )
     {
         if ( object == null )

=== 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-02-06 12:26:39 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemSettingController.java	2016-03-14 14:46:23 +0000
@@ -73,8 +73,7 @@
     @Autowired
     private WebMessageService webMessageService;
 
-    @RequestMapping( value = "/{key}", method = RequestMethod.POST, consumes = { ContextUtils.CONTENT_TYPE_TEXT,
-        ContextUtils.CONTENT_TYPE_HTML } )
+    @RequestMapping( value = "/{key}", method = RequestMethod.POST, consumes = { ContextUtils.CONTENT_TYPE_TEXT, ContextUtils.CONTENT_TYPE_HTML } )
     @PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" )
     public void setSystemSetting(
         @PathVariable( value = "key" ) String key,
@@ -119,9 +118,7 @@
     }
 
     @RequestMapping( value = "/{key}", method = RequestMethod.GET, produces = ContextUtils.CONTENT_TYPE_TEXT )
-    public
-    @ResponseBody
-    String getSystemSettingAsText( @PathVariable( "key" ) String key )
+    public @ResponseBody String getSystemSettingAsText( @PathVariable( "key" ) String key )
     {
         if ( systemSettingManager.isConfidential( key ) )
         {
@@ -135,14 +132,16 @@
         }
     }
 
-    @RequestMapping( method = RequestMethod.GET, produces = { ContextUtils.CONTENT_TYPE_JSON,
-        ContextUtils.CONTENT_TYPE_HTML } )
+    @RequestMapping( method = RequestMethod.GET, produces = { ContextUtils.CONTENT_TYPE_JSON, ContextUtils.CONTENT_TYPE_HTML } )
     public void getSystemSettingsJson( @RequestParam( value = "key", required = false ) Set<String> key,
         HttpServletResponse response )
         throws IOException
     {
         if ( key != null )
+        {
             key.removeIf( systemSettingManager::isConfidential );
+        }
+        
         response.setContentType( MediaType.APPLICATION_JSON_VALUE );
         renderService.toJson( response.getOutputStream(), getSystemSettings( key ) );
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/UserSettingController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/UserSettingController.java	2016-03-14 13:46:38 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/UserSettingController.java	2016-03-14 14:46:23 +0000
@@ -69,6 +69,9 @@
 @RequestMapping( "/userSettings" )
 public class UserSettingController
 {
+    private static final Map<String, SettingKey> NAME_SETTING_KEY_MAP = Sets.newHashSet(
+        SettingKey.values() ).stream().collect( Collectors.toMap( SettingKey::getName, s -> s ) );
+
     @Autowired
     private UserSettingService userSettingService;
 
@@ -87,10 +90,6 @@
     @Autowired
     private SystemSettingManager systemSettingManager;
 
-    private static final Map<String, SettingKey> NAME_SETTING_KEY_MAP = Sets.newHashSet(
-        SettingKey.values() ).stream().collect( Collectors.toMap( SettingKey::getName, s -> s ) );
-
-
     // -------------------------------------------------------------------------
     // Resources
     // -------------------------------------------------------------------------
@@ -208,11 +207,13 @@
 
         Map<String, Serializable> settings = new HashMap<>();
 
-        // Find fallback for missing userSettings; Creating new objects to separate from hibernate
+        // Find fall-back for missing users settings
+        
         userSettingService.getUserSettings( us ).stream().filter( UserSetting::hasValue )
             .forEach( userSetting -> settings.put( userSetting.getName(), userSetting.getValue() ) );
 
-        // Add remaining userSettings user doesn't have set yet
+        // Add missing user settings
+        
         for ( UserSettingKey userSettingKey : UserSettingKey.values() )
         {
             if ( !settings.containsKey( userSettingKey.getName() ) )
@@ -238,15 +239,4 @@
 
         userSettingService.deleteUserSetting( keyEnum.get() );
     }
-
-    // -------------------------------------------------------------------------
-    // Supportive methods
-    // -------------------------------------------------------------------------
-
-    private Map<String, Serializable> asMap( List<UserSetting> settings )
-    {
-        return settings.stream().
-            filter( s -> s.getName() != null && s.getValue() != null ).
-            collect( Collectors.toMap( UserSetting::getName, UserSetting::getValue ) );
-    }
 }