dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29641
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14991: i18n for calender names, fixed minor bugs in Calendar.today(), switched to using CalendarService ...
------------------------------------------------------------
revno: 14991
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-04-25 18:59:41 +0545
message:
i18n for calender names, fixed minor bugs in Calendar.today(), switched to using CalendarService to get calenders, current calendar
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/EthiopicCalendar.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/calendar/CalendarFactory.java
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/CalendarComparator.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/CalendarService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/EthiopianCalendar.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/calendar/DefaultCalendarService.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/ChronologyBasedCalendar.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-i18n/src/main/resources/i18n_global.properties
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetGeneralSettingsAction.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/calendar/AbstractCalendar.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java 2014-04-25 12:25:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java 2014-04-25 13:14:41 +0000
@@ -37,12 +37,6 @@
public abstract class AbstractCalendar implements Calendar
{
@Override
- public String name()
- {
- return getClass().getSimpleName();
- }
-
- @Override
public DateUnit toIso( int year, int month, int day )
{
return toIso( new DateUnit( year, month, day ) );
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/CalendarComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/CalendarComparator.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/CalendarComparator.java 2014-04-25 13:14:41 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.calendar;
+
+/*
+ * Copyright (c) 2004-2014, 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.Comparator;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class CalendarComparator implements Comparator<Calendar>
+{
+ public static final CalendarComparator INSTANCE = new CalendarComparator();
+
+ @Override
+ public int compare( Calendar o1, Calendar o2 )
+ {
+ return o1.name().compareTo( o2.name() );
+ }
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/CalendarService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/CalendarService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/CalendarService.java 2014-04-25 13:14:41 +0000
@@ -0,0 +1,41 @@
+package org.hisp.dhis.calendar;
+
+/*
+ * Copyright (c) 2004-2014, 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.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public interface CalendarService
+{
+ List<Calendar> getAll();
+
+ Calendar getSystemCalendar();
+}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/ChronologyBasedCalendar.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/ChronologyBasedCalendar.java 2014-04-25 07:33:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/ChronologyBasedCalendar.java 2014-04-25 13:14:41 +0000
@@ -56,7 +56,8 @@
@Override
public DateUnit fromIso( DateUnit dateUnit )
{
- DateTime dateTime = dateUnit.toDateTime( chronology );
+ DateTime dateTime = dateUnit.toDateTime( ISOChronology.getInstance() );
+ dateTime = dateTime.withChronology( chronology );
return DateUnit.fromDateTime( dateTime );
}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/EthiopianCalendar.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/EthiopianCalendar.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/EthiopianCalendar.java 2014-04-25 13:14:41 +0000
@@ -0,0 +1,59 @@
+package org.hisp.dhis.calendar.impl;
+
+/*
+ * Copyright (c) 2004-2014, 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 org.hisp.dhis.calendar.Calendar;
+import org.hisp.dhis.calendar.ChronologyBasedCalendar;
+import org.joda.time.chrono.EthiopicChronology;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Component
+public class EthiopianCalendar extends ChronologyBasedCalendar
+{
+ private static final Calendar self = new EthiopianCalendar();
+
+ public static Calendar getInstance()
+ {
+ return self;
+ }
+
+ protected EthiopianCalendar()
+ {
+ super( EthiopicChronology.getInstance() );
+ }
+
+ @Override
+ public String name()
+ {
+ return "ethiopian";
+ }
+}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/EthiopicCalendar.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/EthiopicCalendar.java 2014-04-25 12:25:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/EthiopicCalendar.java 1970-01-01 00:00:00 +0000
@@ -1,59 +0,0 @@
-package org.hisp.dhis.calendar.impl;
-
-/*
- * Copyright (c) 2004-2014, 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 org.hisp.dhis.calendar.Calendar;
-import org.hisp.dhis.calendar.ChronologyBasedCalendar;
-import org.joda.time.chrono.EthiopicChronology;
-import org.springframework.stereotype.Component;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@Component
-public class EthiopicCalendar extends ChronologyBasedCalendar
-{
- private static final Calendar self = new EthiopicCalendar();
-
- public static Calendar getInstance()
- {
- return self;
- }
-
- protected EthiopicCalendar()
- {
- super( EthiopicChronology.getInstance() );
- }
-
- @Override
- public String name()
- {
- return "ethiopic";
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/calendar/CalendarFactory.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/calendar/CalendarFactory.java 2014-04-25 12:25:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/calendar/CalendarFactory.java 1970-01-01 00:00:00 +0000
@@ -1,63 +0,0 @@
-package org.hisp.dhis.calendar;
-
-/*
- * Copyright (c) 2004-2014, 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 com.google.common.collect.Lists;
-import org.hisp.dhis.calendar.impl.Iso8601Calendar;
-import org.hisp.dhis.setting.SystemSettingManager;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.List;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class CalendarFactory
-{
- @Autowired
- private SystemSettingManager settingManager;
-
- @Autowired
- private List<AbstractCalendar> calendars = Lists.newArrayList();
-
- public Calendar createCalendar()
- {
- String setting = (String) settingManager.getSystemSetting( SystemSettingManager.KEY_CALENDAR, SystemSettingManager.DEFAULT_CALENDAR );
-
- for ( Calendar calendar : calendars )
- {
- if ( setting.equals( calendar.name() ) )
- {
- return calendar;
- }
- }
-
- return Iso8601Calendar.getInstance();
- }
-}
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/calendar/DefaultCalendarService.java 2014-04-25 13:14:41 +0000
@@ -0,0 +1,75 @@
+package org.hisp.dhis.calendar;
+
+/*
+ * Copyright (c) 2004-2014, 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 com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import org.hisp.dhis.calendar.impl.Iso8601Calendar;
+import org.hisp.dhis.setting.SystemSettingManager;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class DefaultCalendarService implements CalendarService
+{
+ @Autowired
+ private SystemSettingManager settingManager;
+
+ @Autowired
+ private Set<Calendar> calendars = Sets.newHashSet();
+
+ @Override
+ public List<Calendar> getAll()
+ {
+ List<Calendar> sortedCalendars = Lists.newArrayList( calendars );
+ Collections.sort( sortedCalendars, CalendarComparator.INSTANCE );
+ return sortedCalendars;
+ }
+
+ @Override
+ public Calendar getSystemCalendar()
+ {
+ String setting = (String) settingManager.getSystemSetting( SystemSettingManager.KEY_CALENDAR, SystemSettingManager.DEFAULT_CALENDAR );
+
+ for ( Calendar calendar : calendars )
+ {
+ if ( setting.equals( calendar.name() ) )
+ {
+ return calendar;
+ }
+ }
+
+ return Iso8601Calendar.getInstance();
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2014-04-25 12:25:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2014-04-25 13:14:41 +0000
@@ -9,10 +9,7 @@
<context:component-scan base-package="org.hisp.dhis.calendar.impl" />
- <bean id="org.hisp.dhis.calendar.CalendarFactory" class="org.hisp.dhis.calendar.CalendarFactory" />
-
- <bean id="org.hisp.dhis.calendar.Calendar" factory-bean="org.hisp.dhis.calendar.CalendarFactory" factory-method="createCalendar"
- primary="true"/>
+ <bean id="org.hisp.dhis.calendar.CalendarService" class="org.hisp.dhis.calendar.DefaultCalendarService" />
<bean id="org.hisp.dhis.schema.SchemaService" class="org.hisp.dhis.schema.DefaultSchemaService" />
=== modified file 'dhis-2/dhis-services/dhis-service-i18n/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-services/dhis-service-i18n/src/main/resources/i18n_global.properties 2014-04-21 16:43:24 +0000
+++ dhis-2/dhis-services/dhis-service-i18n/src/main/resources/i18n_global.properties 2014-04-25 13:14:41 +0000
@@ -783,3 +783,14 @@
app_draggable_description=Items are draggable to change their order, so it's easy to customize your favorite apps.
app_order_custom=My own order
app_order_name_alpha=Alphabetical
+
+#-- calendars ------------------------------------------------------------------#
+
+islamic=Islamic
+nepali=Nepali
+julian=Julian
+gregorian=Gregorian
+ethiopian=Ethiopian
+buddhist=Buddhist (Thai)
+iso8601=ISO 8601
+coptic=Coptic
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.java 2014-04-25 12:25:39 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SystemController.java 2014-04-25 13:14:41 +0000
@@ -28,15 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.hisp.dhis.api.utils.ContextUtils;
-import org.hisp.dhis.calendar.Calendar;
import org.hisp.dhis.common.CodeGenerator;
import org.hisp.dhis.dxf2.metadata.ImportSummary;
import org.hisp.dhis.dxf2.utils.JacksonUtils;
@@ -57,11 +49,17 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@Controller
-@RequestMapping(value = SystemController.RESOURCE_PATH)
+@RequestMapping( value = SystemController.RESOURCE_PATH )
public class SystemController
{
public static final String RESOURCE_PATH = "/system";
@@ -74,7 +72,7 @@
@Autowired
private SystemService systemService;
-
+
@Autowired
private Notifier notifier;
@@ -83,7 +81,7 @@
//--------------------------------------------------------------------------
@RequestMapping( value = { "/uid", "/id" }, method = RequestMethod.GET )
- public void getUid( @RequestParam(required = false) Integer n, HttpServletResponse response ) throws IOException
+ public void getUid( @RequestParam( required = false ) Integer n, HttpServletResponse response ) throws IOException
{
response.setContentType( ContextUtils.CONTENT_TYPE_JSON );
@@ -110,8 +108,8 @@
}
@RequestMapping( value = "/tasks/{category}", method = RequestMethod.GET, produces = { "*/*", "application/json" } )
- public void getTaskJson( @PathVariable("category") String category,
- @RequestParam(required=false) String lastId, HttpServletResponse response ) throws IOException
+ public void getTaskJson( @PathVariable( "category" ) String category,
+ @RequestParam( required = false ) String lastId, HttpServletResponse response ) throws IOException
{
List<Notification> notifications = new ArrayList<Notification>();
@@ -128,7 +126,7 @@
}
@RequestMapping( value = "/taskSummaries/{category}", method = RequestMethod.GET, produces = { "*/*", "application/json" } )
- public void getTaskSummaryJson( HttpServletResponse response, @PathVariable("category") String category ) throws IOException
+ public void getTaskSummaryJson( HttpServletResponse response, @PathVariable( "category" ) String category ) throws IOException
{
ImportSummary importSummary = new ImportSummary();
@@ -145,25 +143,25 @@
JacksonUtils.toJson( response.getOutputStream(), importSummary );
}
-
+
@RequestMapping( value = "/info", method = RequestMethod.GET, produces = { "application/json", "application/javascript" } )
public String getSystemInfo( Model model, HttpServletRequest request, HttpServletResponse response )
{
SystemInfo info = systemService.getSystemInfo();
-
+
info.setContextPath( ContextUtils.getContextPath( request ) );
info.setUserAgent( request.getHeader( ContextUtils.HEADER_USER_AGENT ) );
-
+
if ( !currentUserService.currentUserIsSuper() )
{
info.clearSensitiveInfo();
}
model.addAttribute( "model", info );
-
+
return "info";
}
-
+
@RequestMapping( value = "/context", method = RequestMethod.GET, produces = { "application/json", "application/javascript" } )
public String getContextInfo( Model model, HttpServletRequest request, HttpServletResponse response )
{
@@ -173,10 +171,10 @@
info.setUserAgent( request.getHeader( ContextUtils.HEADER_USER_AGENT ) );
model.addAttribute( "model", info );
-
+
return "info";
}
-
+
@RequestMapping( value = "/ping", method = RequestMethod.GET, produces = "text/plain" )
public @ResponseBody String ping( Model model )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetGeneralSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetGeneralSettingsAction.java 2014-04-25 12:25:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetGeneralSettingsAction.java 2014-04-25 13:14:41 +0000
@@ -28,8 +28,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import com.opensymphony.xwork2.Action;
import org.hisp.dhis.calendar.AbstractCalendar;
+import org.hisp.dhis.calendar.Calendar;
+import org.hisp.dhis.calendar.CalendarComparator;
+import org.hisp.dhis.calendar.CalendarService;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.configuration.Configuration;
import org.hisp.dhis.configuration.ConfigurationService;
@@ -49,6 +54,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Set;
/**
* @author Lars Helge Overland
@@ -96,6 +102,9 @@
this.organisationUnitService = organisationUnitService;
}
+ @Autowired
+ private CalendarService calendarService;
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -161,12 +170,9 @@
return configuration;
}
- @Autowired
- private List<AbstractCalendar> calendars;
-
- public List<AbstractCalendar> getCalendars()
+ public List<Calendar> getCalendars()
{
- return calendars;
+ return calendarService.getAll();
}
// -------------------------------------------------------------------------
@@ -186,7 +192,7 @@
// default to highest level
// TODO what if the org unit level hierarchy hasn't been created yet?
int size = organisationUnitService.getOrganisationUnitLevels().size();
-
+
offlineOrganisationUnitLevel = organisationUnitService.getOrganisationUnitLevelByLevel( size );
}