Search in sources :

Example 6 with Exception

use of datawave.marking.MarkingFunctions.Exception in project datawave by NationalSecurityAgency.

the class ContentQueryTransformer method transform.

@Override
public DefaultEvent transform(Entry<Key, Value> entry) {
    if (entry.getKey() == null && entry.getValue() == null)
        return null;
    if (null == entry.getKey() || null == entry.getValue()) {
        throw new IllegalArgumentException("Null key or value. Key:" + entry.getKey() + ", Value: " + entry.getValue());
    }
    ContentKeyValue ckv;
    try {
        ckv = ContentKeyValueFactory.parse(entry.getKey(), entry.getValue(), auths, markingFunctions);
    } catch (Exception e1) {
        throw new IllegalArgumentException("Unable to parse visibility", e1);
    }
    DefaultEvent e = new DefaultEvent();
    DefaultField field = new DefaultField();
    e.setMarkings(ckv.getMarkings());
    Metadata m = new Metadata();
    m.setRow(ckv.getShardId());
    m.setDataType(ckv.getDatatype());
    m.setInternalId(ckv.getUid());
    e.setMetadata(m);
    field.setMarkings(ckv.getMarkings());
    field.setName(ckv.getViewName());
    field.setTimestamp(entry.getKey().getTimestamp());
    field.setValue(ckv.getContents());
    List<DefaultField> fields = new ArrayList<>();
    fields.add(field);
    e.setFields(fields);
    return e;
}
Also used : DefaultEvent(datawave.webservice.query.result.event.DefaultEvent) ContentKeyValue(datawave.query.table.parser.ContentKeyValueFactory.ContentKeyValue) Metadata(datawave.webservice.query.result.event.Metadata) ArrayList(java.util.ArrayList) DefaultField(datawave.webservice.query.result.event.DefaultField) Exception(datawave.marking.MarkingFunctions.Exception)

Aggregations

Exception (datawave.marking.MarkingFunctions.Exception)6 Metadata (datawave.webservice.query.result.event.Metadata)5 ColumnVisibility (org.apache.accumulo.core.security.ColumnVisibility)5 EventBase (datawave.webservice.query.result.event.EventBase)4 FieldBase (datawave.webservice.query.result.event.FieldBase)4 ArrayList (java.util.ArrayList)4 QueryException (datawave.webservice.query.exception.QueryException)3 Key (org.apache.accumulo.core.data.Key)2 Value (org.apache.accumulo.core.data.Value)2 Input (com.esotericsoftware.kryo.io.Input)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 Uid (datawave.ingest.protobuf.Uid)1 EventFields (datawave.query.parser.EventFields)1 FieldValue (datawave.query.parser.EventFields.FieldValue)1 ContentKeyValue (datawave.query.table.parser.ContentKeyValueFactory.ContentKeyValue)1 DefaultEvent (datawave.webservice.query.result.event.DefaultEvent)1 DefaultField (datawave.webservice.query.result.event.DefaultField)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1