Controllers migration.

master
Rémi Cocula 8 years ago
parent 2c63e287df
commit 1ac243b49b
  1. 49
      libresonic-main/src/main/java/org/libresonic/player/controller/PodcastChannelsController.java
  2. 7
      libresonic-main/src/main/resources/libresonic-servlet.xml

@ -18,43 +18,49 @@
*/
package org.libresonic.player.controller;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.ParameterizableViewController;
import org.libresonic.player.domain.PodcastChannel;
import org.libresonic.player.domain.PodcastEpisode;
import org.libresonic.player.service.PodcastService;
import org.libresonic.player.service.SecurityService;
import org.libresonic.player.service.SettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* Controller for the "Podcast channels" page.
*
* @author Sindre Mehus
*/
public class PodcastChannelsController extends ParameterizableViewController {
@Controller
@RequestMapping("/podcastChannels")
public class PodcastChannelsController {
@Autowired
private PodcastService podcastService;
@Autowired
private SecurityService securityService;
@Autowired
private SettingsService settingsService;
@Override
@RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
ModelAndView result = super.handleRequestInternal(request, response);
Map<String, Object> map = new HashMap<>();
ModelAndView result = new ModelAndView();
result.addObject("model", map);
Map<PodcastChannel, List<PodcastEpisode>> channels = new LinkedHashMap<PodcastChannel, List<PodcastEpisode>>();
Map<Integer, PodcastChannel> channelMap = new HashMap<Integer, PodcastChannel>();
Map<PodcastChannel, List<PodcastEpisode>> channels = new LinkedHashMap<>();
Map<Integer, PodcastChannel> channelMap = new HashMap<>();
for (PodcastChannel channel : podcastService.getAllChannels()) {
channels.put(channel, podcastService.getEpisodes(channel.getId()));
channelMap.put(channel.getId(), channel);
@ -68,15 +74,6 @@ public class PodcastChannelsController extends ParameterizableViewController {
return result;
}
public void setPodcastService(PodcastService podcastService) {
this.podcastService = podcastService;
}
public void setSecurityService(SecurityService securityService) {
this.securityService = securityService;
}
public void setSettingsService(SettingsService settingsService) {
this.settingsService = settingsService;
}
}

@ -15,12 +15,6 @@
<mvc:annotation-driven />
<context:component-scan base-package="org.libresonic.player.controller, org.libresonic.player.validator"/>
<bean id="podcastChannelsController" class="org.libresonic.player.controller.PodcastChannelsController">
<property name="viewName" value="podcastChannels"/>
<property name="podcastService" ref="podcastService"/>
<property name="securityService" ref="securityService"/>
<property name="settingsService" ref="settingsService"/>
</bean>
<bean id="podcastChannelController" class="org.libresonic.player.controller.PodcastChannelController">
<property name="viewName" value="podcastChannel"/>
<property name="podcastService" ref="podcastService"/>
@ -227,7 +221,6 @@
<prop key="/download.view">downloadController</prop>
<prop key="/db.view">dbController</prop>
<prop key="/test.view">multiController</prop>
<prop key="/podcastChannels.view">podcastChannelsController</prop>
<prop key="/podcastChannel.view">podcastChannelController</prop>
<prop key="/podcastReceiverAdmin.view">podcastReceiverAdminController</prop>
<prop key="/podcast/**">podcastController</prop>

Loading…
Cancel
Save