Filter Backends for GLS Archive

This commit is contained in:
Fabian Märki
2017-07-21 16:08:35 +02:00
parent 62ce183651
commit 40aeb65ca9

View File

@ -1,10 +1,11 @@
package ch.psi.daq.queryrest.controller; package ch.psi.daq.queryrest.controller;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -71,6 +72,9 @@ public class QueryRestController {
@Resource @Resource
private ObjectMapper objectMapper; private ObjectMapper objectMapper;
@Resource(name = DomainConfig.BEAN_NAME_BACKENDS_ACTIVE)
private Set<Backend> activeBackends;
private Response defaultResponse = new JSONHTTPResponse(); private Response defaultResponse = new JSONHTTPResponse();
@PostConstruct @PostConstruct
@ -280,10 +284,9 @@ public class QueryRestController {
@RequestMapping(value = PARAMETERS_ROOT_PATH + "/backends", method = {RequestMethod.GET}, @RequestMapping(value = PARAMETERS_ROOT_PATH + "/backends", method = {RequestMethod.GET},
produces = {MediaType.APPLICATION_JSON_VALUE}) produces = {MediaType.APPLICATION_JSON_VALUE})
public @ResponseBody List<Backend> getBackendValues() { public @ResponseBody List<Backend> getBackendValues() {
List<Backend> filtered = new ArrayList<>(Lists.newArrayList(Backend.values())); return Stream.of(Backend.values())
filtered.remove(Backend.SF_DATABUFFER_OLD); .filter(backend -> activeBackends.contains(backend))
return filtered; .collect(Collectors.toList());
// return Lists.newArrayList(Backend.values());
} }
/** /**