blob: 074b14b2a923f43623e2365be2d6603646bedf4e [file] [log] [blame]
margarethad3c0fc92017-10-25 15:03:32 +02001package de.ids_mannheim.korap.web.controller;
margaretha38d530e2017-07-11 19:06:50 +02002
margaretha0e8f4e72018-04-05 14:11:52 +02003import java.util.List;
4
margaretha543f2002017-07-14 00:27:15 +02005import org.springframework.beans.factory.annotation.Autowired;
margarethae353dfa2017-07-18 19:23:29 +02006import org.springframework.stereotype.Controller;
margaretha38d530e2017-07-11 19:06:50 +02007
margaretha0e8f4e72018-04-05 14:11:52 +02008import de.ids_mannheim.korap.dto.ResourceDto;
margarethad3c0fc92017-10-25 15:03:32 +02009import de.ids_mannheim.korap.service.ResourceService;
margaretha398f4722019-01-09 19:07:20 +010010import de.ids_mannheim.korap.web.filter.APIVersionFilter;
margaretha38d530e2017-07-11 19:06:50 +020011import de.ids_mannheim.korap.web.filter.PiwikFilter;
margaretha96c309d2023-08-16 12:24:12 +020012import de.ids_mannheim.korap.web.utils.ResourceFilters;
13import jakarta.ws.rs.GET;
14import jakarta.ws.rs.Path;
15import jakarta.ws.rs.Produces;
16import jakarta.ws.rs.core.MediaType;
margaretha38d530e2017-07-11 19:06:50 +020017
18/**
19 * Provides information about free resources.
20 *
21 * @author margaretha
22 *
23 */
margarethae353dfa2017-07-18 19:23:29 +020024@Controller
margarethad9546d32019-12-20 12:19:17 +010025@Path("{version}/resource")
margarethaee0cbfe2018-08-28 17:47:14 +020026@ResourceFilters({APIVersionFilter.class, PiwikFilter.class })
margaretha38d530e2017-07-11 19:06:50 +020027@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
margarethad3c0fc92017-10-25 15:03:32 +020028public class ResourceController {
margarethae353dfa2017-07-18 19:23:29 +020029
margaretha543f2002017-07-14 00:27:15 +020030 @Autowired
margarethad3c0fc92017-10-25 15:03:32 +020031 private ResourceService resourceService;
margarethaa14f1c22017-07-19 18:51:04 +020032
margarethae353dfa2017-07-18 19:23:29 +020033
margaretha54134902017-09-27 18:43:11 +020034 /** Returns descriptions of all free resources stored in
35 * the database.
36 *
37 * @return a json description of all free resources stored in
38 * the database.
39 */
margaretha38d530e2017-07-11 19:06:50 +020040 @GET
margaretha0e8f4e72018-04-05 14:11:52 +020041 public List<ResourceDto> getAllResourceInfo () {
42 return resourceService.getResourceDtos();
margaretha38d530e2017-07-11 19:06:50 +020043 }
margaretha38d530e2017-07-11 19:06:50 +020044}