blob: 12f3bc2aa158f7e60b5b1bfc0a48659f43758614 [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;
margaretha96c309d2023-08-16 12:24:12 +020011import de.ids_mannheim.korap.web.utils.ResourceFilters;
12import jakarta.ws.rs.GET;
13import jakarta.ws.rs.Path;
14import jakarta.ws.rs.Produces;
15import jakarta.ws.rs.core.MediaType;
margaretha38d530e2017-07-11 19:06:50 +020016
17/**
18 * Provides information about free resources.
19 *
20 * @author margaretha
21 *
22 */
margarethae353dfa2017-07-18 19:23:29 +020023@Controller
margarethad9546d32019-12-20 12:19:17 +010024@Path("{version}/resource")
margarethaf4df2c02024-01-09 09:13:17 +010025@ResourceFilters({ APIVersionFilter.class})
margaretha38d530e2017-07-11 19:06:50 +020026@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
margarethad3c0fc92017-10-25 15:03:32 +020027public class ResourceController {
margarethae353dfa2017-07-18 19:23:29 +020028
margaretha543f2002017-07-14 00:27:15 +020029 @Autowired
margarethad3c0fc92017-10-25 15:03:32 +020030 private ResourceService resourceService;
margarethaa14f1c22017-07-19 18:51:04 +020031
margaretha35e1ca22023-11-16 22:00:01 +010032 /**
33 * Returns descriptions of all free resources stored in
margaretha54134902017-09-27 18:43:11 +020034 * the database.
35 *
margaretha35e1ca22023-11-16 22:00:01 +010036 * @return a json description of all free resources stored in
37 * the database.
margaretha54134902017-09-27 18:43:11 +020038 */
margaretha38d530e2017-07-11 19:06:50 +020039 @GET
margaretha0e8f4e72018-04-05 14:11:52 +020040 public List<ResourceDto> getAllResourceInfo () {
41 return resourceService.getResourceDtos();
margaretha38d530e2017-07-11 19:06:50 +020042 }
margaretha38d530e2017-07-11 19:06:50 +020043}