← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17200: CalendarService, checking for empty keys

 

------------------------------------------------------------
revno: 17200
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-10-21 19:05:37 +0200
message:
  CalendarService, checking for empty keys
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/calendar/DefaultCalendarService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/Jackson2PropertyIntrospectorService.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/schema/AbstractPropertyIntrospectorService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java	2014-10-01 10:06:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java	2014-10-21 17:05:37 +0000
@@ -46,7 +46,8 @@
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
-public abstract class AbstractPropertyIntrospectorService implements PropertyIntrospectorService
+public abstract class AbstractPropertyIntrospectorService 
+    implements PropertyIntrospectorService
 {
     // simple alias map for our concrete implementations of the core interfaces.
     private static final ImmutableMap<Class<?>, Class<?>> BASE_ALIAS_MAP = ImmutableMap.<Class<?>, Class<?>>builder()

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/calendar/DefaultCalendarService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/calendar/DefaultCalendarService.java	2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/calendar/DefaultCalendarService.java	2014-10-21 17:05:37 +0000
@@ -28,6 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.apache.commons.lang.StringUtils.isEmpty;
+
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -146,8 +148,8 @@
     @Override
     public String getSystemCalendarKey()
     {
-        String key = keyCache.containsKey( KEY_CALENDAR ) ? keyCache.get( KEY_CALENDAR ) : 
-            (String) settingManager.getSystemSetting( KEY_CALENDAR, DEFAULT_CALENDAR );        
+        String key = keyCache.get( KEY_CALENDAR );        
+        key = !isEmpty( key ) ? key : (String) settingManager.getSystemSetting( KEY_CALENDAR, DEFAULT_CALENDAR );        
         keyCache.put( KEY_CALENDAR, key );        
         return key;
     }
@@ -162,8 +164,8 @@
     @Override
     public String getSystemDateFormatKey()
     {
-        String key = keyCache.containsKey( KEY_DATE_FORMAT ) ? keyCache.get( KEY_DATE_FORMAT ) :
-            (String) settingManager.getSystemSetting( KEY_DATE_FORMAT, DEFAULT_DATE_FORMAT );
+        String key = keyCache.get( KEY_DATE_FORMAT );
+        key = !isEmpty( key ) ? key : (String) settingManager.getSystemSetting( KEY_DATE_FORMAT, DEFAULT_DATE_FORMAT );
         keyCache.put( KEY_DATE_FORMAT, key );
         return key;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/Jackson2PropertyIntrospectorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/Jackson2PropertyIntrospectorService.java	2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/Jackson2PropertyIntrospectorService.java	2014-10-21 17:05:37 +0000
@@ -59,7 +59,8 @@
  *
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
-public class Jackson2PropertyIntrospectorService extends AbstractPropertyIntrospectorService
+public class Jackson2PropertyIntrospectorService 
+    extends AbstractPropertyIntrospectorService
 {
     @Autowired
     private SessionFactory sessionFactory;