All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.baasflow.commons.events.Event Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version
/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package com.baasflow.commons.events;

import org.apache.avro.generic.GenericArray;
import org.apache.avro.specific.SpecificData;
import org.apache.avro.util.Utf8;
import org.apache.avro.message.BinaryMessageEncoder;
import org.apache.avro.message.BinaryMessageDecoder;
import org.apache.avro.message.SchemaStore;

/** Licensed to BaaSFlow Corporation "BaaSFlow" under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership.  BaaSFlow licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this  file except in compliance with the License. You may obtain a copy of the License at  http://www.baasFlow.com/licenses/Apache_LICENSE-2.0  or the root of this project.  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */
@org.apache.avro.specific.AvroGenerated
public class Event extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = 4043061742735172560L;


  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Event\",\"namespace\":\"com.baasflow.commons.events\",\"doc\":\"Licensed to BaaSFlow Corporation \\\"BaaSFlow\\\" under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership.  BaaSFlow licenses this file to you under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use this  file except in compliance with the License. You may obtain a copy of the License at  http://www.baasFlow.com/licenses/Apache_LICENSE-2.0  or the root of this project.  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"logicalType\":\"uuid\"},\"doc\":\"The unique ID of the event.\"},{\"name\":\"eventTimestamp\",\"type\":[\"null\",{\"type\":\"long\",\"logicalType\":\"timestamp-micros\"}],\"doc\":\"The timestamp of the event, showing when the event happened. Not related to the event ingestion time.\",\"default\":null},{\"name\":\"eventType\",\"type\":[\"null\",{\"type\":\"enum\",\"name\":\"EventType\",\"symbols\":[\"audit\",\"business\",\"technical\",\"unspecified\"]}],\"doc\":\"The type of the event. Possible values: audit, business, technical, unspecified.\",\"default\":null},{\"name\":\"sourceModule\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"The module that sends the event. Example values: c360, order_manager.\",\"default\":null},{\"name\":\"event\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"The event that happened. For REST API events set it to operationId from the OpenAPI specification. For other events set to sensible values.\",\"default\":null},{\"name\":\"eventLogLevel\",\"type\":[\"null\",{\"type\":\"enum\",\"name\":\"EventLogLevel\",\"symbols\":[\"TRACE\",\"DEBUG\",\"INFO\",\"WARN\",\"ERROR\"]}],\"doc\":\"The log level of the event. Possible values: TRACE, DEBUG, INFO, WARN, ERROR. For audit event, always set to INFO.\",\"default\":null},{\"name\":\"eventStatus\",\"type\":[\"null\",{\"type\":\"enum\",\"name\":\"EventStatus\",\"symbols\":[\"unknown\",\"in_progress\",\"success\",\"failure\"]}],\"doc\":\"The status of the event. For REST API events set it to success if the HTTP response code is 2xx and to failure otherwise.\",\"default\":null},{\"name\":\"correlationIds\",\"type\":[\"null\",{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}],\"doc\":\"Any IDs that relate to the event. The keys store the name of the ID, the value is the value of the ID. Example keys: paymentId, UETR, transactionId, internalCorrelationId, transactionGroupId, endToEndId\",\"default\":null},{\"name\":\"payload\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"Any other important information that relate to the event. For the audit log it should mostly remain empty.\",\"default\":null},{\"name\":\"payloadType\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"Type of the payload\",\"default\":null},{\"name\":\"tenantId\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"The ID of the tenant that the event belongs to.\",\"default\":null}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }

  private static final SpecificData MODEL$ = new SpecificData();
  static {
    MODEL$.addLogicalTypeConversion(new org.apache.avro.Conversions.UUIDConversion());
    MODEL$.addLogicalTypeConversion(new org.apache.avro.data.TimeConversions.TimestampMicrosConversion());
  }

  private static final BinaryMessageEncoder ENCODER =
      new BinaryMessageEncoder<>(MODEL$, SCHEMA$);

  private static final BinaryMessageDecoder DECODER =
      new BinaryMessageDecoder<>(MODEL$, SCHEMA$);

  /**
   * Return the BinaryMessageEncoder instance used by this class.
   * @return the message encoder used by this class
   */
  public static BinaryMessageEncoder getEncoder() {
    return ENCODER;
  }

  /**
   * Return the BinaryMessageDecoder instance used by this class.
   * @return the message decoder used by this class
   */
  public static BinaryMessageDecoder getDecoder() {
    return DECODER;
  }

  /**
   * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}.
   * @param resolver a {@link SchemaStore} used to find schemas by fingerprint
   * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore
   */
  public static BinaryMessageDecoder createDecoder(SchemaStore resolver) {
    return new BinaryMessageDecoder<>(MODEL$, SCHEMA$, resolver);
  }

  /**
   * Serializes this Event to a ByteBuffer.
   * @return a buffer holding the serialized data for this instance
   * @throws java.io.IOException if this instance could not be serialized
   */
  public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
    return ENCODER.encode(this);
  }

  /**
   * Deserializes a Event from a ByteBuffer.
   * @param b a byte buffer holding serialized data for an instance of this class
   * @return a Event instance decoded from the given buffer
   * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class
   */
  public static Event fromByteBuffer(
      java.nio.ByteBuffer b) throws java.io.IOException {
    return DECODER.decode(b);
  }

  /** The unique ID of the event. */
  private java.util.UUID id;
  /** The timestamp of the event, showing when the event happened. Not related to the event ingestion time. */
  private java.time.Instant eventTimestamp;
  /** The type of the event. Possible values: audit, business, technical, unspecified. */
  private com.baasflow.commons.events.EventType eventType;
  /** The module that sends the event. Example values: c360, order_manager. */
  private java.lang.String sourceModule;
  /** The event that happened. For REST API events set it to operationId from the OpenAPI specification. For other events set to sensible values. */
  private java.lang.String event;
  /** The log level of the event. Possible values: TRACE, DEBUG, INFO, WARN, ERROR. For audit event, always set to INFO. */
  private com.baasflow.commons.events.EventLogLevel eventLogLevel;
  /** The status of the event. For REST API events set it to success if the HTTP response code is 2xx and to failure otherwise. */
  private com.baasflow.commons.events.EventStatus eventStatus;
  /** Any IDs that relate to the event. The keys store the name of the ID, the value is the value of the ID. Example keys: paymentId, UETR, transactionId, internalCorrelationId, transactionGroupId, endToEndId */
  private java.util.Map correlationIds;
  /** Any other important information that relate to the event. For the audit log it should mostly remain empty. */
  private java.lang.String payload;
  /** Type of the payload */
  private java.lang.String payloadType;
  /** The ID of the tenant that the event belongs to. */
  private java.lang.String tenantId;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use newBuilder().
   */
  public Event() {}

  /**
   * All-args constructor.
   * @param id The unique ID of the event.
   * @param eventTimestamp The timestamp of the event, showing when the event happened. Not related to the event ingestion time.
   * @param eventType The type of the event. Possible values: audit, business, technical, unspecified.
   * @param sourceModule The module that sends the event. Example values: c360, order_manager.
   * @param event The event that happened. For REST API events set it to operationId from the OpenAPI specification. For other events set to sensible values.
   * @param eventLogLevel The log level of the event. Possible values: TRACE, DEBUG, INFO, WARN, ERROR. For audit event, always set to INFO.
   * @param eventStatus The status of the event. For REST API events set it to success if the HTTP response code is 2xx and to failure otherwise.
   * @param correlationIds Any IDs that relate to the event. The keys store the name of the ID, the value is the value of the ID. Example keys: paymentId, UETR, transactionId, internalCorrelationId, transactionGroupId, endToEndId
   * @param payload Any other important information that relate to the event. For the audit log it should mostly remain empty.
   * @param payloadType Type of the payload
   * @param tenantId The ID of the tenant that the event belongs to.
   */
  public Event(java.util.UUID id, java.time.Instant eventTimestamp, com.baasflow.commons.events.EventType eventType, java.lang.String sourceModule, java.lang.String event, com.baasflow.commons.events.EventLogLevel eventLogLevel, com.baasflow.commons.events.EventStatus eventStatus, java.util.Map correlationIds, java.lang.String payload, java.lang.String payloadType, java.lang.String tenantId) {
    this.id = id;
    this.eventTimestamp = eventTimestamp;
    this.eventType = eventType;
    this.sourceModule = sourceModule;
    this.event = event;
    this.eventLogLevel = eventLogLevel;
    this.eventStatus = eventStatus;
    this.correlationIds = correlationIds;
    this.payload = payload;
    this.payloadType = payloadType;
    this.tenantId = tenantId;
  }

  @Override
  public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }

  @Override
  public org.apache.avro.Schema getSchema() { return SCHEMA$; }

  // Used by DatumWriter.  Applications should not call.
  @Override
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return id;
    case 1: return eventTimestamp;
    case 2: return eventType;
    case 3: return sourceModule;
    case 4: return event;
    case 5: return eventLogLevel;
    case 6: return eventStatus;
    case 7: return correlationIds;
    case 8: return payload;
    case 9: return payloadType;
    case 10: return tenantId;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

  private static final org.apache.avro.Conversion[] conversions =
      new org.apache.avro.Conversion[] {
      new org.apache.avro.Conversions.UUIDConversion(),
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null,
      null
  };

  @Override
  public org.apache.avro.Conversion getConversion(int field) {
    return conversions[field];
  }

  // Used by DatumReader.  Applications should not call.
  @Override
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: id = (java.util.UUID)value$; break;
    case 1: eventTimestamp = (java.time.Instant)value$; break;
    case 2: eventType = (com.baasflow.commons.events.EventType)value$; break;
    case 3: sourceModule = value$ != null ? value$.toString() : null; break;
    case 4: event = value$ != null ? value$.toString() : null; break;
    case 5: eventLogLevel = (com.baasflow.commons.events.EventLogLevel)value$; break;
    case 6: eventStatus = (com.baasflow.commons.events.EventStatus)value$; break;
    case 7: correlationIds = (java.util.Map)value$; break;
    case 8: payload = value$ != null ? value$.toString() : null; break;
    case 9: payloadType = value$ != null ? value$.toString() : null; break;
    case 10: tenantId = value$ != null ? value$.toString() : null; break;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

  /**
   * Gets the value of the 'id' field.
   * @return The unique ID of the event.
   */
  public java.util.UUID getId() {
    return id;
  }


  /**
   * Sets the value of the 'id' field.
   * The unique ID of the event.
   * @param value the value to set.
   */
  public void setId(java.util.UUID value) {
    this.id = value;
  }

  /**
   * Gets the value of the 'eventTimestamp' field.
   * @return The timestamp of the event, showing when the event happened. Not related to the event ingestion time.
   */
  public java.time.Instant getEventTimestamp() {
    return eventTimestamp;
  }


  /**
   * Sets the value of the 'eventTimestamp' field.
   * The timestamp of the event, showing when the event happened. Not related to the event ingestion time.
   * @param value the value to set.
   */
  public void setEventTimestamp(java.time.Instant value) {
    this.eventTimestamp = value;
  }

  /**
   * Gets the value of the 'eventType' field.
   * @return The type of the event. Possible values: audit, business, technical, unspecified.
   */
  public com.baasflow.commons.events.EventType getEventType() {
    return eventType;
  }


  /**
   * Sets the value of the 'eventType' field.
   * The type of the event. Possible values: audit, business, technical, unspecified.
   * @param value the value to set.
   */
  public void setEventType(com.baasflow.commons.events.EventType value) {
    this.eventType = value;
  }

  /**
   * Gets the value of the 'sourceModule' field.
   * @return The module that sends the event. Example values: c360, order_manager.
   */
  public java.lang.String getSourceModule() {
    return sourceModule;
  }


  /**
   * Sets the value of the 'sourceModule' field.
   * The module that sends the event. Example values: c360, order_manager.
   * @param value the value to set.
   */
  public void setSourceModule(java.lang.String value) {
    this.sourceModule = value;
  }

  /**
   * Gets the value of the 'event' field.
   * @return The event that happened. For REST API events set it to operationId from the OpenAPI specification. For other events set to sensible values.
   */
  public java.lang.String getEvent() {
    return event;
  }


  /**
   * Sets the value of the 'event' field.
   * The event that happened. For REST API events set it to operationId from the OpenAPI specification. For other events set to sensible values.
   * @param value the value to set.
   */
  public void setEvent(java.lang.String value) {
    this.event = value;
  }

  /**
   * Gets the value of the 'eventLogLevel' field.
   * @return The log level of the event. Possible values: TRACE, DEBUG, INFO, WARN, ERROR. For audit event, always set to INFO.
   */
  public com.baasflow.commons.events.EventLogLevel getEventLogLevel() {
    return eventLogLevel;
  }


  /**
   * Sets the value of the 'eventLogLevel' field.
   * The log level of the event. Possible values: TRACE, DEBUG, INFO, WARN, ERROR. For audit event, always set to INFO.
   * @param value the value to set.
   */
  public void setEventLogLevel(com.baasflow.commons.events.EventLogLevel value) {
    this.eventLogLevel = value;
  }

  /**
   * Gets the value of the 'eventStatus' field.
   * @return The status of the event. For REST API events set it to success if the HTTP response code is 2xx and to failure otherwise.
   */
  public com.baasflow.commons.events.EventStatus getEventStatus() {
    return eventStatus;
  }


  /**
   * Sets the value of the 'eventStatus' field.
   * The status of the event. For REST API events set it to success if the HTTP response code is 2xx and to failure otherwise.
   * @param value the value to set.
   */
  public void setEventStatus(com.baasflow.commons.events.EventStatus value) {
    this.eventStatus = value;
  }

  /**
   * Gets the value of the 'correlationIds' field.
   * @return Any IDs that relate to the event. The keys store the name of the ID, the value is the value of the ID. Example keys: paymentId, UETR, transactionId, internalCorrelationId, transactionGroupId, endToEndId
   */
  public java.util.Map getCorrelationIds() {
    return correlationIds;
  }


  /**
   * Sets the value of the 'correlationIds' field.
   * Any IDs that relate to the event. The keys store the name of the ID, the value is the value of the ID. Example keys: paymentId, UETR, transactionId, internalCorrelationId, transactionGroupId, endToEndId
   * @param value the value to set.
   */
  public void setCorrelationIds(java.util.Map value) {
    this.correlationIds = value;
  }

  /**
   * Gets the value of the 'payload' field.
   * @return Any other important information that relate to the event. For the audit log it should mostly remain empty.
   */
  public java.lang.String getPayload() {
    return payload;
  }


  /**
   * Sets the value of the 'payload' field.
   * Any other important information that relate to the event. For the audit log it should mostly remain empty.
   * @param value the value to set.
   */
  public void setPayload(java.lang.String value) {
    this.payload = value;
  }

  /**
   * Gets the value of the 'payloadType' field.
   * @return Type of the payload
   */
  public java.lang.String getPayloadType() {
    return payloadType;
  }


  /**
   * Sets the value of the 'payloadType' field.
   * Type of the payload
   * @param value the value to set.
   */
  public void setPayloadType(java.lang.String value) {
    this.payloadType = value;
  }

  /**
   * Gets the value of the 'tenantId' field.
   * @return The ID of the tenant that the event belongs to.
   */
  public java.lang.String getTenantId() {
    return tenantId;
  }


  /**
   * Sets the value of the 'tenantId' field.
   * The ID of the tenant that the event belongs to.
   * @param value the value to set.
   */
  public void setTenantId(java.lang.String value) {
    this.tenantId = value;
  }

  /**
   * Creates a new Event RecordBuilder.
   * @return A new Event RecordBuilder
   */
  public static com.baasflow.commons.events.Event.Builder newBuilder() {
    return new com.baasflow.commons.events.Event.Builder();
  }

  /**
   * Creates a new Event RecordBuilder by copying an existing Builder.
   * @param other The existing builder to copy.
   * @return A new Event RecordBuilder
   */
  public static com.baasflow.commons.events.Event.Builder newBuilder(com.baasflow.commons.events.Event.Builder other) {
    if (other == null) {
      return new com.baasflow.commons.events.Event.Builder();
    } else {
      return new com.baasflow.commons.events.Event.Builder(other);
    }
  }

  /**
   * Creates a new Event RecordBuilder by copying an existing Event instance.
   * @param other The existing instance to copy.
   * @return A new Event RecordBuilder
   */
  public static com.baasflow.commons.events.Event.Builder newBuilder(com.baasflow.commons.events.Event other) {
    if (other == null) {
      return new com.baasflow.commons.events.Event.Builder();
    } else {
      return new com.baasflow.commons.events.Event.Builder(other);
    }
  }

  /**
   * RecordBuilder for Event instances.
   */
  @org.apache.avro.specific.AvroGenerated
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
    implements org.apache.avro.data.RecordBuilder {

    /** The unique ID of the event. */
    private java.util.UUID id;
    /** The timestamp of the event, showing when the event happened. Not related to the event ingestion time. */
    private java.time.Instant eventTimestamp;
    /** The type of the event. Possible values: audit, business, technical, unspecified. */
    private com.baasflow.commons.events.EventType eventType;
    /** The module that sends the event. Example values: c360, order_manager. */
    private java.lang.String sourceModule;
    /** The event that happened. For REST API events set it to operationId from the OpenAPI specification. For other events set to sensible values. */
    private java.lang.String event;
    /** The log level of the event. Possible values: TRACE, DEBUG, INFO, WARN, ERROR. For audit event, always set to INFO. */
    private com.baasflow.commons.events.EventLogLevel eventLogLevel;
    /** The status of the event. For REST API events set it to success if the HTTP response code is 2xx and to failure otherwise. */
    private com.baasflow.commons.events.EventStatus eventStatus;
    /** Any IDs that relate to the event. The keys store the name of the ID, the value is the value of the ID. Example keys: paymentId, UETR, transactionId, internalCorrelationId, transactionGroupId, endToEndId */
    private java.util.Map correlationIds;
    /** Any other important information that relate to the event. For the audit log it should mostly remain empty. */
    private java.lang.String payload;
    /** Type of the payload */
    private java.lang.String payloadType;
    /** The ID of the tenant that the event belongs to. */
    private java.lang.String tenantId;

    /** Creates a new Builder */
    private Builder() {
      super(SCHEMA$, MODEL$);
    }

    /**
     * Creates a Builder by copying an existing Builder.
     * @param other The existing Builder to copy.
     */
    private Builder(com.baasflow.commons.events.Event.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = other.fieldSetFlags()[0];
      }
      if (isValidValue(fields()[1], other.eventTimestamp)) {
        this.eventTimestamp = data().deepCopy(fields()[1].schema(), other.eventTimestamp);
        fieldSetFlags()[1] = other.fieldSetFlags()[1];
      }
      if (isValidValue(fields()[2], other.eventType)) {
        this.eventType = data().deepCopy(fields()[2].schema(), other.eventType);
        fieldSetFlags()[2] = other.fieldSetFlags()[2];
      }
      if (isValidValue(fields()[3], other.sourceModule)) {
        this.sourceModule = data().deepCopy(fields()[3].schema(), other.sourceModule);
        fieldSetFlags()[3] = other.fieldSetFlags()[3];
      }
      if (isValidValue(fields()[4], other.event)) {
        this.event = data().deepCopy(fields()[4].schema(), other.event);
        fieldSetFlags()[4] = other.fieldSetFlags()[4];
      }
      if (isValidValue(fields()[5], other.eventLogLevel)) {
        this.eventLogLevel = data().deepCopy(fields()[5].schema(), other.eventLogLevel);
        fieldSetFlags()[5] = other.fieldSetFlags()[5];
      }
      if (isValidValue(fields()[6], other.eventStatus)) {
        this.eventStatus = data().deepCopy(fields()[6].schema(), other.eventStatus);
        fieldSetFlags()[6] = other.fieldSetFlags()[6];
      }
      if (isValidValue(fields()[7], other.correlationIds)) {
        this.correlationIds = data().deepCopy(fields()[7].schema(), other.correlationIds);
        fieldSetFlags()[7] = other.fieldSetFlags()[7];
      }
      if (isValidValue(fields()[8], other.payload)) {
        this.payload = data().deepCopy(fields()[8].schema(), other.payload);
        fieldSetFlags()[8] = other.fieldSetFlags()[8];
      }
      if (isValidValue(fields()[9], other.payloadType)) {
        this.payloadType = data().deepCopy(fields()[9].schema(), other.payloadType);
        fieldSetFlags()[9] = other.fieldSetFlags()[9];
      }
      if (isValidValue(fields()[10], other.tenantId)) {
        this.tenantId = data().deepCopy(fields()[10].schema(), other.tenantId);
        fieldSetFlags()[10] = other.fieldSetFlags()[10];
      }
    }

    /**
     * Creates a Builder by copying an existing Event instance
     * @param other The existing instance to copy.
     */
    private Builder(com.baasflow.commons.events.Event other) {
      super(SCHEMA$, MODEL$);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.eventTimestamp)) {
        this.eventTimestamp = data().deepCopy(fields()[1].schema(), other.eventTimestamp);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.eventType)) {
        this.eventType = data().deepCopy(fields()[2].schema(), other.eventType);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.sourceModule)) {
        this.sourceModule = data().deepCopy(fields()[3].schema(), other.sourceModule);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.event)) {
        this.event = data().deepCopy(fields()[4].schema(), other.event);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.eventLogLevel)) {
        this.eventLogLevel = data().deepCopy(fields()[5].schema(), other.eventLogLevel);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.eventStatus)) {
        this.eventStatus = data().deepCopy(fields()[6].schema(), other.eventStatus);
        fieldSetFlags()[6] = true;
      }
      if (isValidValue(fields()[7], other.correlationIds)) {
        this.correlationIds = data().deepCopy(fields()[7].schema(), other.correlationIds);
        fieldSetFlags()[7] = true;
      }
      if (isValidValue(fields()[8], other.payload)) {
        this.payload = data().deepCopy(fields()[8].schema(), other.payload);
        fieldSetFlags()[8] = true;
      }
      if (isValidValue(fields()[9], other.payloadType)) {
        this.payloadType = data().deepCopy(fields()[9].schema(), other.payloadType);
        fieldSetFlags()[9] = true;
      }
      if (isValidValue(fields()[10], other.tenantId)) {
        this.tenantId = data().deepCopy(fields()[10].schema(), other.tenantId);
        fieldSetFlags()[10] = true;
      }
    }

    /**
      * Gets the value of the 'id' field.
      * The unique ID of the event.
      * @return The value.
      */
    public java.util.UUID getId() {
      return id;
    }


    /**
      * Sets the value of the 'id' field.
      * The unique ID of the event.
      * @param value The value of 'id'.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder setId(java.util.UUID value) {
      validate(fields()[0], value);
      this.id = value;
      fieldSetFlags()[0] = true;
      return this;
    }

    /**
      * Checks whether the 'id' field has been set.
      * The unique ID of the event.
      * @return True if the 'id' field has been set, false otherwise.
      */
    public boolean hasId() {
      return fieldSetFlags()[0];
    }


    /**
      * Clears the value of the 'id' field.
      * The unique ID of the event.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder clearId() {
      id = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /**
      * Gets the value of the 'eventTimestamp' field.
      * The timestamp of the event, showing when the event happened. Not related to the event ingestion time.
      * @return The value.
      */
    public java.time.Instant getEventTimestamp() {
      return eventTimestamp;
    }


    /**
      * Sets the value of the 'eventTimestamp' field.
      * The timestamp of the event, showing when the event happened. Not related to the event ingestion time.
      * @param value The value of 'eventTimestamp'.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder setEventTimestamp(java.time.Instant value) {
      validate(fields()[1], value);
      this.eventTimestamp = value;
      fieldSetFlags()[1] = true;
      return this;
    }

    /**
      * Checks whether the 'eventTimestamp' field has been set.
      * The timestamp of the event, showing when the event happened. Not related to the event ingestion time.
      * @return True if the 'eventTimestamp' field has been set, false otherwise.
      */
    public boolean hasEventTimestamp() {
      return fieldSetFlags()[1];
    }


    /**
      * Clears the value of the 'eventTimestamp' field.
      * The timestamp of the event, showing when the event happened. Not related to the event ingestion time.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder clearEventTimestamp() {
      eventTimestamp = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /**
      * Gets the value of the 'eventType' field.
      * The type of the event. Possible values: audit, business, technical, unspecified.
      * @return The value.
      */
    public com.baasflow.commons.events.EventType getEventType() {
      return eventType;
    }


    /**
      * Sets the value of the 'eventType' field.
      * The type of the event. Possible values: audit, business, technical, unspecified.
      * @param value The value of 'eventType'.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder setEventType(com.baasflow.commons.events.EventType value) {
      validate(fields()[2], value);
      this.eventType = value;
      fieldSetFlags()[2] = true;
      return this;
    }

    /**
      * Checks whether the 'eventType' field has been set.
      * The type of the event. Possible values: audit, business, technical, unspecified.
      * @return True if the 'eventType' field has been set, false otherwise.
      */
    public boolean hasEventType() {
      return fieldSetFlags()[2];
    }


    /**
      * Clears the value of the 'eventType' field.
      * The type of the event. Possible values: audit, business, technical, unspecified.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder clearEventType() {
      eventType = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /**
      * Gets the value of the 'sourceModule' field.
      * The module that sends the event. Example values: c360, order_manager.
      * @return The value.
      */
    public java.lang.String getSourceModule() {
      return sourceModule;
    }


    /**
      * Sets the value of the 'sourceModule' field.
      * The module that sends the event. Example values: c360, order_manager.
      * @param value The value of 'sourceModule'.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder setSourceModule(java.lang.String value) {
      validate(fields()[3], value);
      this.sourceModule = value;
      fieldSetFlags()[3] = true;
      return this;
    }

    /**
      * Checks whether the 'sourceModule' field has been set.
      * The module that sends the event. Example values: c360, order_manager.
      * @return True if the 'sourceModule' field has been set, false otherwise.
      */
    public boolean hasSourceModule() {
      return fieldSetFlags()[3];
    }


    /**
      * Clears the value of the 'sourceModule' field.
      * The module that sends the event. Example values: c360, order_manager.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder clearSourceModule() {
      sourceModule = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    /**
      * Gets the value of the 'event' field.
      * The event that happened. For REST API events set it to operationId from the OpenAPI specification. For other events set to sensible values.
      * @return The value.
      */
    public java.lang.String getEvent() {
      return event;
    }


    /**
      * Sets the value of the 'event' field.
      * The event that happened. For REST API events set it to operationId from the OpenAPI specification. For other events set to sensible values.
      * @param value The value of 'event'.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder setEvent(java.lang.String value) {
      validate(fields()[4], value);
      this.event = value;
      fieldSetFlags()[4] = true;
      return this;
    }

    /**
      * Checks whether the 'event' field has been set.
      * The event that happened. For REST API events set it to operationId from the OpenAPI specification. For other events set to sensible values.
      * @return True if the 'event' field has been set, false otherwise.
      */
    public boolean hasEvent() {
      return fieldSetFlags()[4];
    }


    /**
      * Clears the value of the 'event' field.
      * The event that happened. For REST API events set it to operationId from the OpenAPI specification. For other events set to sensible values.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder clearEvent() {
      event = null;
      fieldSetFlags()[4] = false;
      return this;
    }

    /**
      * Gets the value of the 'eventLogLevel' field.
      * The log level of the event. Possible values: TRACE, DEBUG, INFO, WARN, ERROR. For audit event, always set to INFO.
      * @return The value.
      */
    public com.baasflow.commons.events.EventLogLevel getEventLogLevel() {
      return eventLogLevel;
    }


    /**
      * Sets the value of the 'eventLogLevel' field.
      * The log level of the event. Possible values: TRACE, DEBUG, INFO, WARN, ERROR. For audit event, always set to INFO.
      * @param value The value of 'eventLogLevel'.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder setEventLogLevel(com.baasflow.commons.events.EventLogLevel value) {
      validate(fields()[5], value);
      this.eventLogLevel = value;
      fieldSetFlags()[5] = true;
      return this;
    }

    /**
      * Checks whether the 'eventLogLevel' field has been set.
      * The log level of the event. Possible values: TRACE, DEBUG, INFO, WARN, ERROR. For audit event, always set to INFO.
      * @return True if the 'eventLogLevel' field has been set, false otherwise.
      */
    public boolean hasEventLogLevel() {
      return fieldSetFlags()[5];
    }


    /**
      * Clears the value of the 'eventLogLevel' field.
      * The log level of the event. Possible values: TRACE, DEBUG, INFO, WARN, ERROR. For audit event, always set to INFO.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder clearEventLogLevel() {
      eventLogLevel = null;
      fieldSetFlags()[5] = false;
      return this;
    }

    /**
      * Gets the value of the 'eventStatus' field.
      * The status of the event. For REST API events set it to success if the HTTP response code is 2xx and to failure otherwise.
      * @return The value.
      */
    public com.baasflow.commons.events.EventStatus getEventStatus() {
      return eventStatus;
    }


    /**
      * Sets the value of the 'eventStatus' field.
      * The status of the event. For REST API events set it to success if the HTTP response code is 2xx and to failure otherwise.
      * @param value The value of 'eventStatus'.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder setEventStatus(com.baasflow.commons.events.EventStatus value) {
      validate(fields()[6], value);
      this.eventStatus = value;
      fieldSetFlags()[6] = true;
      return this;
    }

    /**
      * Checks whether the 'eventStatus' field has been set.
      * The status of the event. For REST API events set it to success if the HTTP response code is 2xx and to failure otherwise.
      * @return True if the 'eventStatus' field has been set, false otherwise.
      */
    public boolean hasEventStatus() {
      return fieldSetFlags()[6];
    }


    /**
      * Clears the value of the 'eventStatus' field.
      * The status of the event. For REST API events set it to success if the HTTP response code is 2xx and to failure otherwise.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder clearEventStatus() {
      eventStatus = null;
      fieldSetFlags()[6] = false;
      return this;
    }

    /**
      * Gets the value of the 'correlationIds' field.
      * Any IDs that relate to the event. The keys store the name of the ID, the value is the value of the ID. Example keys: paymentId, UETR, transactionId, internalCorrelationId, transactionGroupId, endToEndId
      * @return The value.
      */
    public java.util.Map getCorrelationIds() {
      return correlationIds;
    }


    /**
      * Sets the value of the 'correlationIds' field.
      * Any IDs that relate to the event. The keys store the name of the ID, the value is the value of the ID. Example keys: paymentId, UETR, transactionId, internalCorrelationId, transactionGroupId, endToEndId
      * @param value The value of 'correlationIds'.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder setCorrelationIds(java.util.Map value) {
      validate(fields()[7], value);
      this.correlationIds = value;
      fieldSetFlags()[7] = true;
      return this;
    }

    /**
      * Checks whether the 'correlationIds' field has been set.
      * Any IDs that relate to the event. The keys store the name of the ID, the value is the value of the ID. Example keys: paymentId, UETR, transactionId, internalCorrelationId, transactionGroupId, endToEndId
      * @return True if the 'correlationIds' field has been set, false otherwise.
      */
    public boolean hasCorrelationIds() {
      return fieldSetFlags()[7];
    }


    /**
      * Clears the value of the 'correlationIds' field.
      * Any IDs that relate to the event. The keys store the name of the ID, the value is the value of the ID. Example keys: paymentId, UETR, transactionId, internalCorrelationId, transactionGroupId, endToEndId
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder clearCorrelationIds() {
      correlationIds = null;
      fieldSetFlags()[7] = false;
      return this;
    }

    /**
      * Gets the value of the 'payload' field.
      * Any other important information that relate to the event. For the audit log it should mostly remain empty.
      * @return The value.
      */
    public java.lang.String getPayload() {
      return payload;
    }


    /**
      * Sets the value of the 'payload' field.
      * Any other important information that relate to the event. For the audit log it should mostly remain empty.
      * @param value The value of 'payload'.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder setPayload(java.lang.String value) {
      validate(fields()[8], value);
      this.payload = value;
      fieldSetFlags()[8] = true;
      return this;
    }

    /**
      * Checks whether the 'payload' field has been set.
      * Any other important information that relate to the event. For the audit log it should mostly remain empty.
      * @return True if the 'payload' field has been set, false otherwise.
      */
    public boolean hasPayload() {
      return fieldSetFlags()[8];
    }


    /**
      * Clears the value of the 'payload' field.
      * Any other important information that relate to the event. For the audit log it should mostly remain empty.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder clearPayload() {
      payload = null;
      fieldSetFlags()[8] = false;
      return this;
    }

    /**
      * Gets the value of the 'payloadType' field.
      * Type of the payload
      * @return The value.
      */
    public java.lang.String getPayloadType() {
      return payloadType;
    }


    /**
      * Sets the value of the 'payloadType' field.
      * Type of the payload
      * @param value The value of 'payloadType'.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder setPayloadType(java.lang.String value) {
      validate(fields()[9], value);
      this.payloadType = value;
      fieldSetFlags()[9] = true;
      return this;
    }

    /**
      * Checks whether the 'payloadType' field has been set.
      * Type of the payload
      * @return True if the 'payloadType' field has been set, false otherwise.
      */
    public boolean hasPayloadType() {
      return fieldSetFlags()[9];
    }


    /**
      * Clears the value of the 'payloadType' field.
      * Type of the payload
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder clearPayloadType() {
      payloadType = null;
      fieldSetFlags()[9] = false;
      return this;
    }

    /**
      * Gets the value of the 'tenantId' field.
      * The ID of the tenant that the event belongs to.
      * @return The value.
      */
    public java.lang.String getTenantId() {
      return tenantId;
    }


    /**
      * Sets the value of the 'tenantId' field.
      * The ID of the tenant that the event belongs to.
      * @param value The value of 'tenantId'.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder setTenantId(java.lang.String value) {
      validate(fields()[10], value);
      this.tenantId = value;
      fieldSetFlags()[10] = true;
      return this;
    }

    /**
      * Checks whether the 'tenantId' field has been set.
      * The ID of the tenant that the event belongs to.
      * @return True if the 'tenantId' field has been set, false otherwise.
      */
    public boolean hasTenantId() {
      return fieldSetFlags()[10];
    }


    /**
      * Clears the value of the 'tenantId' field.
      * The ID of the tenant that the event belongs to.
      * @return This builder.
      */
    public com.baasflow.commons.events.Event.Builder clearTenantId() {
      tenantId = null;
      fieldSetFlags()[10] = false;
      return this;
    }

    @Override
    @SuppressWarnings("unchecked")
    public Event build() {
      try {
        Event record = new Event();
        record.id = fieldSetFlags()[0] ? this.id : (java.util.UUID) defaultValue(fields()[0]);
        record.eventTimestamp = fieldSetFlags()[1] ? this.eventTimestamp : (java.time.Instant) defaultValue(fields()[1]);
        record.eventType = fieldSetFlags()[2] ? this.eventType : (com.baasflow.commons.events.EventType) defaultValue(fields()[2]);
        record.sourceModule = fieldSetFlags()[3] ? this.sourceModule : (java.lang.String) defaultValue(fields()[3]);
        record.event = fieldSetFlags()[4] ? this.event : (java.lang.String) defaultValue(fields()[4]);
        record.eventLogLevel = fieldSetFlags()[5] ? this.eventLogLevel : (com.baasflow.commons.events.EventLogLevel) defaultValue(fields()[5]);
        record.eventStatus = fieldSetFlags()[6] ? this.eventStatus : (com.baasflow.commons.events.EventStatus) defaultValue(fields()[6]);
        record.correlationIds = fieldSetFlags()[7] ? this.correlationIds : (java.util.Map) defaultValue(fields()[7]);
        record.payload = fieldSetFlags()[8] ? this.payload : (java.lang.String) defaultValue(fields()[8]);
        record.payloadType = fieldSetFlags()[9] ? this.payloadType : (java.lang.String) defaultValue(fields()[9]);
        record.tenantId = fieldSetFlags()[10] ? this.tenantId : (java.lang.String) defaultValue(fields()[10]);
        return record;
      } catch (org.apache.avro.AvroMissingFieldException e) {
        throw e;
      } catch (java.lang.Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }

  @SuppressWarnings("unchecked")
  private static final org.apache.avro.io.DatumWriter
    WRITER$ = (org.apache.avro.io.DatumWriter)MODEL$.createDatumWriter(SCHEMA$);

  @Override public void writeExternal(java.io.ObjectOutput out)
    throws java.io.IOException {
    WRITER$.write(this, SpecificData.getEncoder(out));
  }

  @SuppressWarnings("unchecked")
  private static final org.apache.avro.io.DatumReader
    READER$ = (org.apache.avro.io.DatumReader)MODEL$.createDatumReader(SCHEMA$);

  @Override public void readExternal(java.io.ObjectInput in)
    throws java.io.IOException {
    READER$.read(this, SpecificData.getDecoder(in));
  }

}














© 2015 - 2024 Weber Informatics LLC | Privacy Policy