package Ġorg . got son . kom ga . infrastructure . jooq Ċ Ċ import Ġorg . got son . kom ga . domain . persistence . Refer ential Repository Ċ import Ġorg . got son . kom ga . jooq . Tables Ċ import Ġorg . jooq . DSL Context Ċ import Ġorg . jooq . impl . DSL . lower Ċ import Ġorg . jooq . impl . DSL . select Ċ import Ġorg . springframework . stereotype . Component Ċ Ċ @ Component Ċ class ĠRefer ential Dao ( ĊĠ Ġprivate Ġval Ġd sl : ĠDSL Context Ċ ) Ġ: ĠRefer ential Repository Ġ{ ĊĊĠ Ġprivate Ġval Ġa Ġ= ĠTables . BOOK _ METADATA _ AUTHOR ĊĠ Ġprivate Ġval Ġsd Ġ= ĠTables . SER IES _ METADATA ĊĠ Ġprivate Ġval Ġs Ġ= ĠTables . SER IES ĊĠ Ġprivate Ġval Ġb Ġ= ĠTables . BOOK ĊĠ Ġprivate Ġval Ġg Ġ= ĠTables . SER IES _ METADATA _ GEN RE ĊĠ Ġprivate Ġval Ġbt Ġ= ĠTables . BOOK _ METADATA _ TAG ĊĠ Ġprivate Ġval Ġst Ġ= ĠTables . SER IES _ METADATA _ TAG ĊĊĠ Ġoverride Ġfun Ġfind Authors ByName ( search : ĠString ): ĠList < String > Ġ= ĊĠĠĠ Ġd sl . select Distinct ( a . NAME ) ĊĠĠĠĠĠ Ġ. from ( a ) ĊĠĠĠĠĠ Ġ. where ( a . NAME . contains IgnoreCase ( search )) ĊĠĠĠĠĠ Ġ. orderBy ( a . NAME ) ĊĠĠĠĠĠ Ġ. fetch ( a . NAME ) ĊĊĠ Ġoverride Ġfun ĠfindAll Gen res (): ĠSet < String > Ġ= ĊĠĠĠ Ġd sl . select Distinct ( g . GEN RE ) ĊĠĠĠĠĠ Ġ. from ( g ) ĊĠĠĠĠĠ Ġ. orderBy ( lower ( g . GEN RE )) ĊĠĠĠĠĠ Ġ. fetch Set ( g . GEN RE ) ĊĊĠ Ġoverride Ġfun ĠfindAll Gen res By Library ( library Id : ĠString ): ĠSet < String > Ġ= ĊĠĠĠ Ġd sl . select Distinct ( g . GEN RE ) ĊĠĠĠĠĠ Ġ. from ( g ) ĊĠĠĠĠĠ Ġ. leftJoin ( s ). on ( g . SER IES _ ID . eq ( s . ID )) ĊĠĠĠĠĠ Ġ. where ( s . LIBRARY _ ID . eq ( library Id )) ĊĠĠĠĠĠ Ġ. orderBy ( lower ( g . GEN RE )) ĊĠĠĠĠĠ Ġ. fetch Set ( g . GEN RE ) ĊĊĠ Ġoverride Ġfun ĠfindAll Tags (): ĠSet < String > Ġ= ĊĠĠĠ Ġd sl . select ( bt . TAG .` as ` (" tag ")) ĊĠĠĠĠĠ Ġ. from ( bt ) ĊĠĠĠĠĠ Ġ. union ( ĊĠĠĠĠĠĠĠ Ġselect ( st . TAG .` as ` (" tag ")). from ( st ) ĊĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġ. fetch Set ( 0 , ĠString :: class . java ) ĊĠĠĠĠĠ Ġ. sorted By Ġ{ Ġit . toLowerCase () Ġ} ĊĠĠĠĠĠ Ġ. toSet () ĊĊĠ Ġoverride Ġfun ĠfindAll Tags By Library ( library Id : ĠString ): ĠSet < String > Ġ= ĊĠĠĠ Ġd sl . select ( st . TAG ) ĊĠĠĠĠĠ Ġ. from ( st ) ĊĠĠĠĠĠ Ġ. leftJoin ( s ). on ( st . SER IES _ ID . eq ( s . ID )) ĊĠĠĠĠĠ Ġ. where ( s . LIBRARY _ ID . eq ( library Id )) ĊĠĠĠĠĠ Ġ. orderBy ( lower ( st . TAG )) ĊĠĠĠĠĠ Ġ. fetch Set ( st . TAG ) ĊĊĠ Ġoverride Ġfun ĠfindAll Tags By Series ( series Id : ĠString ): ĠSet < String > Ġ= ĊĠĠĠ Ġd sl . select ( bt . TAG ) ĊĠĠĠĠĠ Ġ. from ( bt ) ĊĠĠĠĠĠ Ġ. leftJoin ( b ). on ( bt . BOOK _ ID . eq ( b . ID )) ĊĠĠĠĠĠ Ġ. where ( b . SER IES _ ID . eq ( series Id )) ĊĠĠĠĠĠ Ġ. orderBy ( lower ( bt . TAG )) ĊĠĠĠĠĠ Ġ. fetch Set ( bt . TAG ) ĊĊĠ Ġoverride Ġfun ĠfindAll Languages (): ĠSet < String > Ġ= ĊĠĠĠ Ġd sl . select Distinct ( sd . LANGUAGE ) ĊĠĠĠĠĠ Ġ. from ( sd ) ĊĠĠĠĠĠ Ġ. where ( sd . LANGUAGE . ne ("")) ĊĠĠĠĠĠ Ġ. orderBy ( sd . LANGUAGE ) ĊĠĠĠĠĠ Ġ. fetch Set ( sd . LANGUAGE ) ĊĊĠ Ġoverride Ġfun ĠfindAll Language sBy Library ( library Id : ĠString ): ĠSet < String > Ġ= ĊĠĠĠ Ġd sl . select Distinct ( sd . LANGUAGE ) ĊĠĠĠĠĠ Ġ. from ( sd ) ĊĠĠĠĠĠ Ġ. leftJoin ( s ). on ( sd . SER IES _ ID . eq ( s . ID )) ĊĠĠĠĠĠ Ġ. where ( sd . LANGUAGE . ne ("")) ĊĠĠĠĠĠ Ġ. and ( s . LIBRARY _ ID . eq ( library Id )) ĊĠĠĠĠĠ Ġ. orderBy ( sd . LANGUAGE ) ĊĠĠĠĠĠ Ġ. fetch Set ( sd . LANGUAGE ) ĊĊĠ Ġoverride Ġfun ĠfindAll Publish ers (): ĠSet < String > Ġ= ĊĠĠĠ Ġd sl . select Distinct ( sd . PUBL IS HER ) ĊĠĠĠĠĠ Ġ. from ( sd ) ĊĠĠĠĠĠ Ġ. where ( sd . PUBL IS HER . ne ("")) ĊĠĠĠĠĠ Ġ. orderBy ( sd . PUBL IS HER ) ĊĠĠĠĠĠ Ġ. fetch Set ( sd . PUBL IS HER ) ĊĊĠ Ġoverride Ġfun ĠfindAll Publish ers By Library ( library Id : ĠString ): ĠSet < String > Ġ= ĊĠĠĠ Ġd sl . select Distinct ( sd . PUBL IS HER ) ĊĠĠĠĠĠ Ġ. from ( sd ) ĊĠĠĠĠĠ Ġ. leftJoin ( s ). on ( sd . SER IES _ ID . eq ( s . ID )) ĊĠĠĠĠĠ Ġ. where ( sd . PUBL IS HER . ne ("")) ĊĠĠĠĠĠ Ġ. and ( s . LIBRARY _ ID . eq ( library Id )) ĊĠĠĠĠĠ Ġ. orderBy ( sd . PUBL IS HER ) ĊĠĠĠĠĠ Ġ. fetch Set ( sd . PUBL IS HER ) Ċ } Ċ