← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15502: minor change, add helper method for adding new NodeHint

 

------------------------------------------------------------
revno: 15502
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-06-01 16:30:40 +0200
message:
  minor change, add helper method for adding new NodeHint
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/AbstractNode.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Node.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-api/src/main/java/org/hisp/dhis/node/AbstractNode.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/AbstractNode.java	2014-05-31 23:48:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/AbstractNode.java	2014-06-01 14:30:40 +0000
@@ -80,6 +80,12 @@
     }
 
     @Override
+    public NodeHint addHint( NodeHint.Type type, Object value )
+    {
+        return addHint( new NodeHint( type, value ) );
+    }
+
+    @Override
     public NodeHint addHint( NodeHint nodeHint )
     {
         nodeHints.put( nodeHint.getType(), nodeHint );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Node.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Node.java	2014-05-31 23:48:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Node.java	2014-06-01 14:30:40 +0000
@@ -45,6 +45,8 @@
 
     List<Node> getNodes();
 
+    NodeHint addHint( NodeHint.Type type, Object value );
+
     NodeHint addHint( NodeHint nodeHint );
 
     NodeHint getHint( NodeHint.Type type );

=== 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-06-01 13:52:28 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SystemController.java	2014-06-01 14:30:40 +0000
@@ -46,6 +46,7 @@
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.webapi.utils.ContextUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -85,7 +86,7 @@
     // UID Generator
     //--------------------------------------------------------------------------
 
-    @RequestMapping( value = { "/uid", "/id" }, method = RequestMethod.GET )
+    @RequestMapping( value = { "/uid", "/id" }, method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE } )
     public @ResponseBody RootNode getUid( @RequestParam( required = false, defaultValue = "1" ) Integer n, HttpServletResponse response )
         throws IOException, InvalidTypeException
     {
@@ -96,7 +97,7 @@
 
         RootNode rootNode = new RootNode( "codes" );
         CollectionNode collectionNode = rootNode.addNode( new CollectionNode( "codes" ) );
-        collectionNode.addHint( new NodeHint( NodeHint.Type.XML_COLLECTION_WRAPPING, false ) );
+        collectionNode.addHint( NodeHint.Type.XML_COLLECTION_WRAPPING, false );
 
         for ( int i = 0; i < n; i++ )
         {