dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10070
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2748: Fixed bug in the filter.
------------------------------------------------------------
revno: 2748
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-01-26 00:47:57 +0700
message:
Fixed bug in the filter.
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/TextUtilsTest.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.ajax.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.js
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/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/GetDataElementCategoryComboListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/GetConceptListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ValidateDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/ListDataElementGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetIndicatorGroupListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/ListIndicatorGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/DataSetListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/GetGroupSetListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserListAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetAllChartsAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/GetAllDocumentsAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/GetAllReportsAction.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationRuleListAction.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/GetValidationRuleGroupListAction.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-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java 2011-01-25 17:47:57 +0000
@@ -98,4 +98,12 @@
{
return string != null && string.trim().length() == 0 ? null : string;
}
+
+ /**
+ * Returns a trimmed/reduced at the redundant spaces string for a given input
+ */
+ public static String getTrimmedValue( String value )
+ {
+ return value.trim().replaceAll( "\\s+", " " );
+ }
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/TextUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/TextUtilsTest.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/TextUtilsTest.java 2011-01-25 17:47:57 +0000
@@ -30,6 +30,7 @@
import junit.framework.TestCase;
import static org.hisp.dhis.system.util.TextUtils.subString;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
/**
* @author Lars Helge Overland
@@ -56,4 +57,9 @@
assertEquals( "", subString( STRING, 4, 0 ) );
}
+
+ public void testGetTrimmedValue()
+ {
+ assertEquals( "abc def 123", getTrimmedValue( " abc def 123 " ) );
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.ajax.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.ajax.js 2011-01-22 22:12:38 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.ajax.js 2011-01-25 17:47:57 +0000
@@ -188,7 +188,7 @@
this.params = params;
this.jQuerySelectionString = jQuerySelectionString;
- jQuery.getJSON( '../dhis-web-commons-ajax-json/getOperands.action'
+ jQuery.postJSON( '../dhis-web-commons-ajax-json/getOperands.action'
, this.params
, function( json ){
jQuery.each( json.operands, function(i, item){
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.js 2010-10-21 11:06:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.js 2011-01-25 17:47:57 +0000
@@ -660,7 +660,7 @@
// select by name and filter by form for performance over form.find("[name=...]")
var form = this.currentForm;
return $(document.getElementsByName(name)).map(function(index, element) {
- return element.form == form && element.name == name && element || null;
+ return element.form == form && element.name == name && element || null;
});
},
=== 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-22 22:35:40 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java 2011-01-25 17:47:57 +0000
@@ -27,11 +27,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementOperand;
@@ -51,7 +53,7 @@
extends ActionPagingSupport<DataElementOperand>
{
private static Filter<DataElement> AGGREGATABLE_FILTER = new AggregatableDataElementFilter();
-
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -87,12 +89,12 @@
{
this.id = id;
}
-
+
private String key;
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
private Integer dataSetId;
@@ -150,7 +152,7 @@
{
dataElements = new ArrayList<DataElement>( dataElementService.getDataElementGroup( id ).getMembers() );
}
- else if ( !StringUtils.isEmpty( key ) )
+ else if ( isNotBlank( key ) )
{
dataElements = new ArrayList<DataElement>( dataElementService.getDataElementsLikeName( key ) );
}
@@ -173,7 +175,8 @@
FilterUtils.filter( dataElements, new DataElementPeriodTypeFilter( periodType ) );
}
- operands = new ArrayList<DataElementOperand>( dataElementCategoryService.getOperands( dataElements, includeTotals ) );
+ operands = new ArrayList<DataElementOperand>( dataElementCategoryService.getOperands( dataElements,
+ includeTotals ) );
Collections.sort( operands, new DataElementOperandNameComparator() );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryListAction.java 2010-12-26 15:38:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -73,9 +74,9 @@
{
return defaultCategory;
}
-
+
private String key;
-
+
public String getKey()
{
return key;
@@ -83,7 +84,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
@@ -97,16 +98,18 @@
if ( isNotBlank( key ) ) // Filter on key only if set
{
this.paging = createPaging( dataElementCategoryService.getDataElementCategoryCountByName( key ) );
-
- dataElementCategories = new ArrayList<DataElementCategory>( dataElementCategoryService.getDataElementCategorysBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+
+ dataElementCategories = new ArrayList<DataElementCategory>( dataElementCategoryService
+ .getDataElementCategorysBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
}
else
{
this.paging = createPaging( dataElementCategoryService.getDataElementCategoryCount() );
-
- dataElementCategories = new ArrayList<DataElementCategory>( dataElementCategoryService.getDataElementCategorysBetween( paging.getStartPos(), paging.getPageSize() ) );
+
+ dataElementCategories = new ArrayList<DataElementCategory>( dataElementCategoryService
+ .getDataElementCategorysBetween( paging.getStartPos(), paging.getPageSize() ) );
}
-
+
Collections.sort( dataElementCategories, new DataElementCategoryNameComparator() );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/GetDataElementCategoryComboListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/GetDataElementCategoryComboListAction.java 2010-12-26 15:38:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/GetDataElementCategoryComboListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -73,8 +74,9 @@
{
return defaultCombo;
}
+
private String key;
-
+
public String getKey()
{
return key;
@@ -82,10 +84,9 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -98,18 +99,20 @@
if ( isNotBlank( key ) ) // Filter on key only if set
{
this.paging = createPaging( dataElementCategoryService.getDataElementCategoryComboCountByName( key ) );
-
- dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>( dataElementCategoryService.getDataElementCategoryCombosBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+
+ dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>( dataElementCategoryService
+ .getDataElementCategoryCombosBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
}
else
{
this.paging = createPaging( dataElementCategoryService.getDataElementCategoryComboCount() );
-
- dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>( dataElementCategoryService.getDataElementCategoryCombosBetween( paging.getStartPos(), paging.getPageSize() ) );
+
+ dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>( dataElementCategoryService
+ .getDataElementCategoryCombosBetween( paging.getStartPos(), paging.getPageSize() ) );
}
-
+
Collections.sort( dataElementCategoryCombos, new DataElementCategoryComboNameComparator() );
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/GetConceptListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/GetConceptListAction.java 2010-12-26 15:38:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/GetConceptListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -83,7 +84,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java 2010-12-28 17:49:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -141,7 +142,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
@@ -149,7 +150,7 @@
// -------------------------------------------------------------------------
public String execute()
- {
+ {
if ( dataDictionaryId == null ) // None, get current data dictionary
{
dataDictionaryId = dataDictionaryModeManager.getCurrentDataDictionary();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ValidateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ValidateDataElementAction.java 2010-08-31 08:12:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ValidateDataElementAction.java 2011-01-25 17:47:57 +0000
@@ -115,7 +115,6 @@
if ( name != null )
{
-
DataElement match = dataElementService.getDataElementByName( name );
if ( match != null && (id == null || match.getId() != id) )
@@ -149,7 +148,7 @@
return ERROR;
}
- }
+ }
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java 2010-11-27 07:46:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java 2011-01-25 17:47:57 +0000
@@ -34,7 +34,8 @@
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.paging.ActionPagingSupport;
-import static org.apache.commons.lang.StringUtils.*;
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
/**
* @author Torgeir Lorange Ostby
@@ -67,7 +68,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/ListDataElementGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/ListDataElementGroupSetAction.java 2010-12-04 00:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroupset/ListDataElementGroupSetAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -76,7 +77,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java 2011-01-11 18:18:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -141,11 +142,11 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
- // Action implemantation
+ // Action implementation
// -------------------------------------------------------------------------
public String execute()
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetIndicatorGroupListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetIndicatorGroupListAction.java 2010-12-04 00:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetIndicatorGroupListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -76,7 +77,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/ListIndicatorGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/ListIndicatorGroupSetAction.java 2010-12-04 00:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/ListIndicatorGroupSetAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -77,7 +78,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java 2010-12-04 00:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -76,7 +77,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2010-12-30 09:13:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2011-01-25 17:47:57 +0000
@@ -164,6 +164,7 @@
dataSet.setMobile( mobile );
dataSet.setVersion( 1 );
+
for ( String id : selectedList )
{
DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( id ) );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/DataSetListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/DataSetListAction.java 2011-01-21 13:14:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/DataSetListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -95,7 +96,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupListAction.java 2010-12-30 10:02:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -76,7 +77,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/GetGroupSetListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/GetGroupSetListAction.java 2010-12-30 10:02:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/GetGroupSetListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -76,7 +77,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleListAction.java 2010-12-30 09:13:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetRoleListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.List;
@@ -69,7 +70,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
public String getKey()
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupListAction.java 2011-01-06 12:40:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.List;
@@ -70,7 +71,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
// Action Implementation
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserListAction.java 2010-12-30 09:13:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -85,34 +86,36 @@
private String key;
- public void setKey( String key )
- {
- this.key = key;
- }
-
public String getKey()
{
return key;
}
+ public void setKey( String key )
+ {
+ this.key = getTrimmedValue( key );
+ }
+
// -------------------------------------------------------------------------
// Action implemantation
// -------------------------------------------------------------------------
public String execute()
throws Exception
- {
+ {
if ( isNotBlank( key ) ) // Filter on key only if set
{
this.paging = createPaging( userService.getUserCountByName( key ) );
-
- userCredentialsList = new ArrayList<UserCredentials>( userService.getUsersBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+
+ userCredentialsList = new ArrayList<UserCredentials>( userService.getUsersBetweenByName( key, paging
+ .getStartPos(), paging.getPageSize() ) );
}
else
{
this.paging = createPaging( userService.getUserCount() );
-
- userCredentialsList = new ArrayList<UserCredentials>( userService.getUsersBetween( paging.getStartPos(), paging.getPageSize() ) );
+
+ userCredentialsList = new ArrayList<UserCredentials>( userService.getUsersBetween( paging.getStartPos(),
+ paging.getPageSize() ) );
}
Collections.sort( userCredentialsList, new UsernameComparator() );
@@ -120,7 +123,7 @@
UserCredentials userCredentials = userService.getUserCredentials( currentUser );
currentUserName = userCredentials.getUsername();
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetAllChartsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetAllChartsAction.java 2010-12-13 21:21:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetAllChartsAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -69,7 +70,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
private List<Chart> charts;
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/GetAllDocumentsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/GetAllDocumentsAction.java 2010-12-13 21:21:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/document/action/GetAllDocumentsAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.List;
@@ -74,7 +75,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/GetAllReportsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/GetAllReportsAction.java 2011-01-20 08:46:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/GetAllReportsAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import static org.hisp.dhis.util.ContextUtils.getBaseUrl;
import java.util.ArrayList;
@@ -101,7 +102,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationRuleListAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationRuleListAction.java 2010-12-03 16:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationRuleListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -76,7 +77,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/GetValidationRuleGroupListAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/GetValidationRuleGroupListAction.java 2010-12-04 00:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/validationrulegroup/GetValidationRuleGroupListAction.java 2011-01-25 17:47:57 +0000
@@ -28,6 +28,7 @@
*/
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.hisp.dhis.system.util.TextUtils.getTrimmedValue;
import java.util.ArrayList;
import java.util.Collections;
@@ -76,7 +77,7 @@
public void setKey( String key )
{
- this.key = key;
+ this.key = getTrimmedValue( key );
}
// -------------------------------------------------------------------------