← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4557: Fixed export to pdf - list of dataelement, indicator, validation rule, and user.

 

------------------------------------------------------------
revno: 4557
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-09-10 15:40:27 +0700
message:
  Fixed export to pdf - list of dataelement, indicator, validation rule, and user.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ExportParams.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/UserConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ValidationRuleConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/pdf/ExportToPdfAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/pdf/ExportToPdfAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm


--
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/dataelement/DataElementService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java	2011-09-05 23:27:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java	2011-09-10 08:40:27 +0000
@@ -122,7 +122,7 @@
      * @param key the name of the DataElement to return.
      * @return List of DataElements with a given key, or all dataelements if no match.
      */
-    Collection<DataElement> searchDataElementByName( String key );
+    Collection<DataElement> searchDataElementsByName( String key );
     /**
      * Returns a DataElement with a given short name.
      * 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java	2011-09-05 23:27:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java	2011-09-10 08:40:27 +0000
@@ -110,7 +110,7 @@
      * @param key the name of the DataElement to return.
      * @return List of DataElements with a given key, or all dataelements if no match.
      */
-    Collection<DataElement> searchDataElementByName( String key );
+    Collection<DataElement> searchDataElementsByName( String key );
 
     /**
      * Returns a DataElement with a given alternative name.

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java	2011-04-22 21:04:14 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java	2011-09-10 08:40:27 +0000
@@ -177,6 +177,14 @@
     ValidationRule getValidationRuleByName( String name );
     
     /**
+     * Get the validation rules which are associated with the given name key.
+     * 
+     * @param name the name key.
+     * @return a collection of validation rules.
+     */
+    Collection<ValidationRule> getValidationRulesByName( String name );
+    
+    /**
      * Get the validation rules which are associated with the given data elements.
      * 
      * @param dataElements the collection of data elements.

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java	2011-09-05 23:27:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java	2011-09-10 08:40:27 +0000
@@ -207,8 +207,8 @@
         return i18n( i18nService, dataElementStore.getDataElementByName( name ) );
     }
     
-    public Collection<DataElement> searchDataElementByName( String key ){
-    	return i18n( i18nService, dataElementStore.searchDataElementByName( key ) );
+    public Collection<DataElement> searchDataElementsByName( String key ){
+    	return i18n( i18nService, dataElementStore.searchDataElementsByName( key ) );
     }
 
     public DataElement getDataElementByAlternativeName( String alternativeName )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java	2011-09-05 23:27:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java	2011-09-10 08:40:27 +0000
@@ -134,7 +134,7 @@
     }
 
     @SuppressWarnings( "unchecked" )
-    public Collection<DataElement> searchDataElementByName( String key )
+    public Collection<DataElement> searchDataElementsByName( String key )
     {
         Session session = sessionFactory.getCurrentSession();
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2011-08-02 11:23:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2011-09-10 08:40:27 +0000
@@ -76,7 +76,8 @@
 
     private GenericIdentifiableObjectStore<ValidationRuleGroup> validationRuleGroupStore;
 
-    public void setValidationRuleGroupStore( GenericIdentifiableObjectStore<ValidationRuleGroup> validationRuleGroupStore )
+    public void setValidationRuleGroupStore(
+        GenericIdentifiableObjectStore<ValidationRuleGroup> validationRuleGroupStore )
     {
         this.validationRuleGroupStore = validationRuleGroupStore;
     }
@@ -94,9 +95,9 @@
     {
         this.periodService = periodService;
     }
-    
+
     private DataSetService dataSetService;
-    
+
     public void setDataSetService( DataSetService dataSetService )
     {
         this.dataSetService = dataSetService;
@@ -113,14 +114,15 @@
     // ValidationRule business logic
     // -------------------------------------------------------------------------
 
-    public Grid getAggregateValidationResult( Collection<ValidationResult> results, List<Period> periods, List<OrganisationUnit> sources )
+    public Grid getAggregateValidationResult( Collection<ValidationResult> results, List<Period> periods,
+        List<OrganisationUnit> sources )
     {
         int number = validationRuleStore.getNumberOfValidationRules();
-        
+
         Grid grid = new ListGrid();
-        
+
         CompositeCounter counter = new CompositeCounter();
-        
+
         for ( ValidationResult result : results )
         {
             counter.count( result.getPeriod(), result.getSource() );
@@ -128,72 +130,76 @@
 
         grid.addRow();
         grid.addValue( "" );
-        
+
         for ( Period period : periods )
         {
             grid.addValue( period.getName() );
         }
-        
+
         for ( OrganisationUnit source : sources )
         {
             grid.addRow();
             grid.addValue( source.getName() );
-            
+
             for ( Period period : periods )
             {
-                double percentage = (double) ( 100 * counter.getCount( period, source ) ) / number;
-                
+                double percentage = (double) (100 * counter.getCount( period, source )) / number;
+
                 grid.addValue( String.valueOf( getRounded( percentage, DECIMALS ) ) );
             }
         }
-        
+
         return grid;
     }
-    
-    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<OrganisationUnit> sources )
+
+    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate,
+        Collection<OrganisationUnit> sources )
     {
         Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
-        
+
         Collection<ValidationRule> validationRules = getAllValidationRules();
 
         Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
 
-        for ( OrganisationUnit source : sources  )
+        for ( OrganisationUnit source : sources )
         {
             for ( Period period : periods )
             {
-                validationViolations.addAll( validateInternal( period, source, validationRules, true, validationViolations.size() ) );
+                validationViolations.addAll( validateInternal( period, source, validationRules, true,
+                    validationViolations.size() ) );
             }
         }
-        
+
         return validationViolations;
     }
 
-    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<OrganisationUnit> sources, ValidationRuleGroup group )
+    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate,
+        Collection<OrganisationUnit> sources, ValidationRuleGroup group )
     {
         Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
-        
+
         Collection<DataSet> dataSets = dataSetService.getDataSetsBySources( sources );
-        
+
         Collection<DataElement> dataElements = dataElementService.getDataElementsByDataSets( dataSets );
-        
+
         Collection<ValidationRule> validationRules = getValidationRulesByDataElements( dataElements );
 
         validationRules.retainAll( group.getMembers() );
-        
+
         Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
 
-        for ( OrganisationUnit source : sources  )
+        for ( OrganisationUnit source : sources )
         {
             for ( Period period : periods )
             {
-                validationViolations.addAll( validateInternal( period, source, validationRules, true, validationViolations.size() ) );
+                validationViolations.addAll( validateInternal( period, source, validationRules, true,
+                    validationViolations.size() ) );
             }
         }
-        
+
         return validationViolations;
     }
-    
+
     public Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<OrganisationUnit> sources )
     {
         Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
@@ -203,12 +209,13 @@
         for ( OrganisationUnit source : sources )
         {
             Collection<ValidationRule> relevantRules = getRelevantValidationRules( source.getDataElementsInDataSets() );
-                
+
             if ( relevantRules != null && relevantRules.size() > 0 )
-            {                    
+            {
                 for ( Period period : relevantPeriods )
                 {
-                    validationViolations.addAll( validateInternal( period, source, relevantRules, false, validationViolations.size() ) );
+                    validationViolations.addAll( validateInternal( period, source, relevantRules, false,
+                        validationViolations.size() ) );
                 }
             }
         }
@@ -227,12 +234,13 @@
         {
             Collection<ValidationRule> relevantRules = getRelevantValidationRules( source.getDataElementsInDataSets() );
             relevantRules.retainAll( group.getMembers() );
-            
+
             if ( relevantRules != null && relevantRules.size() > 0 )
             {
                 for ( Period period : relevantPeriods )
                 {
-                    validationViolations.addAll( validateInternal( period, source, relevantRules, false, validationViolations.size() ) );
+                    validationViolations.addAll( validateInternal( period, source, relevantRules, false,
+                        validationViolations.size() ) );
                 }
             }
         }
@@ -245,14 +253,15 @@
         Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
 
         Collection<ValidationRule> relevantRules = getRelevantValidationRules( source.getDataElementsInDataSets() );
-                
+
         Collection<Period> relevantPeriods = periodService.getPeriodsBetweenDates( startDate, endDate );
 
         for ( Period period : relevantPeriods )
         {
-            validationViolations.addAll( validateInternal( period, source, relevantRules, false, validationViolations.size() ) );
+            validationViolations.addAll( validateInternal( period, source, relevantRules, false, validationViolations
+                .size() ) );
         }
-        
+
         return validationViolations;
     }
 
@@ -264,16 +273,16 @@
     public Collection<DataElement> getDataElementsInValidationRules()
     {
         Set<DataElement> dataElements = new HashSet<DataElement>();
-        
+
         for ( ValidationRule rule : getAllValidationRules() )
         {
             dataElements.addAll( rule.getLeftSide().getDataElementsInExpression() );
             dataElements.addAll( rule.getRightSide().getDataElementsInExpression() );
         }
-        
+
         return dataElements;
     }
-    
+
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------
@@ -290,31 +299,35 @@
         final Collection<ValidationRule> validationRules, boolean aggregate, int currentSize )
     {
         final Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
-        
+
         if ( currentSize < MAX_VIOLATIONS )
-        {        
+        {
             Double leftSide = null;
             Double rightSide = null;
-    
+
             boolean violation = false;
-    
+
             for ( final ValidationRule validationRule : validationRules )
             {
-                if ( validationRule.getPeriodType() != null && validationRule.getPeriodType().equals( period.getPeriodType() ) )
+                if ( validationRule.getPeriodType() != null
+                    && validationRule.getPeriodType().equals( period.getPeriodType() ) )
                 {
-                    leftSide = expressionService.getExpressionValue( validationRule.getLeftSide(), period, source, true, aggregate, null );
-                    
+                    leftSide = expressionService.getExpressionValue( validationRule.getLeftSide(), period, source,
+                        true, aggregate, null );
+
                     if ( leftSide != null )
                     {
-                        rightSide = expressionService.getExpressionValue( validationRule.getRightSide(), period, source, true, aggregate, null );
-            
+                        rightSide = expressionService.getExpressionValue( validationRule.getRightSide(), period,
+                            source, true, aggregate, null );
+
                         if ( rightSide != null )
                         {
                             violation = !expressionIsTrue( leftSide, validationRule.getOperator(), rightSide );
-            
+
                             if ( violation )
                             {
-                                validationViolations.add( new ValidationResult( period, source, validationRule, getRounded( leftSide, DECIMALS ), getRounded( rightSide, DECIMALS ) ) );
+                                validationViolations.add( new ValidationResult( period, source, validationRule,
+                                    getRounded( leftSide, DECIMALS ), getRounded( rightSide, DECIMALS ) ) );
                             }
                         }
                     }
@@ -337,13 +350,14 @@
     {
         final Set<ValidationRule> relevantValidationRules = new HashSet<ValidationRule>();
 
-        //TODO move getDataElementsInExpression out of for-loop
-        
+        // TODO move getDataElementsInExpression out of for-loop
+
         for ( ValidationRule validationRule : getAllValidationRules() )
         {
             for ( DataElement dataElement : dataElements )
             {
-                if ( validationRule.getPeriodType() != null && dataElement.getPeriodType() != null && validationRule.getPeriodType().equals( dataElement.getPeriodType() ) )
+                if ( validationRule.getPeriodType() != null && dataElement.getPeriodType() != null
+                    && validationRule.getPeriodType().equals( dataElement.getPeriodType() ) )
                 {
                     if ( validationRule.getLeftSide().getDataElementsInExpression().contains( dataElement )
                         || validationRule.getRightSide().getDataElementsInExpression().contains( dataElement ) )
@@ -365,27 +379,32 @@
     {
         return validationRuleStore.saveValidationRule( validationRule );
     }
-    
+
     public void updateValidationRule( ValidationRule validationRule )
     {
         validationRuleStore.updateValidationRule( validationRule );
     }
-    
+
     public void deleteValidationRule( ValidationRule validationRule )
     {
         validationRuleStore.delete( validationRule );
     }
 
+    public ValidationRule getValidationRule( int id )
+    {
+        return validationRuleStore.get( id );
+    }
+
+    public ValidationRule getValidationRuleByName( String name )
+    {
+        return validationRuleStore.getByName( name );
+    }
+
     public Collection<ValidationRule> getAllValidationRules()
     {
         return validationRuleStore.getAll();
     }
 
-    public ValidationRule getValidationRule( int id )
-    {
-        return validationRuleStore.get( id );
-    }
-
     public Collection<ValidationRule> getValidationRules( final Collection<Integer> identifiers )
     {
         Collection<ValidationRule> objects = getAllValidationRules();
@@ -399,9 +418,9 @@
         } );
     }
 
-    public ValidationRule getValidationRuleByName( String name )
-    {
-        return validationRuleStore.getByName( name );
+    public Collection<ValidationRule> getValidationRulesByName( String name )
+    {        
+        return validationRuleStore.getLikeName( name );
     }
     
     public Collection<ValidationRule> getValidationRulesByDataElements( Collection<DataElement> dataElements )
@@ -482,5 +501,5 @@
     {
         return validationRuleGroupStore.getBetweenByName( name, first, max );
     }
-    
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ExportParams.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ExportParams.java	2011-09-09 06:18:32 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ExportParams.java	2011-09-10 08:40:27 +0000
@@ -32,10 +32,13 @@
 import java.util.Date;
 import java.util.HashSet;
 
+import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.validation.ValidationRule;
 
 /**
  * @author Lars Helge Overland
@@ -91,7 +94,7 @@
 
     private Collection<Integer> organisationUnitLevels = new HashSet<Integer>();
 
-    private Collection<UserCredentials> users = new HashSet<UserCredentials>();
+    private Collection<Integer> users = new HashSet<Integer>();
 
     private Collection<Integer> validationRules = new ArrayList<Integer>();
 
@@ -103,12 +106,20 @@
 
     private Collection<Integer> olapUrls = new ArrayList<Integer>();
 
+    private Collection<DataElement> dataElementObjects = new ArrayList<DataElement>();
+
+    private Collection<Indicator> indicatorObjects = new ArrayList<Indicator>();
+
+    private Collection<UserCredentials> userObjects = new ArrayList<UserCredentials>();
+
+    private Collection<ValidationRule> validationRuleObjects = new ArrayList<ValidationRule>();
+
     private I18n i18n;
 
     private I18nFormat format;
 
     // -------------------------------------------------------------------------
-    // Constructur
+    // Constructors
     // -------------------------------------------------------------------------
 
     public ExportParams()
@@ -189,58 +200,9 @@
         this.format = format;
     }
 
-    public Collection<Integer> getCategories()
-    {
-        return categories;
-    }
-
-    public void setCategories( Collection<Integer> categories )
-    {
-        this.categories = categories;
-    }
-
-    public Collection<Integer> getCategoryOptions()
-    {
-        return categoryOptions;
-    }
-
-    public void setCategoryOptions( Collection<Integer> categoryOptions )
-    {
-        this.categoryOptions = categoryOptions;
-    }
-
-    public Collection<Integer> getCategoryCombos()
-    {
-        return categoryCombos;
-    }
-
-    public void setCategoryCombos( Collection<Integer> categoryCombos )
-    {
-        this.categoryCombos = categoryCombos;
-    }
-
-    public Collection<Integer> getCategoryOptionCombos()
-    {
-        return categoryOptionCombos;
-    }
-
-    public void setCategoryOptionCombos( Collection<Integer> categoryOptionCombos )
-    {
-        this.categoryOptionCombos = categoryOptionCombos;
-    }
-
-    /**
-     * @return
-     */
-    public User getCurrentUser()
-    {
-        return currentUser;
-    }
-
-    public void setCurrentUser( User currentUser )
-    {
-        this.currentUser = currentUser;
-    }
+    // -------------------------------------------------------------------------
+    // IDs
+    // -------------------------------------------------------------------------
 
     public Collection<Integer> getDataElements()
     {
@@ -332,6 +294,46 @@
         this.dataSets = dataSets;
     }
 
+    public Collection<Integer> getCategories()
+    {
+        return categories;
+    }
+
+    public void setCategories( Collection<Integer> categories )
+    {
+        this.categories = categories;
+    }
+
+    public Collection<Integer> getCategoryOptions()
+    {
+        return categoryOptions;
+    }
+
+    public void setCategoryOptions( Collection<Integer> categoryOptions )
+    {
+        this.categoryOptions = categoryOptions;
+    }
+
+    public Collection<Integer> getCategoryCombos()
+    {
+        return categoryCombos;
+    }
+
+    public void setCategoryCombos( Collection<Integer> categoryCombos )
+    {
+        this.categoryCombos = categoryCombos;
+    }
+
+    public Collection<Integer> getCategoryOptionCombos()
+    {
+        return categoryOptionCombos;
+    }
+
+    public void setCategoryOptionCombos( Collection<Integer> categoryOptionCombos )
+    {
+        this.categoryOptionCombos = categoryOptionCombos;
+    }
+
     public Collection<Integer> getPeriods()
     {
         return periods;
@@ -392,12 +394,12 @@
         this.validationRules = validationRules;
     }
 
-    public Collection<UserCredentials> getUsers()
+    public Collection<Integer> getUsers()
     {
         return users;
     }
 
-    public void setUsers( Collection<UserCredentials> users )
+    public void setUsers( Collection<Integer> users )
     {
         this.users = users;
     }
@@ -441,4 +443,58 @@
     {
         this.olapUrls = olapUrls;
     }
+
+    // -------------------------------------------------------------------------
+    // Object instances
+    // -------------------------------------------------------------------------
+
+    public User getCurrentUser()
+    {
+        return currentUser;
+    }
+
+    public void setCurrentUser( User currentUser )
+    {
+        this.currentUser = currentUser;
+    }
+
+    public Collection<DataElement> getDataElementObjects()
+    {
+        return dataElementObjects;
+    }
+
+    public void setDataElementObjects( Collection<DataElement> dataElementObjects )
+    {
+        this.dataElementObjects = dataElementObjects;
+    }
+
+    public Collection<Indicator> getIndicatorObjects()
+    {
+        return indicatorObjects;
+    }
+
+    public void setIndicatorObjects( Collection<Indicator> indicatorObjects )
+    {
+        this.indicatorObjects = indicatorObjects;
+    }
+
+    public Collection<UserCredentials> getUserObjects()
+    {
+        return userObjects;
+    }
+
+    public void setUserObjects( Collection<UserCredentials> userObjects )
+    {
+        this.userObjects = userObjects;
+    }
+
+    public Collection<ValidationRule> getValidationRuleObjects()
+    {
+        return validationRuleObjects;
+    }
+
+    public void setValidationRuleObjects( Collection<ValidationRule> validationRuleObjects )
+    {
+        this.validationRuleObjects = validationRuleObjects;
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java	2011-01-06 15:40:07 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java	2011-09-10 08:40:27 +0000
@@ -27,13 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataelement.comparator.DataElementNameComparator;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.importexport.ExportParams;
@@ -52,13 +46,6 @@
     extends PDFUtils
     implements PDFConverter
 {
-    private DataElementService dataElementService;
-
-    public DataElementConverter( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
     // -------------------------------------------------------------------------
     // PDFConverter implementation
     // -------------------------------------------------------------------------
@@ -69,11 +56,8 @@
         I18nFormat format = params.getFormat();
 
         PDFUtils.printObjectFrontPage( document, params.getDataElements(), i18n, format, "data_elements" );
-
-        List<DataElement> elements = new ArrayList<DataElement>( dataElementService.getDataElements( params.getDataElements() ) );
-        Collections.sort( elements, new DataElementNameComparator() );
         
-        for ( DataElement element : elements )
+        for ( DataElement element : params.getDataElementObjects() )
         {
             addTableToDocument( document, printDataElement( element, i18n, true, 0.40f, 0.60f ) );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java	2010-12-26 21:40:52 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java	2011-09-10 08:40:27 +0000
@@ -27,18 +27,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.importexport.ExportParams;
 import org.hisp.dhis.importexport.PDFConverter;
 import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.indicator.comparator.IndicatorNameComparator;
 import org.hisp.dhis.system.util.PDFUtils;
 
 import com.lowagie.text.Document;
@@ -53,13 +47,10 @@
     extends PDFUtils
     implements PDFConverter
 {
-    private IndicatorService indicatorService;
-
     private ExpressionService expressionService;
 
-    public IndicatorConverter( IndicatorService indicatorService, ExpressionService expressionService )
+    public IndicatorConverter( ExpressionService expressionService )
     {
-        this.indicatorService = indicatorService;
         this.expressionService = expressionService;
     }
 
@@ -74,10 +65,7 @@
 
         PDFUtils.printObjectFrontPage( document, params.getIndicators(), i18n, format, "indicators" );
 
-        List<Indicator> indicators = new ArrayList<Indicator>( indicatorService.getIndicators( params.getIndicators() ) );
-        Collections.sort( indicators, new IndicatorNameComparator() );
-
-        for ( Indicator indicator : indicators )
+        for ( Indicator indicator : params.getIndicatorObjects() )
         {
             addTableToDocument( document, printIndicator( indicator, i18n, expressionService, true, 0.40f, 0.60f ) );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/UserConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/UserConverter.java	2011-09-09 06:18:32 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/UserConverter.java	2011-09-10 08:40:27 +0000
@@ -60,9 +60,9 @@
         I18n i18n = params.getI18n();
         I18nFormat format = params.getFormat();
 
-        PDFUtils.printObjectFrontPage( document, params.getUsers(), i18n, format, "users" );
+        PDFUtils.printObjectFrontPage( document, params.getUserObjects(), i18n, format, "users" );
         
-        for ( UserCredentials userCredentials : params.getUsers() )
+        for ( UserCredentials userCredentials : params.getUserObjects() )
         {
             addTableToDocument( document, printUser( userCredentials, i18n, format, true, 0.40f, 0.60f ) );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ValidationRuleConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ValidationRuleConverter.java	2010-12-26 21:40:52 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/ValidationRuleConverter.java	2011-09-10 08:40:27 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.importexport.pdf.converter;
 
 /*
- * Copyright (c) 2004-2010, University of Oslo
+ * Copyright (c) 2004-2011, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,10 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
@@ -38,8 +34,6 @@
 import org.hisp.dhis.importexport.PDFConverter;
 import org.hisp.dhis.system.util.PDFUtils;
 import org.hisp.dhis.validation.ValidationRule;
-import org.hisp.dhis.validation.ValidationRuleService;
-import org.hisp.dhis.validation.comparator.ValidationRuleNameComparator;
 
 import com.lowagie.text.Document;
 
@@ -51,16 +45,13 @@
     extends PDFUtils
     implements PDFConverter
 {
-    private ValidationRuleService validationRuleService;
-
     private ExpressionService expressionService;
 
     /**
      * Constructor for write operations.
      */
-    public ValidationRuleConverter( ValidationRuleService validationRuleService, ExpressionService expressionService )
+    public ValidationRuleConverter( ExpressionService expressionService )
     {
-        this.validationRuleService = validationRuleService;
         this.expressionService = expressionService;
     }
 
@@ -73,12 +64,9 @@
         I18n i18n = params.getI18n();
         I18nFormat format = params.getFormat();
 
-        PDFUtils.printObjectFrontPage( document, params.getValidationRules(), i18n, format, "validation_rules" );
-
-        List<ValidationRule> validationRules = new ArrayList<ValidationRule>( validationRuleService.getValidationRules( params.getValidationRules() ) );
-        Collections.sort( validationRules, new ValidationRuleNameComparator() );
-
-        for ( ValidationRule rule : validationRules )
+        PDFUtils.printObjectFrontPage( document, params.getValidationRuleObjects(), i18n, format, "validation_rules" );
+
+        for ( ValidationRule rule : params.getValidationRuleObjects() )
         {
             addTableToDocument( document, printValidationRule( rule, i18n, expressionService, true, 0.40f, 0.60f ) );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java	2011-09-09 06:18:32 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/exporter/ITextPDFExportService.java	2011-09-10 08:40:27 +0000
@@ -36,7 +36,6 @@
 import java.util.zip.ZipOutputStream;
 
 import org.hibernate.SessionFactory;
-import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.importexport.ExportParams;
 import org.hisp.dhis.importexport.ExportService;
@@ -46,9 +45,7 @@
 import org.hisp.dhis.importexport.pdf.converter.OrganisationUnitHierarchyConverter;
 import org.hisp.dhis.importexport.pdf.converter.UserConverter;
 import org.hisp.dhis.importexport.pdf.converter.ValidationRuleConverter;
-import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.validation.ValidationRuleService;
 
 /**
  * @author Lars Helge Overland
@@ -68,13 +65,6 @@
         this.sessionFactory = sessionFactory;
     }
 
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
     private ExpressionService expressionService;
 
     public void setExpressionService( ExpressionService expressionService )
@@ -82,13 +72,6 @@
         this.expressionService = expressionService;
     }
 
-    private IndicatorService indicatorService;
-
-    public void setIndicatorService( IndicatorService indicatorService )
-    {
-        this.indicatorService = indicatorService;
-    }
-
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -96,13 +79,6 @@
         this.organisationUnitService = organisationUnitService;
     }
 
-    private ValidationRuleService validationRuleService;
-
-    public void setValidationRuleService( ValidationRuleService validationRuleService )
-    {
-        this.validationRuleService = validationRuleService;
-    }
-
     // -------------------------------------------------------------------------
     // ExportService implementation
     // -------------------------------------------------------------------------
@@ -130,12 +106,12 @@
             thread.setOutputStream( zipOut );
             thread.setExportParams( params );
 
-            thread.setDataElementConverter( new DataElementConverter( dataElementService ) );
-            thread.setIndicatorConverter( new IndicatorConverter( indicatorService, expressionService ) );
+            thread.setDataElementConverter( new DataElementConverter() );
+            thread.setIndicatorConverter( new IndicatorConverter( expressionService ) );
             thread.setOrganisationUnitHierarchyConverter( new OrganisationUnitHierarchyConverter( organisationUnitService ) );
             thread.setOrganisationUnitConverter( new OrganisationUnitConverter( organisationUnitService ) );
             thread.setUserConverter( new UserConverter() );
-            thread.setValidationRuleConverter( new ValidationRuleConverter( validationRuleService, expressionService ) );
+            thread.setValidationRuleConverter( new ValidationRuleConverter( expressionService ) );
 
             thread.start();
 

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml	2011-09-09 11:20:37 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml	2011-09-10 08:40:27 +0000
@@ -278,11 +278,8 @@
 
   <bean id="org.hisp.dhis.importexport.PDFExportService" class="org.hisp.dhis.importexport.pdf.exporter.ITextPDFExportService">
     <property name="sessionFactory" ref="sessionFactory" />
-    <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 	<property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
-    <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-    <property name="validationRuleService" ref="org.hisp.dhis.validation.ValidationRuleService" />
   </bean>
 
 	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-09-09 06:18:32 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-09-10 08:40:27 +0000
@@ -1336,7 +1336,7 @@
 /**
  * Used to export PDF file by the given type and the filter params in page
  */
-function exportPdfByType( type, params )
+function exportPdfByType( params )
 {	
 	if ( jQuery( "table.listTable tbody tr" ).length == 0 )
 	{
@@ -1344,7 +1344,7 @@
 		return;
 	}
 	
-	window.location.href = 'exportToPdf.action?type=' + type + params;
+	jQuery.post( 'exportToPdf.action', params );
 }
 
 /**

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java	2011-01-17 17:03:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java	2011-09-10 08:40:27 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.dd.action.pdf;
 
 /*
- * Copyright (c) 2004-2010, University of Oslo
+ * Copyright (c) 2004-2011, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,17 +27,27 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.common.ServiceProvider;
+import org.hisp.dhis.datadictionary.DataDictionaryService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementNameComparator;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.importexport.ExportParams;
 import org.hisp.dhis.importexport.ExportService;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.indicator.comparator.IndicatorNameComparator;
 
 import com.opensymphony.xwork2.Action;
 
@@ -53,15 +63,38 @@
     private static final String EXPORT_FORMAT_PDF = "PDF";
 
     private static final String TYPE_DATAELEMENT = "dataelement";
+
     private static final String TYPE_INDICATOR = "indicator";
 
     private static final String FILENAME_DATAELEMENT = "DataElements.zip";
+
     private static final String FILENAME_INDICATOR = "Indicators.zip";
 
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
 
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private DataDictionaryService dataDictionaryService;
+
+    public void setDataDictionaryService( DataDictionaryService dataDictionaryService )
+    {
+        this.dataDictionaryService = dataDictionaryService;
+    }
+
+    private IndicatorService indicatorService;
+
+    public void setIndicatorService( IndicatorService indicatorService )
+    {
+        this.indicatorService = indicatorService;
+    }
+
     private ServiceProvider<ExportService> serviceProvider;
 
     public void setServiceProvider( ServiceProvider<ExportService> serviceProvider )
@@ -105,6 +138,20 @@
     // Input
     // -------------------------------------------------------------------------
 
+    private Integer dataDictionaryId;
+
+    public void setDataDictionaryId( Integer dataDictionaryId )
+    {
+        this.dataDictionaryId = dataDictionaryId;
+    }
+
+    private String key;
+
+    public void setKey( String key )
+    {
+        this.key = key;
+    }
+
     private String type;
 
     public void setType( String type )
@@ -112,13 +159,6 @@
         this.type = type;
     }
 
-    private List<Integer> activeIds = new ArrayList<Integer>();
-
-    public void setActiveIds( List<Integer> activeIds )
-    {
-        this.activeIds = activeIds;
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -132,13 +172,30 @@
 
             if ( type.equals( TYPE_DATAELEMENT ) )
             {
-                if ( (activeIds != null) && !activeIds.isEmpty() )
-                {
-                    params.setDataElements( activeIds );
-                }
-                else
-                {
-                    params.setDataElements( null );
+                List<DataElement> dataElements = null;
+
+                if ( isNotBlank( key ) ) // Filter on key only if set
+                {
+                    dataElements = new ArrayList<DataElement>( dataElementService.searchDataElementsByName( key ) );
+                }
+                else if ( dataDictionaryId != null )
+                {
+                    dataElements = new ArrayList<DataElement>( dataDictionaryService.getDataElementsByDictionaryId( dataDictionaryId ) );
+                }
+                else
+                {
+                    dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
+                }
+                
+                Collections.sort( dataElements, new DataElementNameComparator() ); 
+
+                if ( (dataElements != null) && !dataElements.isEmpty() )
+                {
+                    params.setDataElementObjects( dataElements );
+                }
+                else
+                {
+                    params.setDataElementObjects( null );
                 }
 
                 fileName = FILENAME_DATAELEMENT;
@@ -147,13 +204,31 @@
             }
             else if ( type.equals( TYPE_INDICATOR ) )
             {
-                if ( (activeIds != null) && !activeIds.isEmpty() )
-                {
-                    params.setIndicators( activeIds );
-                }
-                else
-                {
-                    params.setIndicators( null );
+                List<Indicator> indicators = null;
+
+                if ( isNotBlank( key ) ) // Filter on key only if set
+                {
+                    indicators = new ArrayList<Indicator>( indicatorService.getIndicatorsLikeName( key ) );
+                }
+                else if ( dataDictionaryId != null )
+                {
+                    indicators = new ArrayList<Indicator>( dataDictionaryService.getDataDictionary( dataDictionaryId )
+                        .getIndicators() );
+                }
+                else
+                {
+                    indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
+                }
+                
+                Collections.sort( indicators, new IndicatorNameComparator() );
+
+                if ( (indicators != null) && !indicators.isEmpty() )
+                {
+                    params.setIndicatorObjects( indicators );
+                }
+                else
+                {
+                    params.setIndicatorObjects( null );
                 }
 
                 fileName = FILENAME_INDICATOR;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml	2011-07-07 11:08:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml	2011-09-10 08:40:27 +0000
@@ -675,6 +675,11 @@
     <property name="serviceProvider">
       <ref bean="exportServiceProvider" />
     </property>
+    <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService"/>
+    <property name="dataDictionaryService" ref="org.hisp.dhis.datadictionary.DataDictionaryService"/>
+    <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService"/>
+    
+	
   </bean>
 
 	<!-- Other -->

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm	2011-09-09 06:04:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm	2011-09-10 08:40:27 +0000
@@ -43,7 +43,7 @@
 						</div>
 					</td>
 					<td style="text-align:right">
-						<input type="button" value="$i18n.getString( 'get_pdf' )" onclick="//exportPdfByType( 'dataelement' );" style="width:80px"/>
+						<input type="button" value="$i18n.getString( 'get_pdf' )" onclick="exportPDF( 'dataelement' );" style="width:80px"/>
                         <input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortDataElementForm.action'" style="width:80px"/>
                         #if ( $!dataDictionaryMode && $dataDictionaryMode == "extended" )
 							<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddExtendedDataElementForm.action'" style="width:80px"/>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm	2011-09-09 06:04:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm	2011-09-10 08:40:27 +0000
@@ -31,7 +31,7 @@
 						</div>
 					</td>
 					<td style="text-align:right">
-                        <input type="button" value="$i18n.getString( 'get_pdf' )" onclick="//exportPdfByType( 'indicator' );" style="width:80px"/><br>
+                        <input type="button" value="$i18n.getString( 'get_pdf' )" onclick="exportPDF( 'indicator' );" style="width:80px"/>
 						<input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortIndicatorForm.action'" style="width:80px"/>
 					    #if ( $dataDictionaryMode == "extended" )
 							<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddExtendedIndicatorForm.action'" style="width:80px"/>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js	2011-09-06 07:57:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js	2011-09-10 08:40:27 +0000
@@ -1,3 +1,14 @@
+function exportPDF( type )
+{
+	var params = {
+		type: type,
+		key: jQuery( 'input[type=text][name=key]' ).val(),
+		dataDictionaryId: jQuery( '#dataDictionaryList' ).val()
+	};
+	
+	exportPdfByType( params );
+}
+
 function changeValueType( value )
 {
     if ( value == 'int' )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js	2011-06-22 18:53:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js	2011-09-10 08:40:27 +0000
@@ -1,3 +1,14 @@
+function exportPDF( type )
+{
+	var params = {
+		type: type,
+		key: jQuery( 'input[type=text][name=key]' ).val(),
+		dataDictionaryId: jQuery( '#dataDictionaryList' ).val()
+	};
+	
+	exportPdfByType( params );
+}
+
 function indicatorTypeChanged()
 {
     var type = byId( 'indicatorTypeId' ).options[byId( 'indicatorTypeId' ).selectedIndex].getAttribute( 'number' );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/pdf/ExportToPdfAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/pdf/ExportToPdfAction.java	2011-09-09 06:18:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/pdf/ExportToPdfAction.java	2011-09-10 08:40:27 +0000
@@ -182,7 +182,7 @@
 
                 if ( (userCredentialsList != null) && !userCredentialsList.isEmpty() )
                 {
-                    params.setUsers( userCredentialsList );
+                    params.setUserObjects( userCredentialsList );
                 }
                 else
                 {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js	2011-09-09 06:18:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js	2011-09-10 08:40:27 +0000
@@ -5,10 +5,13 @@
 
 function exportPDF( type )
 {
-	var params = "&key=" + jQuery( 'input[type=text][id=key]' ).val();
-	params += "&months=" + jQuery( '#months' ).val();
+	var params = {
+		type: type,
+		key: jQuery( 'input[type=text][id=key]' ).val(),
+		months: jQuery( '#months' ).val()
+	};
 
-	exportPdfByType( type, params );
+	exportPdfByType( params );
 }
 
 // -----------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/pdf/ExportToPdfAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/pdf/ExportToPdfAction.java	2010-12-09 05:53:20 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/pdf/ExportToPdfAction.java	2011-09-10 08:40:27 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.validationrule.action.pdf;
 
 /*
- * Copyright (c) 2004-2010, University of Oslo
+ * Copyright (c) 2004-2011, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,8 +27,11 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.commons.logging.Log;
@@ -38,6 +41,9 @@
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.importexport.ExportParams;
 import org.hisp.dhis.importexport.ExportService;
+import org.hisp.dhis.validation.ValidationRule;
+import org.hisp.dhis.validation.ValidationRuleService;
+import org.hisp.dhis.validation.comparator.ValidationRuleNameComparator;
 
 import com.opensymphony.xwork2.Action;
 
@@ -67,6 +73,13 @@
         this.serviceProvider = serviceProvider;
     }
 
+    private ValidationRuleService validationRuleService;
+
+    public void setValidationRuleService( ValidationRuleService validationRuleService )
+    {
+        this.validationRuleService = validationRuleService;
+    }
+
     private I18n i18n;
 
     public void setI18n( I18n i18n )
@@ -82,6 +95,26 @@
     }
 
     // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private List<ValidationRule> validationRulesList;
+
+    private String type;
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    private String key;
+
+    public void setKey( String key )
+    {
+        this.key = key;
+    }
+
+    // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
 
@@ -100,24 +133,6 @@
     }
 
     // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private String type;
-
-    public void setType( String type )
-    {
-        this.type = type;
-    }
-
-    private List<Integer> activeIds = new ArrayList<Integer>();
-
-    public void setActiveIds( List<Integer> activeIds )
-    {
-        this.activeIds = activeIds;
-    }
-
-    // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
@@ -130,17 +145,28 @@
 
             if ( type.equals( TYPE_VALIDATION_RULE ) )
             {
-                if ( (activeIds != null) && !activeIds.isEmpty() )
-                {
-                    params.setValidationRules( activeIds );
-                }
-                else
-                {
-                    params.setValidationRules( null );
+                if ( isNotBlank( key ) ) // Filter on key only if set
+                {
+                    validationRulesList = new ArrayList<ValidationRule>( validationRuleService.getValidationRulesByName( key ) );
+                }
+                else
+                {
+                    validationRulesList = new ArrayList<ValidationRule>( validationRuleService.getAllValidationRules() );
+                }
+
+                Collections.sort( validationRulesList, new ValidationRuleNameComparator() );
+
+                if ( (validationRulesList != null) && !validationRulesList.isEmpty() )
+                {
+                    params.setValidationRuleObjects( validationRulesList );
+                }
+                else
+                {
+                    params.setValidationRuleObjects( null );
                 }
 
                 fileName = FILENAME_VALIDATION_RULE;
-                
+
                 log.info( "Exporting to PDF for object type: " + TYPE_VALIDATION_RULE );
             }
 

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml	2011-09-08 17:31:21 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml	2011-09-10 08:40:27 +0000
@@ -276,6 +276,7 @@
     <property name="serviceProvider">
       <ref bean="exportServiceProvider" />
     </property>
+    <property name="validationRuleService" ref="org.hisp.dhis.validation.ValidationRuleService" />
   </bean>
 
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm	2011-09-09 06:04:18 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm	2011-09-10 08:40:27 +0000
@@ -2,7 +2,18 @@
 	jQuery(document).ready(function(){	
 		tableSorter( 'listTable' );	
 	});
-
+	
+	function exportPDF( type )
+	{
+		var params =
+		{
+			type: type,
+			key: jQuery( 'input[type=text][name=key]' ).val()
+		};
+		
+		exportPdfByType( params );
+	}
+	
 	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_validation_rule" ) , "'")';
 	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'")';
 	var i18n_equal_to = '$encoder.jsEscape( $i18n.getString( "equal_to" ) , "'")';
@@ -22,7 +33,7 @@
 				<tr>
 					<td>#filterDiv( "showValidationRuleForm" )</td>
 					<td style="text-align:right">
-						<input type="button" value="$i18n.getString( 'get_pdf' )" onclick="//exportPdfByType( 'validationrule' );" style="width:80px"/>
+						<input type="button" value="$i18n.getString( 'get_pdf' )" onclick="exportPDF( 'validationrule' );" style="width:80px"/>
 						<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddValidationRuleForm.action'">
 					</td>
 				</tr>