Search in sources :

Example 1 with IdPreservedStreamlineEvent

use of com.hortonworks.streamline.streams.common.IdPreservedStreamlineEvent in project streamline by hortonworks.

the class StreamlineEventMapper method entity.

@Override
public StreamlineEvent entity(Result result) {
    String id = Bytes.toString(result.getRow());
    Map<String, Object> fieldsAndValues = new HashMap<>();
    for (Map.Entry<byte[], byte[]> entry : result.getFamilyMap(CF_FIELDS).entrySet()) {
        fieldsAndValues.put(Bytes.toString(entry.getKey()), Bytes.toString(entry.getValue()));
    }
    String dataSourceId = Bytes.toString(result.getFamilyMap(CF_DATASOURCE_ID).firstEntry().getKey());
    StreamlineEventImpl event = StreamlineEventImpl.builder().fieldsAndValues(fieldsAndValues).dataSourceId(dataSourceId).build();
    return new IdPreservedStreamlineEvent(event, id);
}
Also used : HashMap(java.util.HashMap) IdPreservedStreamlineEvent(com.hortonworks.streamline.streams.common.IdPreservedStreamlineEvent) StreamlineEventImpl(com.hortonworks.streamline.streams.common.StreamlineEventImpl) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

IdPreservedStreamlineEvent (com.hortonworks.streamline.streams.common.IdPreservedStreamlineEvent)1 StreamlineEventImpl (com.hortonworks.streamline.streams.common.StreamlineEventImpl)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1