← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20067: Synchronization resouce, method for getting metadata index

 

------------------------------------------------------------
revno: 20067
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-09-09 21:29:50 +0200
message:
  Synchronization resouce, method for getting metadata index
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SynchronizationController.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/setting/SystemSettingManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java	2015-08-31 08:31:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java	2015-09-09 19:29:50 +0000
@@ -132,6 +132,7 @@
     final int DEFAULT_DATABASE_SERVER_CPUS = 0; // Detect automatically
     final String DEFAULT_HELP_PAGE_LINK = "../dhis-web-commons-about/help.action";
     final String DEFAULT_ANALYSIS_RELATIVE_PERIOD = "LAST_12_MONTHS";
+    final String DEFAULT_METADATA_REPO_URL = "http://metadata.dhis2.org";;
 	
     final Map<String, Serializable> DEFAULT_SETTINGS_VALUES = new HashMap<String, Serializable>()
     {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SynchronizationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SynchronizationController.java	2015-09-09 12:28:08 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SynchronizationController.java	2015-09-09 19:29:50 +0000
@@ -28,10 +28,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.webapi.utils.ContextUtils.CONTENT_TYPE_JSON;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletResponse;
+
 import org.hisp.dhis.dxf2.common.JacksonUtils;
 import org.hisp.dhis.dxf2.importsummary.ImportSummary;
 import org.hisp.dhis.dxf2.synch.AvailabilityStatus;
 import org.hisp.dhis.dxf2.synch.SynchronizationManager;
+import org.hisp.dhis.setting.SystemSettingManager;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Controller;
@@ -39,12 +46,7 @@
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
-
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-
-import static org.hisp.dhis.webapi.utils.ContextUtils.CONTENT_TYPE_JSON;
+import org.springframework.web.client.RestTemplate;
 
 /**
  * @author Lars Helge Overland
@@ -57,6 +59,9 @@
     
     @Autowired
     private SynchronizationManager synchronizationManager;
+    
+    @Autowired
+    private RestTemplate restTemplate;
 
     @PreAuthorize( "hasRole('ALL') or hasRole('F_EXPORT_DATA')" )
     @RequestMapping( value = "/dataPush", method = RequestMethod.POST )
@@ -84,5 +89,11 @@
     public @ResponseBody AvailabilityStatus isRemoteServerAvailable()
     {
         return synchronizationManager.isRemoteServerAvailable();
-    }    
+    }
+    
+    @RequestMapping( value = "/metadataRepo", method = RequestMethod.GET, produces = "application/json" )
+    public @ResponseBody String getMetadataRepoIndex()
+    {
+        return restTemplate.getForObject( SystemSettingManager.DEFAULT_METADATA_REPO_URL, String.class );
+    }
 }