/* - Ċ Ġ* Ġ#% L Ċ Ġ* Ġff 4 j - spring - boot - web - api Ċ Ġ* Ġ%% Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 3 Ġ- Ġ 2 0 1 9 ĠFF 4 J Ċ Ġ* Ġ%% Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* ĠĊ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* ĠĊ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ* Ġ# L % Ċ Ġ*/ Ċ Ċ package Ġorg . ff 4 j . spring . boot . web . api . resources ĊĊ Ċ import Ġio . swagger . annotations . Api Ċ import Ġio . swagger . annotations . ApiOperation Ċ import Ġio . swagger . annotations . ApiResponse Ċ import Ġio . swagger . annotations . Api Responses Ċ import Ġorg . ff 4 j . services . Feature Store Services Ċ import Ġorg . ff 4 j . services . constants . Feature Constants . RESOURCE _ CLEAR _ CACHE Ċ import Ġorg . ff 4 j . services . constants . Feature Constants . RESOURCE _ FF 4 J _ STORE Ċ import Ġorg . ff 4 j . services . domain . Cache Api Bean Ċ import Ġorg . ff 4 j . services . domain . Feature Api Bean Ċ import Ġorg . ff 4 j . services . domain . Feature Store Api Bean Ċ import Ġorg . ff 4 j . services . domain . Group Desc Api Bean Ċ import Ġorg . ff 4 j . web . FF 4 j Web Constants .* Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . http . HttpStatus . NO _ CONTENT Ċ import Ġorg . springframework . http . MediaType . APPLICATION _ JSON _ VALUE Ċ import Ġorg . springframework . http . Response Entity Ċ import Ġorg . springframework . web . bind . annotation . Delete Mapping Ċ import Ġorg . springframework . web . bind . annotation . GetMapping Ċ import Ġorg . springframework . web . bind . annotation . RequestMapping Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ Ċ /** Ċ Ġ* ĠCreated Ġby ĠPaul Ċ Ġ* Ċ Ġ* Ġ@ author Ġ[ Pa ul ĠW illi ams ]( mailto : paul 5 8 9 1 4 0 8 0 @ gmail . com ) Ċ Ġ*/ Ċ @ Api ( tags Ġ= Ġ[" Feature Store "], Ġdescription Ġ= Ġ" The ĠAPI Ġfor Ġaccessing Ġthe Ġstore Ġof Ġall Ġfeatures ") Ċ @ RestController Ċ @ RequestMapping ( value Ġ= Ġ[ RESOURCE _ FF 4 J _ STORE ]) Ċ class ĠFeature Store Resource (@ Autowired Ġval Ġfeature Store Service : ĠFeature Store Services ) Ġ{ ĊĊĠĠĠ Ġ@ GetMapping ( pro duces Ġ= Ġ[ APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġ@ ApiOperation ( value Ġ= Ġ" Display s Ġinformation Ġregarding Ġthe ĠFeatures Store ", Ġresponse Ġ= ĠFeature Store Api Bean :: class ) ĊĠĠĠ Ġ@ Api Responses ( ApiResponse ( code Ġ= Ġ 2 0 0 , Ġmessage Ġ= Ġ" status Ġof Ġcurrent Ġfeature Ġstore ", Ġresponse Ġ= ĠFeature Store Api Bean :: class )) ĊĠĠĠ Ġfun Ġget Feature Store (): ĠFeature Store Api Bean Ġ= Ġfeature Store Service . get Feature Store () ĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ[ ("/ $ RESOURCE _ FEATURES ") ], Ġproduces Ġ= Ġ[ APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġ@ ApiOperation ( value Ġ= Ġ" Display s Ġall Ġthe ĠFeatures ", Ġresponse Ġ= ĠFeature Api Bean :: class ) ĊĠĠĠ Ġ@ Api Responses ( ApiResponse ( code Ġ= Ġ 2 0 0 , Ġmessage Ġ= Ġ" get Ġall Ġfeatures ")) ĊĠĠĠ Ġfun ĠgetAll Features (): ĠCollection < Feature Api Bean > Ġ= Ġfeature Store Service . getAll Features () ĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ[ ("/ $ RESOURCE _ GROUP S ") ], Ġproduces Ġ= Ġ[ APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġ@ ApiOperation ( value Ġ= Ġ" Display Ġinformation Ġregarding ĠGroups ", Ġresponse Ġ= ĠGroup Desc Api Bean :: class ) ĊĠĠĠ Ġ@ Api Responses ( ApiResponse ( code Ġ= Ġ 2 0 0 , Ġmessage Ġ= Ġ" Groups Ġresource ", Ġresponse Ġ= ĠGroup Desc Api Bean :: class )) ĊĠĠĠ Ġfun ĠgetAll Groups (): ĠCollection < Group Desc Api Bean > Ġ= Ġfeature Store Service . getAll Groups () ĊĊĠĠĠ Ġ@ GetMapping ( value Ġ= Ġ[ ("/ $ RESOURCE _ CACHE ") ], Ġproduces Ġ= Ġ[ APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġ@ ApiOperation ( value Ġ= Ġ" Display Ġinformation Ġrelated Ġto ĠCache ") ĊĠĠĠ Ġ@ Api Responses ( ApiResponse ( code Ġ= Ġ 2 0 0 , Ġmessage Ġ= Ġ" Gets Ġthe Ġcached Ġfeatures ", Ġresponse Ġ= ĠCache Api Bean :: class ), ĠApiResponse ( code Ġ= Ġ 4 0 4 , Ġmessage Ġ= Ġ" feature Ġstore Ġis Ġnot Ġcached ")) ĊĠĠĠ Ġfun Ġget Features From Cache (): ĠCache Api Bean Ġ= Ġfeature Store Service . get Features From Cache () ĊĊĠĠĠ Ġ@ Delete Mapping ( value Ġ= Ġ[ ("/ $ STORE _ CLEAR ") ]) ĊĠĠĠ Ġ@ ApiOperation ( value Ġ= Ġ" Delete Ġall ĠFeatures Ġin Ġstore ") ĊĠĠĠ Ġ@ Api Responses ( ApiResponse ( code Ġ= Ġ 2 0 4 , Ġmessage Ġ= Ġ" all Ġfeature Ġhave Ġbeen Ġdeleted ")) ĊĠĠĠ Ġfun Ġdelete All Features (): ĠResponseEntity < Void > Ġ{ ĊĠĠĠĠĠĠĠ Ġfeature Store Service . delete All Features () ĊĠĠĠĠĠĠĠ Ġreturn ĠResponseEntity ( NO _ CONTENT ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Delete Mapping ( value Ġ= Ġ[( RESOURCE _ CLEAR _ CACHE )]) ĊĠĠĠ Ġ@ ApiOperation ( value Ġ= Ġ" Clear Ġcache ", Ġresponse Ġ= ĠResponseEntity :: class ) ĊĠĠĠ Ġ@ Api Responses ( ApiResponse ( code Ġ= Ġ 2 0 4 , Ġmessage Ġ= Ġ" cache Ġis Ġcleared "), ĠApiResponse ( code Ġ= Ġ 4 0 4 , Ġmessage Ġ= Ġ" feature Ġstore Ġis Ġnot Ġcached ")) ĊĠĠĠ Ġfun Ġclear Cached Feature Store (): ĠResponseEntity < Void > Ġ{ ĊĠĠĠĠĠĠĠ Ġfeature Store Service . clear Cached Feature Store () ĊĠĠĠĠĠĠĠ Ġreturn ĠResponseEntity ( NO _ CONTENT ) ĊĠĠĠ Ġ} Ċ } Ċ