SingleSelect ListField
Description
causes
relates to
Activity
Marc Sladek 29 January 2018 at 15:14(edited)
The merge caused:
because I moved some methods to the superclass, but when instantiating via reflection it still expects it in the subclass if the dependency is not updated in all projects. solution:
https://github.com/celements/celements-xwiki/pull/11
had the same issue in
Marc Sladek 25 January 2018 at 22:02(edited)
Additionally, I added a SingleListField, which is basically the same as a ListField with multiselect(false)
but with easier to use generics:
class SingleListField<T> implements ClassField<T>
instead ofclass ListField<T> implements ClassField<List<T>>
Type Hierarchy:
AbstractListField<T, E> implements CustomClassField<T>
ListField<T> extends AbstractListField<List<T>, T>
DBListField extends ListField<String>
CustomListField<T> extends ListField<T>
StringListField extends CustomListField<String> (aka StaticListField)
SingleListField<T> extends AbstractListField<T, T>
CustomSingleListField<T> extends SingleListField<T>
StringSingleListField extends CustomSingleListField<String> (aka StaticSingleListField)
Marc Sladek 20 December 2017 at 17:38(edited)
This is a problem for singleSelect ListField<T> extends ClassField<List<T>> . when calling
filter(listField, Arrays.asList(val1, val2))
it does not in fact call the filter with an OR-List, but merely the key/value filter (since value is expected to be of type List). the right call would be with a List<List<T>>:
filter(listField, Arrays.asList(Arrays.asList(val1), Arrays.asList(val2)))
This behaviour isn't intuitive for singleSelect ListFields since one expects only one value by default, therefore I propose explicit handlig for these kind of ClassFields
Details
Details
Priority
Assignee
Reporter

Sprint
Story Points
Components
Fix versions
Clockify
Start / Stop
Clockify

see comments for actual fixes
Maybe there is a Problem with the building of the OR-List for the XWikiObjectFetcher.
Ecountered example in
CourseService#getRegistrationCount works with for-loop like this:
but with the direct filetering without a for-loop, the count() will always be 0. (The list is empty):