32
32
import org .springframework .web .servlet .view .RedirectView ;
33
33
import ru .mystamps .web .common .LinkEntityDto ;
34
34
import ru .mystamps .web .common .LocaleUtils ;
35
- import ru .mystamps .web .feature .series .SeriesInfoDto ;
36
- import ru .mystamps .web .feature .series .SeriesService ;
35
+ import ru .mystamps .web .feature .series .SeriesUrl ;
37
36
import ru .mystamps .web .support .spring .mvc .ReplaceRepeatingSpacesEditor ;
38
37
import ru .mystamps .web .support .spring .security .CurrentUser ;
39
38
50
49
public class CountryController {
51
50
52
51
private final CountryService countryService ;
53
- private final SeriesService seriesService ;
54
52
55
53
@ InitBinder ("addCountryForm" )
56
54
protected void initBinder (WebDataBinder binder ) {
@@ -81,35 +79,7 @@ public String processInput(
81
79
82
80
redirectAttributes .addFlashAttribute ("justAddedCountry" , true );
83
81
84
- return redirectTo (CountryUrl .INFO_COUNTRY_PAGE , slug );
85
- }
86
-
87
- // CheckStyle: ignore LineLength for next 1 line
88
- // @todo #927 CountryController: remove dependency on SeriesService by moving showInfoBySlug() method
89
- @ GetMapping (CountryUrl .INFO_COUNTRY_PAGE )
90
- public String showInfoBySlug (
91
- @ Country @ PathVariable ("slug" ) LinkEntityDto country ,
92
- Model model ,
93
- Locale userLocale ,
94
- HttpServletResponse response )
95
- throws IOException {
96
-
97
- if (country == null ) {
98
- response .sendError (HttpServletResponse .SC_NOT_FOUND );
99
- return null ;
100
- }
101
-
102
- String slug = country .getSlug ();
103
- String name = country .getName ();
104
-
105
- String lang = LocaleUtils .getLanguageOrNull (userLocale );
106
- List <SeriesInfoDto > series = seriesService .findByCountrySlug (slug , lang );
107
-
108
- model .addAttribute ("countrySlug" , slug );
109
- model .addAttribute ("countryName" , name );
110
- model .addAttribute ("seriesOfCountry" , series );
111
-
112
- return "country/info" ;
82
+ return redirectTo (SeriesUrl .INFO_COUNTRY_PAGE , slug );
113
83
}
114
84
115
85
/**
@@ -128,7 +98,7 @@ public View showInfoById(
128
98
129
99
RedirectView view = new RedirectView ();
130
100
view .setStatusCode (HttpStatus .MOVED_PERMANENTLY );
131
- view .setUrl (CountryUrl .INFO_COUNTRY_PAGE );
101
+ view .setUrl (SeriesUrl .INFO_COUNTRY_PAGE );
132
102
133
103
return view ;
134
104
}
0 commit comments