Commit 925dadfe authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

autowiring

parent ce10b588
Pipeline #135153 passed with stages
in 9 minutes and 9 seconds
......@@ -28,26 +28,20 @@ import info.textgrid.rep.shared.ViewMode;
@Controller
public class BrowseController {
// injected service
@Autowired
private TgsearchClientService tgsearchClientService;
@Autowired
private TgrepConfigurationService tgrepConfig;
@Autowired
private AggregatorClientService aggregatorClient;
@Autowired
private I18NProvider i18nProvider;
private static final Log log = LogFactory.getLog(BrowseController.class);
@Autowired
public BrowseController(
TgsearchClientService tgsearchClientService,
AggregatorClientService aggregatorClient,
TgrepConfigurationService tgrepConfig,
I18NProvider i18nProvider) {
this.tgsearchClientService = tgsearchClientService;
this.aggregatorClient = aggregatorClient;
this.tgrepConfig = tgrepConfig;
this.i18nProvider = i18nProvider;
}
@GetMapping("/browse/{id}")
public String browse(
Locale locale,
......@@ -58,7 +52,6 @@ public class BrowseController {
I18N i18n = i18nProvider.getI18N(locale);
// common variables for browse-root aggregations and browse single items
model.addAttribute("handleHost", this.tgrepConfig.getHandleHost());
model.addAttribute("textgridHost", this.tgrepConfig.getTextgridHost());
......@@ -66,7 +59,6 @@ public class BrowseController {
model.addAttribute("i18n", i18n.getTranslationMap());
model.addAttribute("language", i18n.getLanguage());
// if no id, browse all root aggregations
if (id == null || id.equals("root")) {
List<ViewMode> viewmodes = new ArrayList<ViewMode>();
......
......@@ -16,23 +16,17 @@ import info.textgrid.rep.i18n.I18N;
import info.textgrid.rep.i18n.I18NProvider;
import info.textgrid.rep.service.tgsearch.TgsearchClientService;
@Controller
public class BrowseFacetController {
@Autowired
private TgsearchClientService tgsearchClientService;
@Autowired
private I18NProvider i18nProvider;
private static final Log log = LogFactory.getLog(BrowseFacetController.class);
@Autowired
public BrowseFacetController(
TgsearchClientService tgsearchClientService, I18NProvider i18nProvider) {
this.tgsearchClientService = tgsearchClientService;
this.i18nProvider = i18nProvider;
}
@GetMapping("/facet/{facet}")
public String render(
Locale locale,
......
......@@ -26,22 +26,17 @@ import info.textgrid.rep.shared.ViewMode;
@Controller
public class SearchController {
@Autowired
private TgsearchClientService tgsearchClientService;
@Autowired
private TgrepConfigurationService tgrepConfig;
@Autowired
private I18NProvider i18nProvider;
private static final Logger logger = LoggerFactory.getLogger(SearchController.class);
@Autowired
public SearchController(
TgsearchClientService tgsearchClientService,
TgrepConfigurationService tgrepConfig,
I18NProvider i18nProvider) {
this.tgsearchClientService = tgsearchClientService;
this.tgrepConfig = tgrepConfig;
this.i18nProvider = i18nProvider;
}
/**
* without this method the filter param passed to search could be separated at
* a comma, for example "filter:Tucholsky, Kurt" would become
......
......@@ -9,7 +9,6 @@ public class Pager {
private Integer[] pages;
public void calculatePages() {
// Set currentPage, totalPages and pages.
currentPage = (hits / limit) - ((hits - start) / limit) + 1;
totalPages = (hits / limit) + ((hits % limit != 0) ? 1 : 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment