// Path: nakadi-producer/src/main/java/org/zalando/nakadiproducer/flowid/FlowIdComponent.java
// public interface FlowIdComponent {
//     String getXFlowIdValue();
// 
//     void startTraceIfNoneExists();
// }
// 
// Path: nakadi-producer/src/main/java/org/zalando/nakadiproducer/eventlog/EventLogWriter.java
// public interface EventLogWriter {
// 
//     /**
//      * Fires a data change event about a <b>creation</b> of some resource
//      * (object).
//      *
//      * @param eventType
//      *            the Nakadi event type of the event. This is roughly equivalent
//      *            to an event channel or topic.
//      *
//      * @param dataType
//      *            the content of the {@code data_type} field of the Nakadi
//      *            event.
//      *
//      * @param data
//      *            some POJO that can be serialized into JSON (required
//      *            parameter). This is meant to be a representation of the
//      *            resource which was created. It will be used as content of the
//      *            {@code data} field of the Nakadi event.
//      */
//     @Transactional
//     void fireCreateEvent(String eventType, String dataType, Object data);
// 
//     /**
//      * Fires a data change event about an update of some resource (object).
//      *
//      * @param eventType
//      *            the Nakadi event type of the event. This is roughly equivalent
//      *            to an event channel or topic.
//      *
//      * @param dataType
//      *            the content of the {@code data_type} field of the Nakadi
//      *            event.
//      *
//      * @param data
//      *            some POJO that can be serialized into JSON (required
//      *            parameter). This is meant to be a representation of the new
//      *            state of the resource which was updated. It will be used as
//      *            content of the {@code data} field of the Nakadi event.
//      */
//     @Transactional
//     void fireUpdateEvent(String eventType, String dataType, Object data);
// 
//     /**
//      * Fires a data change event about the deletion of some resource (object).
//      *
//      * @param eventType
//      *            the Nakadi event type of the event. This is roughly equivalent
//      *            to an event channel or topic.
//      *
//      * @param dataType
//      *            the content of the {@code data_type} field of the Nakadi
//      *            event.
//      *
//      * @param data
//      *            some POJO that can be serialized into JSON (required
//      *            parameter). This is meant to be a representation of the last
//      *            state (before the deletion) of the resource which was deleted.
//      *            It will be used as content of the {@code data} field of the
//      *            Nakadi event.
//      */
//     @Transactional
//     void fireDeleteEvent(String eventType, String dataType, Object data);
// 
//     /**
//      * Fires a data change event with a snapshot of some resource (object).
//      * <p>
//      * This notifies your consumers about the current state of a resource, even
//      * if nothing changed. Typical use cases include initial replication to new
//      * consumers or hotfixes of data inconsistencies between producer and
//      * consumer.
//      * </p>
//      * <p>
//      * Normally applications don't have to call this themselves, instead they
//      * should implement the
//      * {@link SnapshotEventGenerator}
//      * interface to add support for snapshot creation via the actuator endpoint.
//      * </p>
//      *
//      * @param eventType
//      *            the Nakadi event type of the event. This is roughly equivalent
//      *            to an event channel or topic.
//      *
//      * @param dataType
//      *            the content of the {@code data_type} field of the Nakadi
//      *            event.
//      *
//      * @param data
//      *            some POJO that can be serialized into JSON (required
//      *            parameter). This is meant to be a representation of the
//      *            current state of the resource. It will be used as content of
//      *            the {@code data} field of the Nakadi event.
//      */
//     @Transactional
//     void fireSnapshotEvent(String eventType, String dataType, Object data);
// 
//     /**
//      * Fires a business event, i.e. an event communicating the fact that some
//      * business process step happened. The payload object will be used as the
//      * main event content (just metadata will be added). Same as for data change
//      * events, you should call this method in the same transaction as you are
//      * storing related changes into your database.
//      *
//      * @param eventType
//      *            the Nakadi event type of the event. This is roughly equivalent
//      *            to an event channel or topic.
//      *
//      * @param payload
//      *            some POJO that can be serialized into JSON (required
//      *            parameter)
//      */
//     @Transactional
//     void fireBusinessEvent(String eventType, Object payload);
// }


import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.CREATE;
import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.DELETE;
import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.SNAPSHOT;
import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.UPDATE;
import org.zalando.nakadiproducer.flowid.FlowIdComponent;
import org.zalando.nakadiproducer.eventlog.EventLogWriter;
import javax.transaction.Transactional;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
package org.zalando.nakadiproducer.eventlog.impl;





public class EventLogWriterImpl implements EventLogWriter {

    private final EventLogRepository eventLogRepository;

    private final ObjectMapper objectMapper;
// Path: nakadi-producer/src/main/java/org/zalando/nakadiproducer/flowid/FlowIdComponent.java
// public interface FlowIdComponent {
//     String getXFlowIdValue();
// 
//     void startTraceIfNoneExists();
// }
// 
// Path: nakadi-producer/src/main/java/org/zalando/nakadiproducer/eventlog/EventLogWriter.java
// public interface EventLogWriter {
// 
//     /**
//      * Fires a data change event about a <b>creation</b> of some resource
//      * (object).
//      *
//      * @param eventType
//      *            the Nakadi event type of the event. This is roughly equivalent
//      *            to an event channel or topic.
//      *
//      * @param dataType
//      *            the content of the {@code data_type} field of the Nakadi
//      *            event.
//      *
//      * @param data
//      *            some POJO that can be serialized into JSON (required
//      *            parameter). This is meant to be a representation of the
//      *            resource which was created. It will be used as content of the
//      *            {@code data} field of the Nakadi event.
//      */
//     @Transactional
//     void fireCreateEvent(String eventType, String dataType, Object data);
// 
//     /**
//      * Fires a data change event about an update of some resource (object).
//      *
//      * @param eventType
//      *            the Nakadi event type of the event. This is roughly equivalent
//      *            to an event channel or topic.
//      *
//      * @param dataType
//      *            the content of the {@code data_type} field of the Nakadi
//      *            event.
//      *
//      * @param data
//      *            some POJO that can be serialized into JSON (required
//      *            parameter). This is meant to be a representation of the new
//      *            state of the resource which was updated. It will be used as
//      *            content of the {@code data} field of the Nakadi event.
//      */
//     @Transactional
//     void fireUpdateEvent(String eventType, String dataType, Object data);
// 
//     /**
//      * Fires a data change event about the deletion of some resource (object).
//      *
//      * @param eventType
//      *            the Nakadi event type of the event. This is roughly equivalent
//      *            to an event channel or topic.
//      *
//      * @param dataType
//      *            the content of the {@code data_type} field of the Nakadi
//      *            event.
//      *
//      * @param data
//      *            some POJO that can be serialized into JSON (required
//      *            parameter). This is meant to be a representation of the last
//      *            state (before the deletion) of the resource which was deleted.
//      *            It will be used as content of the {@code data} field of the
//      *            Nakadi event.
//      */
//     @Transactional
//     void fireDeleteEvent(String eventType, String dataType, Object data);
// 
//     /**
//      * Fires a data change event with a snapshot of some resource (object).
//      * <p>
//      * This notifies your consumers about the current state of a resource, even
//      * if nothing changed. Typical use cases include initial replication to new
//      * consumers or hotfixes of data inconsistencies between producer and
//      * consumer.
//      * </p>
//      * <p>
//      * Normally applications don't have to call this themselves, instead they
//      * should implement the
//      * {@link SnapshotEventGenerator}
//      * interface to add support for snapshot creation via the actuator endpoint.
//      * </p>
//      *
//      * @param eventType
//      *            the Nakadi event type of the event. This is roughly equivalent
//      *            to an event channel or topic.
//      *
//      * @param dataType
//      *            the content of the {@code data_type} field of the Nakadi
//      *            event.
//      *
//      * @param data
//      *            some POJO that can be serialized into JSON (required
//      *            parameter). This is meant to be a representation of the
//      *            current state of the resource. It will be used as content of
//      *            the {@code data} field of the Nakadi event.
//      */
//     @Transactional
//     void fireSnapshotEvent(String eventType, String dataType, Object data);
// 
//     /**
//      * Fires a business event, i.e. an event communicating the fact that some
//      * business process step happened. The payload object will be used as the
//      * main event content (just metadata will be added). Same as for data change
//      * events, you should call this method in the same transaction as you are
//      * storing related changes into your database.
//      *
//      * @param eventType
//      *            the Nakadi event type of the event. This is roughly equivalent
//      *            to an event channel or topic.
//      *
//      * @param payload
//      *            some POJO that can be serialized into JSON (required
//      *            parameter)
//      */
//     @Transactional
//     void fireBusinessEvent(String eventType, Object payload);
// }


// Path: nakadi-producer/src/main/java/org/zalando/nakadiproducer/eventlog/impl/EventLogWriterImpl.java
import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.CREATE;
import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.DELETE;
import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.SNAPSHOT;
import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.UPDATE;
import org.zalando.nakadiproducer.flowid.FlowIdComponent;
import org.zalando.nakadiproducer.eventlog.EventLogWriter;
import javax.transaction.Transactional;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

package org.zalando.nakadiproducer.eventlog.impl;





public class EventLogWriterImpl implements EventLogWriter {

    private final EventLogRepository eventLogRepository;

    private final ObjectMapper objectMapper;
    private final FlowIdComponent flowIdComponent;