Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#1950 closed enhancement (fixed)

Add support for any-to-any link filters in table lists views

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE 3.6
Component: core Version:
Keywords: Cc:

Description

This is similar to #1906 but to begin with it is only about support in the core for filtering on any-to-any links in table list views. There will be no generic way to add such columns to a list using the web interface. This feature is intended to be used by extensions that can inject their own columns based on any-to-any links.

Change History (10)

comment:1 Changed 6 years ago by Nicklas Nordborg

(In [6931]) References #1950: Add support for any-to-any link filters in table lists views

Basic level of support for any-to-any filters. The column definition should set the filter property to |link|target|property where:

  • link = the name of the link (required)
  • target = the type of items (eg. FILE, SAMPLE) (optional)
  • property = the property to filter on on the target item (optional)

At the moment filtering is only possible for 'exists/missing' and the value type for the column must be set to 'boolean'.

Exporting has full support for all properties. If no property is set the default is to export the name if the target item is nameable, otherwise the id.

comment:2 Changed 6 years ago by Nicklas Nordborg

Extensions should be able to extend the AbstractListColumnBean class and set properties as in the following example (linking a FILE item as 'image'):

bean.setId("linked-item");
bean.setTitle("Linked image");
bean.setProperty("|image|FILE");
bean.setValueType(Type.BOOLEAN);
bean.setFilterable(true);
bean.setExportable(true);
bean.setExportFormatter(new ToStringFormatter());

The export formatter is needed since otherwise the export plug-in expects a boolean return value.

The extension must also implement the getValue() method that does the actual fetching of the linked item and return value (eg. name of the file). The AnyToAnyDataLoader contains more or less all functionality that is needed.

comment:3 Changed 6 years ago by Nicklas Nordborg

(In [6932]) References #1950: Add support for any-to-any link filters in table lists views

Exporting did not work when column was defined by an extension since the formatter was overwritten in some cases resulting in a ClassCastException.

The AnyToAnyDataLoader can now return the linked item which allows list pages to use the regular <base:propertyvalue> taglib to link to the target item.

comment:4 Changed 6 years ago by Nicklas Nordborg

(In [6933]) References #1950: Add support for any-to-any link filters in table lists views

Filtering on properties on the target item is now supported using a subquery. A remaining issue is that the sharing options selected from the 'view/preset' list is applied also to the linked items. They should only be applied to the main query to make the behaviour consistent with how other filters work.

comment:5 Changed 6 years ago by Nicklas Nordborg

Repeating the example above with a filter on the file name:

bean.setId("linked-item");
bean.setTitle("Linked image");
bean.setProperty("|image|FILE|name");
bean.setValueType(Type.STRING);
bean.setFilterable(true);
bean.setExportable(true);
bean.setExportFormatter(new ToStringFormatter());

comment:6 Changed 6 years ago by Nicklas Nordborg

(In [6934]) References #1950: Add support for any-to-any link filters in table lists views

Redesigned the hibernate filter definitions to make it possible to only activate the filters for a single item type (=the item type reutned by a query) at a time.

comment:7 Changed 6 years ago by Nicklas Nordborg

(In [6936]) References #1950: Add support for any-to-any link filters in table lists views

Fixes an issue with creating an incorrect left join when the any-to-any link name contained a '.' character.

comment:8 Changed 6 years ago by Nicklas Nordborg

Resolution: fixed
Status: newclosed

comment:9 Changed 6 years ago by Nicklas Nordborg

(In [6956]) References #1950: Add support for any-to-any link filters in table lists views

Remove debug output.

comment:10 Changed 6 years ago by Nicklas Nordborg

(In [6957]) References #1950: Add support for any-to-any link filters in table lists views

Remove assertion tests since the methods may be called with other classes which should return null and not throw an exception.

Note: See TracTickets for help on using tickets.