Search in sources :

Example 1 with CacheableQueryRowImpl

use of datawave.webservice.query.cachedresults.CacheableQueryRowImpl in project datawave by NationalSecurityAgency.

the class ShardIndexQueryTransformer 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;
}
Also used : EventBase(datawave.webservice.query.result.event.EventBase) ArrayList(java.util.ArrayList) Metadata(datawave.webservice.query.result.event.Metadata) FieldBase(datawave.webservice.query.result.event.FieldBase) CacheableQueryRow(datawave.webservice.query.cachedresults.CacheableQueryRow) CacheableQueryRowImpl(datawave.webservice.query.cachedresults.CacheableQueryRowImpl)

Example 2 with CacheableQueryRowImpl

use of datawave.webservice.query.cachedresults.CacheableQueryRowImpl in project datawave by NationalSecurityAgency.

the class DiscoveryTransformer method writeToCache.

@Override
public List<CacheableQueryRow> writeToCache(Object o) throws QueryException {
    List<CacheableQueryRow> cqoList = new ArrayList<>();
    EventBase event = (EventBase) o;
    CacheableQueryRow 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());
    }
    cqoList.add(cqo);
    return cqoList;
}
Also used : EventBase(datawave.webservice.query.result.event.EventBase) ArrayList(java.util.ArrayList) Metadata(datawave.webservice.query.result.event.Metadata) FieldBase(datawave.webservice.query.result.event.FieldBase) CacheableQueryRow(datawave.webservice.query.cachedresults.CacheableQueryRow) CacheableQueryRowImpl(datawave.webservice.query.cachedresults.CacheableQueryRowImpl)

Example 3 with CacheableQueryRowImpl

use of datawave.webservice.query.cachedresults.CacheableQueryRowImpl in project datawave by NationalSecurityAgency.

the class EdgeQueryTransformerSupport method writeToCache.

@Override
public List<CacheableQueryRow> writeToCache(Object o) throws QueryException {
    List<CacheableQueryRow> cqoList = new ArrayList<>();
    EdgeBase edge = (EdgeBase) o;
    CacheableQueryRow cqo = new CacheableQueryRowImpl();
    cqo.setColFam("");
    cqo.setDataType("");
    cqo.setEventId(generateEventId(edge));
    cqo.setRow("");
    if (edge.getSource() != null) {
        cqo.addColumn(EDGE_SOURCE, edge.getSource(), edge.getMarkings(), "", 0l);
    }
    if (edge.getSink() != null) {
        cqo.addColumn(EDGE_SINK, edge.getSink(), edge.getMarkings(), "", 0l);
    }
    if (edge.getEdgeType() != null) {
        cqo.addColumn(EDGE_TYPE, edge.getEdgeType(), edge.getMarkings(), "", 0l);
    }
    if (edge.getEdgeRelationship() != null) {
        cqo.addColumn(EDGE_RELATIONSHIP, edge.getEdgeRelationship(), edge.getMarkings(), "", 0l);
    }
    if (edge.getEdgeAttribute1Source() != null) {
        cqo.addColumn(EDGE_ATTRIBUTE1, edge.getEdgeAttribute1Source(), edge.getMarkings(), "", 0l);
    }
    if (edge.getStatsType() != null) {
        cqo.addColumn(STATS_EDGE, edge.getStatsType(), edge.getMarkings(), "", 0l);
    }
    if (edge.getEdgeAttribute2() != null) {
        cqo.addColumn(EDGE_ATTRIBUTE2, edge.getEdgeAttribute2(), edge.getMarkings(), "", 0l);
    }
    if (edge.getDate() != null) {
        cqo.addColumn(DATE, edge.getDate(), edge.getMarkings(), "", 0l);
    }
    if (edge.getCount() != null) {
        cqo.addColumn(COUNT, edge.getCount().toString(), edge.getMarkings(), "", 0l);
    }
    if (edge.getEdgeAttribute3() != null) {
        cqo.addColumn(EDGE_ATTRIBUTE3, edge.getEdgeAttribute3(), edge.getMarkings(), "", 0l);
    }
    List<Long> counts = edge.getCounts();
    if (counts != null && !counts.isEmpty()) {
        cqo.addColumn(COUNTS, StringUtils.join(counts, '\0'), edge.getMarkings(), "", 0l);
    }
    if (edge.getLoadDate() != null) {
        cqo.addColumn(LOAD_DATE, edge.getLoadDate(), edge.getMarkings(), "", 0l);
    }
    if (edge.getActivityDate() != null) {
        cqo.addColumn(ACTIVITY_DATE, edge.getActivityDate(), edge.getMarkings(), "", 0l);
    }
    cqoList.add(cqo);
    return cqoList;
}
Also used : ArrayList(java.util.ArrayList) CacheableQueryRow(datawave.webservice.query.cachedresults.CacheableQueryRow) EdgeBase(datawave.webservice.query.result.edge.EdgeBase) CacheableQueryRowImpl(datawave.webservice.query.cachedresults.CacheableQueryRowImpl)

Example 4 with CacheableQueryRowImpl

use of datawave.webservice.query.cachedresults.CacheableQueryRowImpl 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;
}
Also used : EventBase(datawave.webservice.query.result.event.EventBase) ArrayList(java.util.ArrayList) Metadata(datawave.webservice.query.result.event.Metadata) FieldBase(datawave.webservice.query.result.event.FieldBase) CacheableQueryRow(datawave.webservice.query.cachedresults.CacheableQueryRow) CacheableQueryRowImpl(datawave.webservice.query.cachedresults.CacheableQueryRowImpl)

Aggregations

CacheableQueryRow (datawave.webservice.query.cachedresults.CacheableQueryRow)4 CacheableQueryRowImpl (datawave.webservice.query.cachedresults.CacheableQueryRowImpl)4 ArrayList (java.util.ArrayList)4 EventBase (datawave.webservice.query.result.event.EventBase)3 FieldBase (datawave.webservice.query.result.event.FieldBase)3 Metadata (datawave.webservice.query.result.event.Metadata)3 EdgeBase (datawave.webservice.query.result.edge.EdgeBase)1