package Ġcom . example . employee administration . repositories . employee Ċ Ċ import Ġcom . example . employee administration . model . aggreg ates . EMP LOY EE _ AGG REG ATE Ċ import Ġcom . example . employee administration . model . aggreg ates . Employee Ċ import Ġorg . apache . kafka . streams . state . Queryable Store Types Ċ import Ġorg . springframework . kafka . config . Streams BuilderFactory Bean Ċ import Ġorg . springframework . stereotype . Service Ċ import Ġjava . util .* Ċ Ċ @ Service Ċ class ĠEmployee Repository Local ( val Ġfactory : ĠStreams BuilderFactory Bean ) Ġ: ĠEmployee Repository Ġ{ ĊĊĠĠĠ Ġoverride Ġfun ĠgetAll (): ĠList < Employee > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstore Ġ= Ġfactory . kafka Streams . store ("$ EMP LOY EE _ AGG REG ATE - store ", ĠQuery able Store Types . key Value Store < String , ĠEmployee >()) ĊĠĠĠĠĠĠĠ Ġval Ġiterator Ġ= Ġstore . all () ĊĠĠĠĠĠĠĠ Ġval Ġlist Ġ= Ġmutable ListOf < Employee >() ĊĠĠĠĠĠĠĠ Ġiterator . forEach Ġ{ Ġkv Ġ-> Ġlist . add ( kv . value ) Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġlist ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetAll By Deleted False (): ĠList < Employee > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠgetAll (). filter Ġ{ Ġ! it . deleted Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetAll By Department And Deleted False ( department : ĠString ): ĠList < Employee > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠgetAll By Deleted False (). filter Ġ{ Ġit . department Ġ== Ġdepartment Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget ById And Deleted False ( id : ĠString ): ĠOptional < Employee > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠOptional . of Nullable ( getAll By Deleted False (). first OrNull Ġ{ Ġit . id Ġ== Ġid Ġ}) ĊĠĠĠ Ġ} Ċ Ċ }