← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18576: add isMetadata to nodes

 

------------------------------------------------------------
revno: 18576
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-03-11 13:34:51 +0530
message:
  add isMetadata to nodes
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-api/src/main/java/org/hisp/dhis/node/NodeUtils.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	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/AbstractNode.java	2015-03-11 08:04:51 +0000
@@ -50,6 +50,8 @@
 
     protected final NodeType nodeType;
 
+    protected boolean metadata;
+
     protected Node parent;
 
     protected String namespace;
@@ -91,6 +93,17 @@
     }
 
     @Override
+    public boolean isMetadata()
+    {
+        return metadata;
+    }
+
+    public void setMetadata( boolean metadata )
+    {
+        this.metadata = metadata;
+    }
+
+    @Override
     public Node getParent()
     {
         return parent;

=== 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	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/Node.java	2015-03-11 08:04:51 +0000
@@ -92,6 +92,13 @@
     boolean isCollection();
 
     /**
+     * Should this be considered data or metadata.
+     *
+     * @return True if metadata (like a pager)
+     */
+    boolean isMetadata();
+
+    /**
      * Namespace for this node. Not all serializers support this, and its up to the
      * NodeSerializer implementation to decide what to do with this.
      *

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/NodeUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/NodeUtils.java	2015-02-10 09:04:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/NodeUtils.java	2015-03-11 08:04:51 +0000
@@ -68,6 +68,8 @@
     public static Node createPager( Pager pager )
     {
         ComplexNode pagerNode = new ComplexNode( "pager" );
+        pagerNode.setMetadata( true );
+
         pagerNode.addChild( new SimpleNode( "page", pager.getPage() ) );
         pagerNode.addChild( new SimpleNode( "pageCount", pager.getPageCount() ) );
         pagerNode.addChild( new SimpleNode( "total", pager.getTotal() ) );