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