package Ġno . sk at te et aten . aur ora . b oo ber . feature Ċ Ċ import Ġno . sk at te et aten . aur ora . b oo ber . model . A ur ora Config Field Handler Ċ import Ġno . sk at te et aten . aur ora . b oo ber . model . A ur ora Context Command Ċ import Ġno . sk at te et aten . aur ora . b oo ber . model . A ur ora Deployment Spec Ċ import Ġno . sk at te et aten . aur ora . b oo ber . model . A ur ora Resource Ċ import Ġno . sk at te et aten . aur ora . b oo ber . model . add Labels Ċ import Ġno . sk at te et aten . aur ora . b oo ber . service . UserDetails Provider Ċ import Ġno . sk at te et aten . aur ora . b oo ber . utils . Inst ants Ċ import Ġno . sk at te et aten . aur ora . b oo ber . utils . normalize Labels Ċ import Ġorg . springframework . stereotype . Service Ċ import Ġjava . time . Zone Id Ċ Ċ @ Service Ċ class ĠCommon Label Feature ( val Ġuser Details Provider : ĠUser Details Provider ) Ġ: ĠFeature Ġ{ ĊĊĠĠĠ Ġ// Ġall Ġhandlers Ġare Ġin Ġ Ġheader ĊĠĠĠ Ġoverride Ġfun Ġhandlers ( header : ĠA ur ora Deployment Spec , Ġcmd : ĠA ur ora Context Command ): ĠSet < A ur ora Config Field Handler > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġempty Set () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġcreate Common Labels ( adc : ĠA ur ora Deployment Spec ): ĠMap < String , ĠString > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnow Ġ= ĠInst ants . now ĊĠĠĠĠĠĠĠ Ġval Ġlabels Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" app " Ġto Ġadc . name , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" updated By " Ġto Ġuser Details Provider . get Authenticated User (). username . replace (" :", Ġ"- "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" updatedAt " Ġto Ġnow . epoch Second . toString (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" last Updated Year " Ġto Ġnow . at Zone ( Zone Id . system Default ()). year . toString (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" aff iliation " Ġto Ġadc . aff iliation , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" name " Ġto Ġadc . name ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġlabels . normalize Labels () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġmodify ( ĊĠĠĠĠĠĠĠ Ġadc : ĠA ur ora Deployment Spec , ĊĠĠĠĠĠĠĠ Ġresources : ĠSet < A ur ora Resource >, ĊĠĠĠĠĠĠĠ Ġcontext : ĠFeature Context ĊĠĠĠ Ġ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcommon Labels Ġ= Ġcreate Common Labels ( adc ) ĊĠĠĠĠĠĠĠ Ġresources . add Labels ( common Labels , Ġ" Added Ġcommon Labels ", Ġthis :: class . java ) ĊĠĠĠ Ġ} Ċ } Ċ