=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java 2015-02-10 18:40:27 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java 2015-02-12 15:16:32 +0000 @@ -32,6 +32,7 @@ import java.util.Collection; import java.util.List; +import org.hisp.dhis.trackedentity.TrackedEntityAttribute; import org.hisp.dhis.util.ObjectUtils; /** @@ -110,13 +111,13 @@ return filters != null && !filters.isEmpty(); } - public static List getQueryItems( Collection objects ) + public static List getQueryItems( Collection attributes ) { List queryItems = new ArrayList<>(); - for ( NameableObject object : objects ) + for ( TrackedEntityAttribute attribute : attributes ) { - queryItems.add( new QueryItem( object, null, null ) ); + queryItems.add( new QueryItem( attribute, attribute.getValueType(), attribute.hasOptionSet() ? attribute.getOptionSet().getUid() : null ) ); } return queryItems; === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2015-02-10 18:09:22 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2015-02-12 15:16:32 +0000 @@ -52,11 +52,6 @@ public class TrackedEntityAttribute extends BaseDimensionalObject { - /** - * Determines if a de-serialized file is compatible with this class. - */ - private static final long serialVersionUID = 3026922158464592390L; - public static final String TYPE_DATE = "date"; public static final String TYPE_STRING = "string"; public static final String TYPE_NUMBER = "number"; @@ -140,6 +135,23 @@ return optionSet != null; } + /** + * Checks whether the given value is present among the options in the option + * set of this attribute, matching on code. + */ + public Boolean isValidOptionValue( String value ) + { + for ( Option option : this.getOptionSet().getOptions() ) + { + if ( option.getCode().equals( value ) ) + { + return true; + } + } + + return false; + } + // ------------------------------------------------------------------------- // Getters and setters // ------------------------------------------------------------------------- @@ -331,19 +343,6 @@ this.confidential = confidential; } - public Boolean isValidOptionValue( String value ) - { - for ( Option option : this.getOptionSet().getOptions() ) - { - if ( option.getCode().equals( value ) ) - { - return true; - } - } - - return false; - } - @Override public void mergeWith( IdentifiableObject other, MergeStrategy strategy ) { === modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java' --- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2015-02-10 18:40:27 +0000 +++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2015-02-12 15:16:32 +0000 @@ -200,14 +200,12 @@ { if ( params.hasProgram() ) { - params.addAttributesIfNotExist( QueryItem.getQueryItems( params.getProgram() - .getTrackedEntityAttributes() ) ); + params.addAttributesIfNotExist( QueryItem.getQueryItems( params.getProgram().getTrackedEntityAttributes() ) ); } else { Collection filters = attributeService.getAllTrackedEntityAttributes(); - Collection attributes = attributeService - .getTrackedEntityAttributesDisplayInList(); + Collection attributes = attributeService.getTrackedEntityAttributesDisplayInList(); filters.removeAll( attributes ); params.addAttributesIfNotExist( QueryItem.getQueryItems( attributes ) );