dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30280
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15371: remove /api/system/context endpoint (use /system/info instead), add calendar/dateFormat info to S...
------------------------------------------------------------
revno: 15371
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-05-23 13:11:47 +0200
message:
remove /api/system/context endpoint (use /system/info instead), add calendar/dateFormat info to SystemInfo (exposed in /api/system/info)
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/DefaultSystemService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemController.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-services/dhis-service-core/src/main/java/org/hisp/dhis/system/DefaultSystemService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/DefaultSystemService.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/DefaultSystemService.java 2014-05-23 11:11:47 +0000
@@ -29,6 +29,7 @@
*/
import org.apache.commons.io.IOUtils;
+import org.hisp.dhis.calendar.CalendarService;
import org.hisp.dhis.configuration.Configuration;
import org.hisp.dhis.configuration.ConfigurationService;
import org.hisp.dhis.external.location.LocationManager;
@@ -62,6 +63,9 @@
@Autowired
private ConfigurationService configurationService;
+ @Autowired
+ private CalendarService calendarService;
+
private SystemInfo systemInfo = null;
// -------------------------------------------------------------------------
@@ -78,6 +82,9 @@
systemInfo = new SystemInfo();
+ systemInfo.setCalendar( calendarService.getSystemCalendar().name() );
+ systemInfo.setDateFormat( calendarService.getSystemDateFormat().getJs() );
+
// ---------------------------------------------------------------------
// Version
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java 2014-05-23 11:11:47 +0000
@@ -28,14 +28,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Date;
-
-import org.hisp.dhis.common.DxfNamespaces;
-import org.hisp.dhis.system.database.DatabaseInfo;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.system.database.DatabaseInfo;
+
+import java.util.Date;
/**
* @author Lars Helge Overland
@@ -46,19 +45,23 @@
private String contextPath;
private String userAgent;
-
+
+ private String calendar;
+
+ private String dateFormat;
+
private String version;
-
+
private String revision;
-
+
private Date buildTime;
-
+
private Date serverDate;
-
+
private String environmentVariable;
private String javaVersion;
-
+
private String javaVendor;
private String javaIoTmpDir;
@@ -66,11 +69,11 @@
private String javaOpts;
private String osName;
-
+
private String osArchitecture;
-
+
private String osVersion;
-
+
private String externalDirectory;
private DatabaseInfo databaseInfo;
@@ -78,13 +81,13 @@
private String memoryInfo;
private Integer cpuCores;
-
+
private String systemId;
// -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
-
+
public void clearSensitiveInfo()
{
this.revision = null;
@@ -101,11 +104,11 @@
this.cpuCores = null;
this.systemId = null;
}
-
+
// -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
-
+
@JsonProperty
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getContextPath()
@@ -132,6 +135,30 @@
@JsonProperty
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getCalendar()
+ {
+ return calendar;
+ }
+
+ public void setCalendar( String calendar )
+ {
+ this.calendar = calendar;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getDateFormat()
+ {
+ return dateFormat;
+ }
+
+ public void setDateFormat( String dateFormat )
+ {
+ this.dateFormat = dateFormat;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getVersion()
{
return version;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemController.java 2014-05-22 12:40:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemController.java 2014-05-23 11:11:47 +0000
@@ -28,14 +28,6 @@
* 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.webapi.utils.ContextUtils;
import org.hisp.dhis.common.CodeGenerator;
import org.hisp.dhis.dxf2.metadata.ImportSummary;
import org.hisp.dhis.dxf2.utils.JacksonUtils;
@@ -47,6 +39,7 @@
import org.hisp.dhis.system.notification.Notifier;
import org.hisp.dhis.system.scheduling.Scheduler;
import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.webapi.utils.ContextUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -56,6 +49,12 @@
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>
*/
@@ -163,19 +162,6 @@
return "info";
}
- @RequestMapping( value = "/context", method = RequestMethod.GET, produces = { "application/json", "application/javascript" } )
- public String getContextInfo( Model model, HttpServletRequest request, HttpServletResponse response )
- {
- SystemInfo info = new SystemInfo();
-
- info.setContextPath( ContextUtils.getContextPath( request ) );
- 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 )
{