use of datawave.webservice.query.result.event.EventBase in project datawave by NationalSecurityAgency.
the class ParentDocumentTransformer method transform.
@Override
public EventBase transform(Entry<Key, Value> input) {
EventBase event = super.transform(input);
Metadata md = event.getMetadata();
byte[] id = md.getInternalId().getBytes();
ByteSequence parentIdBytes = TLD.parseParentPointerFromId(new ArrayByteSequence(id));
String parentId = new String(parentIdBytes.getBackingArray(), parentIdBytes.offset(), parentIdBytes.length());
md.setInternalId(parentId);
return event;
}
use of datawave.webservice.query.result.event.EventBase in project datawave by NationalSecurityAgency.
the class ShardIndexQueryTransformer 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(this.variableFieldList);
response.setEvents(eventList);
response.setReturnedEvents((long) eventList.size());
return response;
}
use of datawave.webservice.query.result.event.EventBase in project datawave by NationalSecurityAgency.
the class ShardQueryCountTableTransformer method writeToCache.
@Override
public List<CacheableQueryRow> writeToCache(Object o) throws QueryException {
List<CacheableQueryRow> cqoList = new ArrayList<>();
EventBase event = (EventBase) o;
CacheableQueryRowImpl cqo = new CacheableQueryRowImpl();
Metadata metadata = event.getMetadata();
cqo.setColFam(metadata.getDataType() + ":" + cqo.getEventId());
cqo.setDataType(metadata.getDataType());
cqo.setEventId(metadata.getInternalId());
cqo.setRow(metadata.getRow());
List<FieldBase> fields = event.getFields();
for (FieldBase f : fields) {
cqo.addColumn(f.getName(), f.getTypedValue(), f.getMarkings(), f.getColumnVisibility(), f.getTimestamp());
}
// set the size in bytes using the initial event size as an approximation
cqo.setSizeInBytes(event.getSizeInBytes());
cqoList.add(cqo);
return cqoList;
}
use of datawave.webservice.query.result.event.EventBase in project datawave by NationalSecurityAgency.
the class ShardQueryCountTableTransformer 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 response;
}
use of datawave.webservice.query.result.event.EventBase in project datawave by NationalSecurityAgency.
the class ShardQueryCountTableTransformer method readFromCache.
@Override
public List<Object> readFromCache(List<CacheableQueryRow> cacheableQueryRowList) {
List<Object> eventList = new ArrayList<>();
for (CacheableQueryRow cqr : cacheableQueryRowList) {
if (this.variableFieldList == null) {
this.variableFieldList = cqr.getVariableColumnNames();
}
Map<String, String> markings = cqr.getMarkings();
String dataType = cqr.getDataType();
String internalId = cqr.getEventId();
String row = cqr.getRow();
EventBase event = responseObjectFactory.getEvent();
event.setMarkings(markings);
Metadata metadata = new Metadata();
metadata.setDataType(dataType);
metadata.setInternalId(internalId);
metadata.setRow(row);
event.setMetadata(metadata);
List<FieldBase> fieldList = new ArrayList<>();
Map<String, String> columnValueMap = cqr.getColumnValues();
for (Map.Entry<String, String> entry : columnValueMap.entrySet()) {
String columnName = entry.getKey();
String columnValue = entry.getValue();
String columnVisibility = cqr.getColumnVisibility(columnName);
Long columnTimestamp = cqr.getColumnTimestamp(columnName);
Map<String, String> columnMarkings = cqr.getColumnMarkings(columnName);
FieldBase field = responseObjectFactory.getField();
field.setName(columnName);
field.setMarkings(columnMarkings);
field.setColumnVisibility(columnVisibility);
field.setTimestamp(columnTimestamp);
field.setValue(columnValue);
fieldList.add(field);
}
event.setFields(fieldList);
eventList.add(event);
}
return eventList;
}
Aggregations