/* Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 1 9 Ġdev - eth 0 . de ĠAll Ġrights Ġreserved . Ċ Ġ*/ Ċ Ċ package Ġde . dev . eth 0 . feed 2 social . impl . service . feed er . rss Ċ Ċ import Ġcom . rome tools . rome . io . Syn d Feed Input Ċ import Ġcom . rome tools . rome . io . Xml Reader Ċ import Ġde . dev . eth 0 . feed 2 social . impl . model . Feed Entry Ċ import Ġde . dev . eth 0 . feed 2 social . service . Feed er Ċ import Ġorg . slf 4 j . LoggerFactory Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . boot . autoconfigure . condition . Conditional On Property Ċ import Ġorg . springframework . boot . context . properties . Enable Configuration Properties Ċ import Ġorg . springframework . stereotype . Service Ċ import Ġjava . net . URL Ċ import Ġjava . time . LocalDateTime Ċ Ċ @ Service Ċ @ Conditional On Property (" feed . rss . url ") Ċ @ Enable Configuration Properties ( R ss Feed Properties :: class ) Ċ class ĠR ss Feed er Impl Ġ: ĠFeed er Ġ{ ĊĊĠ Ġ@ Autowired ĊĠ Ġlateinit Ġvar Ġr ss Feed Properties : ĠR ss Feed Properties ĊĊĠ Ġ@ Autowired ĊĠ Ġlateinit Ġvar Ġr ss Feed Parser : ĠR ss Feed Parser ĊĊĠ Ġprivate Ġval Ġlog Ġ= ĠLoggerFactory . getLogger ( R ss Feed er Impl :: class . java ) ĊĊĠ Ġoverride Ġfun Ġget Feed Entries ( last Run : ĠLocalDateTime ): ĠList < Feed Entry > Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġval Ġxml Reader Ġ= ĠXml Reader ( URL ( rss Feed Properties . url )) ĊĠĠĠĠĠ Ġval Ġfeed Ġ= ĠSyn d Feed Input (). build ( xml Reader ) ĊĠĠĠĠĠ Ġreturn Ġr ss Feed Parser . parse Entries ( feed . entries , Ġlast Run ) ĊĠĠĠ Ġ} Ġcatch Ġ( e : ĠException ) Ġ{ ĊĠĠĠĠĠ Ġlog . error (" Could Ġnot Ġparse Ġxml ", Ġe ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn ĠlistOf () ĊĠ Ġ} Ċ }