← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 10177
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-03-13 15:14:24 +0100
message:
  Unused code
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java
  dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/DefaultI18nManager.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/J2MEDataEntryParser.java
  dhis-2/dhis-services/dhis-service-sms/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/SmsMessageSenderTest.java
  dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/FacilityToOrganisationUnitConverter.java
  dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/validation/constraint/PropertiesValidator.java
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dashboard_charts.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/common/SharingUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java	2013-03-13 10:01:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java	2013-03-13 14:14:24 +0000
@@ -27,10 +27,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
 import org.hisp.dhis.datadictionary.DataDictionary;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementGroupSet;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.document.Document;
 import org.hisp.dhis.indicator.Indicator;
@@ -43,11 +46,6 @@
 import org.hisp.dhis.user.UserGroup;
 import org.hisp.dhis.user.UserGroupAccess;
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
@@ -87,16 +85,6 @@
         PUBLIC_AUTHORITIES.put( DataElement.class, "F_DATAELEMENT_PUBLIC_ADD" );
         PRIVATE_AUTHORITIES.put( DataElement.class, "F_DATAELEMENT_PRIVATE_ADD" );
 
-        /*
-        SUPPORTED_TYPES.put( "dataElementGroup", DataElementGroup.class );
-        PUBLIC_AUTHORITIES.put( DataElementGroup.class, "F_DATAELEMENTGROUP_PUBLIC_ADD" );
-        PRIVATE_AUTHORITIES.put( DataElementGroup.class, "F_DATAELEMENTGROUP_PRIVATE_ADD" );
-
-        SUPPORTED_TYPES.put( "dataElementGroupSet", DataElementGroupSet.class );
-        PUBLIC_AUTHORITIES.put( DataElementGroupSet.class, "F_DATAELEMENTGROUPSET_PUBLIC_ADD" );
-        PRIVATE_AUTHORITIES.put( DataElementGroupSet.class, "F_DATAELEMENTGROUPSET_PRIVATE_ADD" );
-        */
-
         SUPPORTED_TYPES.put( "indicator", Indicator.class );
         PUBLIC_AUTHORITIES.put( Indicator.class, "F_INDICATOR_PUBLIC_ADD" );
         PRIVATE_AUTHORITIES.put( Indicator.class, "F_INDICATOR_PRIVATE_ADD" );

=== modified file 'dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/DefaultI18nManager.java'
--- dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/DefaultI18nManager.java	2013-02-03 07:37:12 +0000
+++ dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/DefaultI18nManager.java	2013-03-13 14:14:24 +0000
@@ -115,11 +115,6 @@
         return resourceBundleManager.getSpecificResourceBundle( clazzName, getCurrentLocale() );
     }
 
-    private ResourceBundle getSpecificResourceBundle( Class<?> clazz )
-    {
-        return resourceBundleManager.getSpecificResourceBundle( clazz, getCurrentLocale() );
-    }
-
     private Locale getCurrentLocale()
     {
         return localeManager.getCurrentLocale();

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java	2013-02-19 08:45:49 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsMessageSender.java	2013-03-13 14:14:24 +0000
@@ -27,11 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_SMS_NOTIFICATION;
-
-import java.io.Serializable;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.logging.Log;
@@ -39,7 +35,6 @@
 import org.hisp.dhis.sms.MessageSender;
 import org.hisp.dhis.sms.SmsServiceException;
 import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserService;
 import org.springframework.scheduling.annotation.Async;
 
 public class SmsMessageSender
@@ -51,13 +46,6 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private UserService userService;
-
-    public void setUserService( UserService userService )
-    {
-        this.userService = userService;
-    }
-
     private OutboundSmsService outboundSmsService;
 
     public void setOutboundSmsService( OutboundSmsService outboundSmsService )
@@ -109,27 +97,6 @@
         return message;
     }
 
-    private Set<String> getRecipients( Set<User> users )
-    {
-        Set<String> recipients = new HashSet<String>();
-
-        Map<User, Serializable> settings = userService.getUserSettings( KEY_MESSAGE_SMS_NOTIFICATION, false );
-
-        for ( User user : users )
-        {
-            boolean smsNotification = settings.get( user ) != null && (Boolean) settings.get( user );
-
-            String phoneNumber = user.getPhoneNumber();
-
-            if ( smsNotification && phoneNumber != null && !phoneNumber.trim().isEmpty() )
-            {
-                recipients.add( phoneNumber );
-            }
-        }
-
-        return recipients;
-    }
-
     private Set<String> getRecipientsWithoutNotification( Set<User> users )
     {
         Set<String> recipients = new HashSet<String>();

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/J2MEDataEntryParser.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/J2MEDataEntryParser.java	2013-03-13 06:43:01 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/J2MEDataEntryParser.java	2013-03-13 14:14:24 +0000
@@ -1,5 +1,32 @@
 package org.hisp.dhis.sms.parse;
 
+/*
+ * Copyright (c) 2004-2012, 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.util.HashMap;
 import java.util.Map;
 import java.util.regex.Pattern;

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-sms/src/main/resources/META-INF/dhis/beans.xml	2013-03-05 17:06:26 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/resources/META-INF/dhis/beans.xml	2013-03-13 14:14:24 +0000
@@ -38,7 +38,6 @@
 
   <bean id="org.hisp.dhis.sms.outbound.SmsMessageSender" class="org.hisp.dhis.sms.outbound.SmsMessageSender">
     <property name="outboundSmsService" ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
-    <property name="userService" ref="org.hisp.dhis.user.UserService" />
   </bean>
 
   <!-- Inbound SMS service -->

=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/SmsMessageSenderTest.java'
--- dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/SmsMessageSenderTest.java	2013-02-25 03:08:12 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/test/java/org/hisp/dhis/sms/outbound/SmsMessageSenderTest.java	2013-03-13 14:14:24 +0000
@@ -6,13 +6,9 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import java.io.Serializable;
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Map;
 
 import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserService;
 import org.junit.Test;
 
 @SuppressWarnings( "serial" )
@@ -22,18 +18,13 @@
     public void testMessageSender()
     {
         final User user = getUser();
-        //Map<User, Serializable> settings = getUserSettings( user );
 
         SmsMessageSender smsMessageSender = new SmsMessageSender();
 
         OutboundSmsService outboundSmsService = mock( OutboundSmsService.class );
         when( outboundSmsService.isEnabled() ).thenReturn( true );
 
-        UserService userService = mock( UserService.class );
-        //when( userService.getUserSettings( KEY_MESSAGE_SMS_NOTIFICATION, false ) ).thenReturn( settings );
-
         smsMessageSender.setOutboundSmsService( outboundSmsService );
-        smsMessageSender.setUserService( userService );
         smsMessageSender.sendMessage( "Hello", "hello", user, false, getUserSet( user ), null );
 
         verify( outboundSmsService ).isEnabled();
@@ -54,11 +45,6 @@
         return new HashSet<User>() {{ add( user ); }};
     }
 
-    private Map<User, Serializable> getUserSettings( final User user )
-    {
-        return new HashMap<User, Serializable>() {{ put( user, true ); }};
-    }
-
     private User getUser()
     {
         final User user = new User();

=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/FacilityToOrganisationUnitConverter.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/FacilityToOrganisationUnitConverter.java	2013-03-07 18:52:55 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/FacilityToOrganisationUnitConverter.java	2013-03-13 14:14:24 +0000
@@ -55,6 +55,7 @@
     private DataSetService dataSetService;
 
     @Override
+    @SuppressWarnings("unchecked")
     public OrganisationUnit convert( Facility facility )
     {
         OrganisationUnit organisationUnit = new OrganisationUnit();

=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/validation/constraint/PropertiesValidator.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/validation/constraint/PropertiesValidator.java	2012-12-10 12:34:13 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/validation/constraint/PropertiesValidator.java	2013-03-13 14:14:24 +0000
@@ -102,6 +102,7 @@
         return true;
     }
 
+    @SuppressWarnings("unchecked")
     private boolean validateDataSets( Map<String, Object> values )
     {
         Collection<String> dataSetIds = (Collection<String>) values.get( "dataSets" );

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dashboard_charts.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dashboard_charts.vm	2012-12-18 08:47:37 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dashboard_charts.vm	2013-03-13 14:14:24 +0000
@@ -1,7 +1,6 @@
 <div class="headerDiv"><span class="header">$i18n.getString("dashboard_charts")</span></div>
 
 <div class="contentDiv">
-new:$chartsForAll.size()
 #foreach( $id in $charts )
 <div class="contentChartDiv"><img src="getChart.action?id=${id}" style="width:100%"></div>
 #end