Renaming of as-is.
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package ch.psi.daq.queryrest.response.json;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Stream;
|
||||
@ -14,11 +13,15 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
import com.hazelcast.util.collection.ArrayUtils;
|
||||
|
||||
import ch.psi.daq.domain.FieldNames;
|
||||
import ch.psi.daq.domain.json.ChannelName;
|
||||
import ch.psi.daq.domain.query.DAQQueries;
|
||||
import ch.psi.daq.domain.query.DAQQueryElement;
|
||||
import ch.psi.daq.domain.query.backend.BackendQuery;
|
||||
import ch.psi.daq.domain.query.operation.Compression;
|
||||
import ch.psi.daq.domain.query.operation.QueryField;
|
||||
import ch.psi.daq.domain.query.response.ResponseFormat;
|
||||
import ch.psi.daq.queryrest.query.QueryManager;
|
||||
import ch.psi.daq.queryrest.response.AbstractHTTPResponse;
|
||||
@ -43,14 +46,7 @@ public class JSONHTTPResponse extends AbstractHTTPResponse {
|
||||
public void respond(ApplicationContext context, DAQQueries queries, HttpServletResponse response) throws Exception {
|
||||
OutputStream out = handleCompressionAndResponseHeaders(response, CONTENT_TYPE);
|
||||
|
||||
boolean hasMapping = false;
|
||||
Iterator<DAQQueryElement> iter = queries.getQueries().iterator();
|
||||
while (!hasMapping && iter.hasNext()) {
|
||||
DAQQueryElement daqQueryElement = iter.next();
|
||||
if (daqQueryElement.getMapping() != null) {
|
||||
hasMapping = true;
|
||||
}
|
||||
}
|
||||
boolean hasMapping = validateQueries(queries);
|
||||
|
||||
try {
|
||||
LOGGER.debug("Executing query '{}'", queries);
|
||||
@ -74,4 +70,20 @@ public class JSONHTTPResponse extends AbstractHTTPResponse {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected boolean validateQueries(DAQQueries queries) {
|
||||
boolean hasMapping = false;
|
||||
|
||||
for (DAQQueryElement query : queries) {
|
||||
if (query.getMapping() != null) {
|
||||
hasMapping = true;
|
||||
|
||||
if (!ArrayUtils.contains(query.getColumns(), FieldNames.FIELD_GLOBAL_TIME)) {
|
||||
query.addField(QueryField.globalMillis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hasMapping;
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class JSONTableResponseStreamWriter implements ResponseStreamWriter {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JSONTableResponseStreamWriter.class);
|
||||
|
||||
public static final Mapping DEFAULT_MAPPING = new Mapping(IncompleteStrategy.KEEP_AS_IS);
|
||||
public static final Mapping DEFAULT_MAPPING = new Mapping(IncompleteStrategy.PROVIDE_AS_IS);
|
||||
private static final long MILLIS_PER_PULSE = TimeUtils.MILLIS_PER_PULSE;
|
||||
private static final Function<DataEvent, ChannelName> KEY_PROVIDER = (event) -> new ChannelName(event.getChannel(),
|
||||
event.getBackend());
|
||||
|
@ -1443,7 +1443,7 @@ public class QueryRestControllerJsonTableTest extends AbstractDaqRestTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPulseRangeQuery_Match_KeepAsIs() throws Exception {
|
||||
public void testPulseRangeQuery_Match_ProvideAsIs() throws Exception {
|
||||
Map<String, Set<Long>> channelSeq = new HashMap<>();
|
||||
Set<Long> channel_01_Seq = new LinkedHashSet<>(Arrays.asList(0L, 2L, 4L, 5L));
|
||||
String channel_01 = "TestChannel_Sequence_" + Arrays.toString(channel_01_Seq.toArray());
|
||||
@ -2128,12 +2128,4 @@ public class QueryRestControllerJsonTableTest extends AbstractDaqRestTest {
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[7]").doesNotExist());
|
||||
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void testIncompleteMapping_01() throws Exception {
|
||||
// asdfadsf
|
||||
//
|
||||
// - several events in same bin
|
||||
// - missing events for bin (incomplete=true/false)
|
||||
// }
|
||||
}
|
||||
|
Reference in New Issue
Block a user