package lan.dk.podcastserver.controller.task;

import lan.dk.podcastserver.business.update.UpdatePodcastBusiness;
import lan.dk.podcastserver.manager.ItemDownloadManager;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping("/api/task/updateManager")
public class UpdatePodcastController {

    @Resource UpdatePodcastBusiness updatePodcastBusiness;
    @Resource ItemDownloadManager IDM;

    @RequestMapping(value = "/updatePodcast", method = RequestMethod.GET)
    @ResponseStatus(value = HttpStatus.NO_CONTENT)
    public void updatePodcast () {
        updatePodcastBusiness.updatePodcast();
    }

    @RequestMapping(value = "/updateAndDownloadPodcast", method = RequestMethod.GET)
    @ResponseStatus(value = HttpStatus.NO_CONTENT)
    public void updateAndDownloadPodcast() {
        updatePodcastBusiness.updatePodcast();
        IDM.launchDownload();
    }

    @RequestMapping(value = "/deleteOdlItems", method = RequestMethod.GET)
    @ResponseStatus(value = HttpStatus.NO_CONTENT)
    public void deleteOldItem() {
        updatePodcastBusiness.deleteOldEpisode();
    }
}

@@ -164,16 +164,118 @@
 anager;%0A
+import lombok.RequiredArgsConstructor;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0A
 import o
@@ -566,43 +566,8 @@
 r;%0A%0A
-import javax.annotation.Resource;%0A%0A
 %0A@Re
@@ -622,16 +622,74 @@
 nager%22)%0A
+@RequiredArgsConstructor(onConstructor = @__(@Autowired))%0A
 public c
@@ -724,25 +724,21 @@
  %7B%0A%0A    
-@Resource
+final
  UpdateP
@@ -783,17 +783,13 @@
     
-@Resource
+final
  Ite
@@ -1507,9 +1507,8 @@
 %0A    %7D%0A%7D
-%0A

use di by contructor in task controller