use of datawave.webservice.result.EventQueryResponseBase in project datawave by NationalSecurityAgency.
the class GroupingDocumentTransformer method createGroupedResponse.
protected BaseQueryResponse createGroupedResponse(Multiset<Collection<FieldBase<?>>> multiset) {
Map<String, String> markings = Maps.newHashMap();
EventQueryResponseBase response = this.responseObjectFactory.getEventQueryResponse();
List<EventBase> events = new ArrayList<>();
for (Collection<FieldBase<?>> entry : multiset.elementSet()) {
EventBase event = this.responseObjectFactory.getEvent();
event.setMarkings(markings);
List<FieldBase<?>> fields = new ArrayList(entry);
FieldBase<?> counter = this.responseObjectFactory.getField();
counter.setName("COUNT");
counter.setMarkings(markings);
counter.setValue(multiset.count(entry));
counter.setTimestamp(0L);
fields.add(counter);
event.setFields(fields);
events.add(event);
}
response.setEvents(events);
response.setTotalEvents((long) events.size());
response.setReturnedEvents((long) events.size());
return response;
}
use of datawave.webservice.result.EventQueryResponseBase in project datawave by NationalSecurityAgency.
the class EventQueryTransformerSupport method createResponse.
@Override
public BaseQueryResponse createResponse(List<Object> resultList) {
EventQueryResponseBase response = this.responseObjectFactory.getEventQueryResponse();
List<EventBase> eventList = new ArrayList<>();
Set<String> fieldSet = new TreeSet<>();
for (Object o : resultList) {
EventBase<?, ?> e = (EventBase<?, ?>) o;
for (FieldBase<?> f : e.getFields()) {
fieldSet.add(f.getName());
}
eventList.add(e);
}
response.setFields(Lists.newArrayList(fieldSet));
response.setEvents(eventList);
response.setReturnedEvents((long) eventList.size());
return response;
}
use of datawave.webservice.result.EventQueryResponseBase in project datawave by NationalSecurityAgency.
the class FieldIndexCountQueryTransformer method createResponse.
@Override
public BaseQueryResponse createResponse(List<Object> resultList) {
EventQueryResponseBase response = responseObjectFactory.getEventQueryResponse();
List<EventBase> eventList = new ArrayList<>();
for (Object o : resultList) {
EventBase<?, ?> e = (EventBase<?, ?>) o;
eventList.add(e);
}
response.setFields(variableFieldList);
response.setEvents(eventList);
response.setReturnedEvents((long) eventList.size());
return (BaseQueryResponse) response;
}
use of datawave.webservice.result.EventQueryResponseBase in project datawave by NationalSecurityAgency.
the class DocumentTransformerSupport method createResponse.
@Override
public BaseQueryResponse createResponse(List<Object> resultList) {
EventQueryResponseBase response = this.responseObjectFactory.getEventQueryResponse();
List<EventBase> eventList = Lists.newArrayListWithCapacity(resultList.size());
Set<String> fieldSet = Sets.newTreeSet();
for (Object o : resultList) {
EventBase<?, ?> e = (EventBase<?, ?>) o;
for (FieldBase<?> f : e.getFields()) {
fieldSet.add(f.getName());
}
eventList.add(e);
}
response.setFields(Lists.newArrayList(fieldSet));
response.setEvents(eventList);
response.setReturnedEvents((long) eventList.size());
return response;
}
use of datawave.webservice.result.EventQueryResponseBase in project datawave by NationalSecurityAgency.
the class LookupUUIDUtil method validatePagedResponse.
private EventQueryResponseBase validatePagedResponse(final BaseQueryResponse response) {
final EventQueryResponseBase pagedResponse;
if (response instanceof EventQueryResponseBase) {
pagedResponse = (EventQueryResponseBase) response;
} else {
final EventQueryResponseBase er = responseObjectFactory.getEventQueryResponse();
er.addMessage("Unhandled response type from Query/createQueryAndNext");
throw new PreConditionFailedException(null, er);
}
return pagedResponse;
}
Aggregations