Changeset 7915
- Timestamp:
- Feb 24, 2021, 8:24:44 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/src/docbook/developer/extensions.xml
r7548 r7915 2492 2492 </sect2> 2493 2493 2494 <sect2 id="extensions_developer.query_filters"> 2495 <title>Query filters</title> 2496 2497 <para> 2498 This extension point makes it possible to extend filtering 2499 functionality for queries that are generated by list pages via the 2500 <methodname>ItemContext.configureQuery()</methodname> method in the 2501 <classname docapi="net.sf.basedb.core">ItemContext</classname> class. 2502 2503 Actions should implement the <interfacename 2504 docapi="net.sf.basedb.core.query">QueryFilterAction</interfacename> 2505 interface. This interface allows an extension to filter a query based 2506 on a single column filter, a filter row or a combination of everything. 2507 </para> 2508 2509 <para> 2510 Note that the <methodname>ActionFactory.prepareContext()</methodname> is 2511 called for all filter extensions at all times. It is recommended that 2512 the implementation checks the current context for the type of items in the 2513 list and if there is a filter in a column that the extension should handle. 2514 An extension may override the default implementation of any filter, but this 2515 is not recommended. The recommended design is to combine the filter 2516 extension with a custom column that uses the <code>!x.</code> prefix 2517 as the column id. Here is an example from the Variant Search extension 2518 (<ulink url="http://baseplugins.thep.lu.se/wiki/net.sf.basedb.varsearch" 2519 >http://baseplugins.thep.lu.se/wiki/net.sf.basedb.varsearch</ulink>): 2520 </para> 2521 2522 <programlisting language="java"> 2523 <![CDATA[ 2524 public boolean prepareContext(InvokationContext<? super QueryFilterAction> context) 2525 { 2526 // Enabled in the RAWBIOASSAY list page 2527 // and if the !x.lucene column is present with a filter 2528 // and if the service database is running 2529 ItemContext ctx = context.getClientContext().getCurrentItem(); 2530 return ctx.getItemType() == Item.RAWBIOASSAY && 2531 ctx.hasExtensionFilter("lucene") && 2532 VarSearchService.getInstance().isRunning(); 2533 } 2534 ]]> 2535 </programlisting> 2536 2537 2538 </sect2> 2539 2494 2540 <sect2 id="extensions_developer.login-manager"> 2495 2541 <title>Login manager</title>
Note: See TracChangeset
for help on using the changeset viewer.