← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6948: Improved report table resource

 

------------------------------------------------------------
revno: 6948
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-05-15 17:28:44 +0200
message:
  Improved report table resource
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java
  dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/reportTable.xsl


--
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/dataset/DataSetService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java	2012-02-16 18:13:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java	2012-05-15 15:28:44 +0000
@@ -27,15 +27,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
 
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
 /**
  * @author Lars Helge Overland
  * @version $Id: DataSetService.java 6255 2008-11-10 16:01:24Z larshelg $
@@ -202,6 +202,14 @@
     Collection<DataElement> getDistinctDataElements( Collection<Integer> dataSetIdentifiers );
 
     /**
+     * Returns a list of data sets with the given uids.
+     * 
+     * @param uids the collection of uids.
+     * @return a list of data sets.
+     */
+    List<DataSet> getDataSetsByUid( Collection<String> uids );
+    
+    /**
      * Returns a collection of data elements associated with the given
      * corresponding data set.
      *

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2012-02-17 13:25:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2012-05-15 15:28:44 +0000
@@ -296,6 +296,11 @@
 
         return dataElements;
     }
+    
+    public List<DataSet> getDataSetsByUid( Collection<String> uids )
+    {
+        return dataSetStore.getByUid( uids );
+    }
 
     public Collection<DataElement> getDataElements( DataSet dataSet )
     {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2012-05-14 18:21:39 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2012-05-15 15:28:44 +0000
@@ -46,6 +46,8 @@
 import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.i18n.I18nManager;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
@@ -93,6 +95,9 @@
     private DataElementService dataElementService;
     
     @Autowired
+    private DataSetService dataSetService;
+    
+    @Autowired
     private I18nManager i18nManager;
 
     @Autowired
@@ -155,6 +160,7 @@
     @RequestMapping( value = "/data", method = RequestMethod.GET )
     public String getReportTableDynamicData( @RequestParam(required=false, value="in") List<String> indicators,
                                              @RequestParam(required=false, value="de") List<String> dataElements,
+                                             @RequestParam(required=false, value="ds") List<String> dataSets,
                                              @RequestParam(value="ou") List<String> orgUnits,
                                              @RequestParam(required=false) List<String> crossTab,
                                              @RequestParam(required=false) boolean orgUnitIsParent,
@@ -164,11 +170,12 @@
     {
         List<Indicator> indicators_ = indicatorService.getIndicatorsByUid( indicators );
         List<DataElement> dataElements_ = dataElementService.getDataElementsByUid( dataElements );
+        List<DataSet> dataSets_ = dataSetService.getDataSetsByUid( dataSets );
         List<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitsByUid( orgUnits );
         
-        if ( indicators_.isEmpty() && dataElements_.isEmpty() )
+        if ( indicators_.isEmpty() && dataElements_.isEmpty() && dataSets_.isEmpty() )
         {
-            ContextUtils.conflictResponse( response, "No indicators or data elements specified" );
+            ContextUtils.conflictResponse( response, "No valid indicators, data elements or data sets specified" );
             return null;
         }
         

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/reportTable.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/reportTable.xsl	2012-05-15 07:44:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/reportTable.xsl	2012-05-15 15:28:44 +0000
@@ -28,9 +28,7 @@
         <td>pe</td>
         <td colspan="4">period yyyy-MM-dd (opt)</td>
       </tr>
-	  </table>
-
-    <br/>
+	  </table><br/>
 
 	  <table>
       <tr>
@@ -46,10 +44,26 @@
         <td>data element uids</td>
       </tr>
       <tr>
+        <td>ds</td>
+        <td>data set uids</td>
+      </tr>
+      <tr>
         <td>ou</td>
         <td>org unit uids</td>
       </tr>
-    </table>
+      <tr>
+        <td>crosstab</td>
+        <td>crosstab dimensions</td>
+      </tr>
+      <tr>
+        <td>orgUnitIsParent</td>
+        <td>org unit is parent</td>
+      </tr>
+      <tr>
+        <td>[relative periods]</td>
+        <td>[boolean values]</td>
+      </tr>
+      </table><br/>
 	  
       <table>
         <tr>