← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2554: Reverted r 2548. Will add parts of it back later

 

------------------------------------------------------------
revno: 2554
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-01-13 11:50:02 +0100
message:
  Reverted r 2548. Will add parts of it back later
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-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-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.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-01-13 04:06:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java	2011-01-13 10:50:02 +0000
@@ -114,8 +114,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 );
     /**
      * Returns a DataElement with a given short name.
@@ -182,16 +181,7 @@
      * 
      * @return a collection of all active DataElements, or an empty collection
      *         if there are no active DataElements.
-     */    
-    Collection<DataElement> searchAggregateableDataElementsByName( String key );
-
-    /**
-     * Returns all active DataElements.
-     * 
-     * @return a collection of all active DataElements, or an empty collection
-     *         if there are no active DataElements.
      */
-    
     Collection<DataElement> getAllActiveDataElements();
 
     /**
@@ -473,14 +463,6 @@
      * @return data elements with identifier in the given id.
      */
     Collection<DataElement> getDataElementsByGroupId( int groupId );
-    
-    /**
-     * Returns data elements with identifier in the given id.
-     * 
-     * @param groupId is the id of data element group.
-     * @return data elements with identifier in the given id.
-     */
-    Collection<DataElement> searchDataElementsByGroupAndName( int groupId, String key );
 
     /**
      * Defines the given data elements as zero is significant. All other data elements

=== 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-01-13 04:06:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java	2011-01-13 10:50:02 +0000
@@ -143,25 +143,6 @@
      * @return a collection of all active DataElements, or an empty collection
      *         if there are no active DataElements.
      */
-    
-    Collection<DataElement> searchAggregateableDataElementsByName( String key );
-
-    /**
-     * Returns all active DataElements.
-     * 
-     * @return a collection of all active DataElements, or an empty collection
-     *         if there are no active DataElements.
-     */
-    
-    Collection<DataElement> searchDataElementsByGroupAndName( DataElementGroup dataElementGroup, String key );
-
-    /**
-     * Returns all active DataElements.
-     * 
-     * @return a collection of all active DataElements, or an empty collection
-     *         if there are no active DataElements.
-     */
-    
     Collection<DataElement> getAllActiveDataElements();
 
     /**

=== 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-01-13 04:06:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java	2011-01-13 10:50:02 +0000
@@ -27,6 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+
 import static org.hisp.dhis.i18n.I18nUtils.i18n;
 
 import java.util.ArrayList;
@@ -53,6 +54,7 @@
 import org.hisp.dhis.system.util.UUIdUtils;
 import org.springframework.transaction.annotation.Transactional;
 
+
 /**
  * @author Kristian Nordal
  * @version $Id: DefaultDataElementService.java 5243 2008-05-25 10:18:58Z
@@ -219,18 +221,6 @@
         return i18n( i18nService, dataElementStore.getAggregateableDataElements() );
     }
 
-    public Collection<DataElement> searchAggregateableDataElementsByName( String key )
-    {
-        return i18n( i18nService, dataElementStore.searchAggregateableDataElementsByName( key ) );
-    }
-
-    @Override
-    public Collection<DataElement> searchDataElementsByGroupAndName( int id, String key )
-    {
-        return i18n( i18nService, dataElementStore.searchDataElementsByGroupAndName( dataElementGroupStore.get( id ),
-            key ) );
-    }
-
     public Collection<DataElement> getAllActiveDataElements()
     {
         return i18n( i18nService, dataElementStore.getAllActiveDataElements() );
@@ -240,10 +230,9 @@
     {
         return i18n( i18nService, dataElementStore.getDataElementByName( name ) );
     }
-
-    public Collection<DataElement> searchDataElementByName( String key )
-    {
-        return i18n( i18nService, dataElementStore.searchDataElementByName( key ) );
+    
+    public Collection<DataElement> searchDataElementByName( String key ){
+    	return i18n( i18nService, dataElementStore.searchDataElementByName( key ) );
     }
 
     public DataElement getDataElementByAlternativeName( String alternativeName )
@@ -368,7 +357,7 @@
     {
         return dataElementStore.dataElementCategoryOptionComboExists( id );
     }
-
+    
     public Collection<DataElement> getDataElementsLikeName( String name )
     {
         return dataElementStore.getDataElementsLikeName( name );
@@ -378,7 +367,7 @@
     {
         return dataElementStore.getDataElementsBetween( first, max );
     }
-
+    
     public Collection<DataElement> getDataElementsBetweenByName( String name, int first, int max )
     {
         return dataElementStore.getDataElementsBetweenByName( name, first, max );
@@ -388,12 +377,12 @@
     {
         return dataElementStore.getDataElementCount();
     }
-
+    
     public int getDataElementCountByName( String name )
     {
         return dataElementStore.getDataElementCountByName( name );
     }
-
+    
     // -------------------------------------------------------------------------
     // CalculatedDataElement
     // -------------------------------------------------------------------------
@@ -524,7 +513,7 @@
     {
         return i18n( i18nService, dataElementStore.getDataElementsByDataSets( dataSets ) );
     }
-
+    
     // -------------------------------------------------------------------------
     // DataElementGroup
     // -------------------------------------------------------------------------
@@ -616,7 +605,7 @@
     {
         return dataElementGroupStore.getBetween( first, max );
     }
-
+    
     public Collection<DataElementGroup> getDataElementGroupsBetweenByName( String name, int first, int max )
     {
         return dataElementGroupStore.getBetweenByName( name, first, max );
@@ -626,12 +615,12 @@
     {
         return dataElementGroupStore.getCount();
     }
-
+    
     public int getDataElementGroupCountByName( String name )
     {
         return dataElementGroupStore.getCountByName( name );
     }
-
+    
     // -------------------------------------------------------------------------
     // DataElementGroupSet
     // -------------------------------------------------------------------------
@@ -706,7 +695,6 @@
     {
         return dataElementGroupSetStore.getBetweenByName( name, first, max );
     }
-
     // -------------------------------------------------------------------------
     // DataElementOperand
     // -------------------------------------------------------------------------
@@ -721,4 +709,5 @@
         return dataElementStore.getAllGeneratedOperands( dataElements );
     }
 
+
 }

=== 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-01-13 04:06:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java	2011-01-13 10:50:02 +0000
@@ -27,8 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
-
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.Collection;
@@ -45,7 +43,6 @@
 import org.hisp.dhis.dataelement.CalculatedDataElement;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementGroup;
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.dataelement.DataElementStore;
 import org.hisp.dhis.dataset.DataSet;
@@ -61,8 +58,7 @@
  *          larshelg $
  */
 public class HibernateDataElementStore
-    extends HibernateGenericStore<DataElement>
-    implements DataElementStore
+    extends HibernateGenericStore<DataElement> implements DataElementStore
 {
     // -------------------------------------------------------------------------
     // Dependencies
@@ -199,43 +195,6 @@
         return criteria.list();
     }
 
-    @Override
-    public Collection<DataElement> searchAggregateableDataElementsByName( String key )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        Set<String> types = new HashSet<String>();
-
-        types.add( DataElement.VALUE_TYPE_INT );
-        types.add( DataElement.VALUE_TYPE_BOOL );
-
-        Criteria criteria = session.createCriteria( DataElement.class );
-
-        criteria.add( Restrictions.in( "type", types ) );
-        criteria.add( Restrictions.ilike( "name", "%" + key + "%" ) );
-
-        return criteria.list();
-    }
-
-    public Collection<DataElement> searchDataElementsByGroupAndName( DataElementGroup group, String key )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        Set<Integer> ids = new HashSet<Integer>();
-
-        for ( DataElement dataElement : group.getMembers() )
-        {
-            ids.add( dataElement.getId() );
-        }
-
-        Criteria criteria = session.createCriteria( DataElement.class );
-
-        criteria.add( Restrictions.in( "id", ids ) );
-        criteria.add( Restrictions.ilike( "name", "%" + key + "%" ) );
-
-        return criteria.list();
-    }
-
     @SuppressWarnings( "unchecked" )
     public Collection<DataElement> getAllActiveDataElements()
     {
@@ -423,7 +382,7 @@
     {
         return getLikeName( name );
     }
-
+    
     public Collection<DataElement> getDataElementsBetween( int first, int max )
     {
         return getBetween( first, max );
@@ -443,7 +402,7 @@
     {
         return getCountByName( name );
     }
-
+    
     // -------------------------------------------------------------------------
     // DataElementOperand
     // -------------------------------------------------------------------------
@@ -495,5 +454,4 @@
             throw new RuntimeException( "Failed to get all operands", ex );
         }
     }
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java	2011-01-13 04:06:07 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java	2011-01-13 10:50:02 +0000
@@ -110,13 +110,6 @@
         return operands;
     }
 
-    private String key;
-
-    public void setKey( String key )
-    {
-        this.key = key;
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -127,13 +120,11 @@
 
         if ( id == null )
         {
-            dataElements = new ArrayList<DataElement>( dataElementService
-                .searchAggregateableDataElementsByName( key != null ? key : "" ) );
+            dataElements = new ArrayList<DataElement>( dataElementService.getAggregateableDataElements() );
         }
         else
         {
-            dataElements = new ArrayList<DataElement>( dataElementService.searchDataElementsByGroupAndName( id,
-                key != null ? key : "" ) );
+            dataElements = new ArrayList<DataElement>( dataElementService.getDataElementsByGroupId( id ) );
         }
 
         if ( dataSetId != null )
@@ -158,7 +149,7 @@
 
             this.paging = createPaging( operands.size() );
 
-            operands = operands.subList( paging.getStartPos(), paging.getEndPos() + 1 );
+            operands = operands.subList( paging.getStartPos(), paging.getEndPos() );
 
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm	2011-01-13 04:06:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm	2011-01-13 10:50:02 +0000
@@ -42,9 +42,7 @@
 		<td></td>
 		<td valign="top">
 			<label>$encoder.htmlEncode( $i18n.getString( "filter_by_name" ) )</label><br/>
-			<input type="text" id="filter" name="filter" style="width:400px"/>
-			<a href="javascript:void()" onclick="getOperandsByDataElementGroup()"><img src="../images/search.png"/></a>
-			<br/>
+			<input type="text" id="filter" name="filter" style="width:450px" onkeyup="filterList( this.value, 'dataElementId' )"/><br/>
 
 			<select id="dataElementGroupId" name="dataElementGroupId" style="width:450px" onchange="getOperandsByDataElementGroup(this.value)">
 			</select><br/>
@@ -94,7 +92,7 @@
 	{
 		numerator = true;
 		
-		dataDictionary.loadDataElementGroups( "#indicator-expression-container select[id=dataElementGroupId]");	
+		dataDictionary.loadDataElementGroups( "#indicator-expression-container select[id=dataElementGroupId]" );	
 		
 		validator.resetForm();
 		
@@ -137,11 +135,9 @@
 	{
 		var aggregationOperator = getRadioValue( 'aggregationOperator' );
 		
-		var id = getFieldValue( "indicator-expression-container select[id=dataElementGroupId]");
-		
-		var key = getFieldValue( "indicator-expression-container input[id=filter]");
+		var id = getFieldValue( "indicator-expression-container select[id=dataElementGroupId]");	
 
-		dataDictionary.loadOperands( "#indicator-expression-container select[id=dataElementId]", {id: id, aggregationOperator: aggregationOperator, usepaging:true, key:key } );	
+		dataDictionary.loadOperands( "#indicator-expression-container select[id=dataElementId]", {id: id, aggregationOperator: aggregationOperator} , usepaging:true );	
 
 		checkAggregationOperator();
 	}