dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14193
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4720: simplified DataSetTypeFilter
------------------------------------------------------------
revno: 4720
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-09-27 14:29:30 +0200
message:
simplified DataSetTypeFilter
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/DataSetTypeFilter.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/filter/DataSetTypeFilter.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/DataSetTypeFilter.java 2011-09-27 12:25:40 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/DataSetTypeFilter.java 2011-09-27 12:29:30 +0000
@@ -28,11 +28,15 @@
package org.hisp.dhis.system.filter;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.system.util.Filter;
+/**
+ * @author mortenoh
+ */
public class DataSetTypeFilter
implements Filter<DataSet>
{
@@ -40,25 +44,12 @@
public DataSetTypeFilter( String... types )
{
- for ( int i = 0; i < types.length; i++ )
- {
- dataSetTypes.add( types[i] );
- }
+ dataSetTypes = Arrays.asList( types );
}
@Override
public boolean retain( DataSet dataSet )
{
- String dataSetType = dataSet.getDataSetType();
-
- for ( String type : dataSetTypes )
- {
- if ( type.equals( dataSetType ) )
- {
- return true;
- }
- }
-
- return false;
+ return dataSetTypes.contains( dataSet.getDataSetType() );
}
}