From: Kai Moritz Date: Sun, 7 Jun 2020 17:36:45 +0000 (+0200) Subject: TMP X-Git-Url: https://juplo.de/gitweb/?p=demos%2Fmicroservices;a=commitdiff_plain;h=525feeb10e1c653b8a88d50c472c034945bf4d6e TMP --- diff --git a/validate-user/src/main/java/de/trion/microservices/avro/CustomerLevel.java b/validate-user/src/main/java/de/trion/microservices/avro/CustomerLevel.java deleted file mode 100644 index 9abd09b..0000000 --- a/validate-user/src/main/java/de/trion/microservices/avro/CustomerLevel.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Autogenerated by Avro - * - * DO NOT EDIT DIRECTLY - */ -package de.trion.microservices.avro; -@org.apache.avro.specific.AvroGenerated -public enum CustomerLevel implements org.apache.avro.generic.GenericEnumSymbol { - BRONZE, SILVER, GOLD, UNWANTED ; - public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"enum\",\"name\":\"CustomerLevel\",\"namespace\":\"de.trion.microservices.avro\",\"symbols\":[\"BRONZE\",\"SILVER\",\"GOLD\",\"UNWANTED\"]}"); - public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } - public org.apache.avro.Schema getSchema() { return SCHEMA$; } -} diff --git a/validate-user/src/main/java/de/trion/microservices/avro/Order.java b/validate-user/src/main/java/de/trion/microservices/avro/Order.java deleted file mode 100644 index f1dc56d..0000000 --- a/validate-user/src/main/java/de/trion/microservices/avro/Order.java +++ /dev/null @@ -1,706 +0,0 @@ -/** - * Autogenerated by Avro - * - * DO NOT EDIT DIRECTLY - */ -package de.trion.microservices.avro; - -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; - -@org.apache.avro.specific.AvroGenerated -public class Order extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { - private static final long serialVersionUID = 6161645617080332601L; - public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Order\",\"namespace\":\"de.trion.microservices.avro\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"state\",\"type\":{\"type\":\"enum\",\"name\":\"OrderState\",\"symbols\":[\"CREATED\",\"APPROVED\",\"DECLINED\"],\"default\":\"CREATED\"}},{\"name\":\"customerId\",\"type\":\"long\"},{\"name\":\"orderId\",\"type\":\"long\"},{\"name\":\"productId\",\"type\":\"long\"},{\"name\":\"quantity\",\"type\":\"int\"}]}"); - public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } - - private static SpecificData MODEL$ = new SpecificData(); - - 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 Order 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 Order from a ByteBuffer. - * @param b a byte buffer holding serialized data for an instance of this class - * @return a Order 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 Order fromByteBuffer( - java.nio.ByteBuffer b) throws java.io.IOException { - return DECODER.decode(b); - } - - @Deprecated public java.lang.CharSequence id; - @Deprecated public de.trion.microservices.avro.OrderState state; - @Deprecated public long customerId; - @Deprecated public long orderId; - @Deprecated public long productId; - @Deprecated public int quantity; - - /** - * 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 Order() {} - - /** - * All-args constructor. - * @param id The new value for id - * @param state The new value for state - * @param customerId The new value for customerId - * @param orderId The new value for orderId - * @param productId The new value for productId - * @param quantity The new value for quantity - */ - public Order(java.lang.CharSequence id, de.trion.microservices.avro.OrderState state, java.lang.Long customerId, java.lang.Long orderId, java.lang.Long productId, java.lang.Integer quantity) { - this.id = id; - this.state = state; - this.customerId = customerId; - this.orderId = orderId; - this.productId = productId; - this.quantity = quantity; - } - - public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; } - public org.apache.avro.Schema getSchema() { return SCHEMA$; } - // Used by DatumWriter. Applications should not call. - public java.lang.Object get(int field$) { - switch (field$) { - case 0: return id; - case 1: return state; - case 2: return customerId; - case 3: return orderId; - case 4: return productId; - case 5: return quantity; - default: throw new org.apache.avro.AvroRuntimeException("Bad index"); - } - } - - // Used by DatumReader. Applications should not call. - @SuppressWarnings(value="unchecked") - public void put(int field$, java.lang.Object value$) { - switch (field$) { - case 0: id = (java.lang.CharSequence)value$; break; - case 1: state = (de.trion.microservices.avro.OrderState)value$; break; - case 2: customerId = (java.lang.Long)value$; break; - case 3: orderId = (java.lang.Long)value$; break; - case 4: productId = (java.lang.Long)value$; break; - case 5: quantity = (java.lang.Integer)value$; break; - default: throw new org.apache.avro.AvroRuntimeException("Bad index"); - } - } - - /** - * Gets the value of the 'id' field. - * @return The value of the 'id' field. - */ - public java.lang.CharSequence getId() { - return id; - } - - - /** - * Sets the value of the 'id' field. - * @param value the value to set. - */ - public void setId(java.lang.CharSequence value) { - this.id = value; - } - - /** - * Gets the value of the 'state' field. - * @return The value of the 'state' field. - */ - public de.trion.microservices.avro.OrderState getState() { - return state; - } - - - /** - * Sets the value of the 'state' field. - * @param value the value to set. - */ - public void setState(de.trion.microservices.avro.OrderState value) { - this.state = value; - } - - /** - * Gets the value of the 'customerId' field. - * @return The value of the 'customerId' field. - */ - public long getCustomerId() { - return customerId; - } - - - /** - * Sets the value of the 'customerId' field. - * @param value the value to set. - */ - public void setCustomerId(long value) { - this.customerId = value; - } - - /** - * Gets the value of the 'orderId' field. - * @return The value of the 'orderId' field. - */ - public long getOrderId() { - return orderId; - } - - - /** - * Sets the value of the 'orderId' field. - * @param value the value to set. - */ - public void setOrderId(long value) { - this.orderId = value; - } - - /** - * Gets the value of the 'productId' field. - * @return The value of the 'productId' field. - */ - public long getProductId() { - return productId; - } - - - /** - * Sets the value of the 'productId' field. - * @param value the value to set. - */ - public void setProductId(long value) { - this.productId = value; - } - - /** - * Gets the value of the 'quantity' field. - * @return The value of the 'quantity' field. - */ - public int getQuantity() { - return quantity; - } - - - /** - * Sets the value of the 'quantity' field. - * @param value the value to set. - */ - public void setQuantity(int value) { - this.quantity = value; - } - - /** - * Creates a new Order RecordBuilder. - * @return A new Order RecordBuilder - */ - public static de.trion.microservices.avro.Order.Builder newBuilder() { - return new de.trion.microservices.avro.Order.Builder(); - } - - /** - * Creates a new Order RecordBuilder by copying an existing Builder. - * @param other The existing builder to copy. - * @return A new Order RecordBuilder - */ - public static de.trion.microservices.avro.Order.Builder newBuilder(de.trion.microservices.avro.Order.Builder other) { - if (other == null) { - return new de.trion.microservices.avro.Order.Builder(); - } else { - return new de.trion.microservices.avro.Order.Builder(other); - } - } - - /** - * Creates a new Order RecordBuilder by copying an existing Order instance. - * @param other The existing instance to copy. - * @return A new Order RecordBuilder - */ - public static de.trion.microservices.avro.Order.Builder newBuilder(de.trion.microservices.avro.Order other) { - if (other == null) { - return new de.trion.microservices.avro.Order.Builder(); - } else { - return new de.trion.microservices.avro.Order.Builder(other); - } - } - - /** - * RecordBuilder for Order instances. - */ - public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase - implements org.apache.avro.data.RecordBuilder { - - private java.lang.CharSequence id; - private de.trion.microservices.avro.OrderState state; - private long customerId; - private long orderId; - private long productId; - private int quantity; - - /** Creates a new Builder */ - private Builder() { - super(SCHEMA$); - } - - /** - * Creates a Builder by copying an existing Builder. - * @param other The existing Builder to copy. - */ - private Builder(de.trion.microservices.avro.Order.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.state)) { - this.state = data().deepCopy(fields()[1].schema(), other.state); - fieldSetFlags()[1] = other.fieldSetFlags()[1]; - } - if (isValidValue(fields()[2], other.customerId)) { - this.customerId = data().deepCopy(fields()[2].schema(), other.customerId); - fieldSetFlags()[2] = other.fieldSetFlags()[2]; - } - if (isValidValue(fields()[3], other.orderId)) { - this.orderId = data().deepCopy(fields()[3].schema(), other.orderId); - fieldSetFlags()[3] = other.fieldSetFlags()[3]; - } - if (isValidValue(fields()[4], other.productId)) { - this.productId = data().deepCopy(fields()[4].schema(), other.productId); - fieldSetFlags()[4] = other.fieldSetFlags()[4]; - } - if (isValidValue(fields()[5], other.quantity)) { - this.quantity = data().deepCopy(fields()[5].schema(), other.quantity); - fieldSetFlags()[5] = other.fieldSetFlags()[5]; - } - } - - /** - * Creates a Builder by copying an existing Order instance - * @param other The existing instance to copy. - */ - private Builder(de.trion.microservices.avro.Order other) { - super(SCHEMA$); - if (isValidValue(fields()[0], other.id)) { - this.id = data().deepCopy(fields()[0].schema(), other.id); - fieldSetFlags()[0] = true; - } - if (isValidValue(fields()[1], other.state)) { - this.state = data().deepCopy(fields()[1].schema(), other.state); - fieldSetFlags()[1] = true; - } - if (isValidValue(fields()[2], other.customerId)) { - this.customerId = data().deepCopy(fields()[2].schema(), other.customerId); - fieldSetFlags()[2] = true; - } - if (isValidValue(fields()[3], other.orderId)) { - this.orderId = data().deepCopy(fields()[3].schema(), other.orderId); - fieldSetFlags()[3] = true; - } - if (isValidValue(fields()[4], other.productId)) { - this.productId = data().deepCopy(fields()[4].schema(), other.productId); - fieldSetFlags()[4] = true; - } - if (isValidValue(fields()[5], other.quantity)) { - this.quantity = data().deepCopy(fields()[5].schema(), other.quantity); - fieldSetFlags()[5] = true; - } - } - - /** - * Gets the value of the 'id' field. - * @return The value. - */ - public java.lang.CharSequence getId() { - return id; - } - - - /** - * Sets the value of the 'id' field. - * @param value The value of 'id'. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder setId(java.lang.CharSequence value) { - validate(fields()[0], value); - this.id = value; - fieldSetFlags()[0] = true; - return this; - } - - /** - * Checks whether the 'id' field has been set. - * @return True if the 'id' field has been set, false otherwise. - */ - public boolean hasId() { - return fieldSetFlags()[0]; - } - - - /** - * Clears the value of the 'id' field. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder clearId() { - id = null; - fieldSetFlags()[0] = false; - return this; - } - - /** - * Gets the value of the 'state' field. - * @return The value. - */ - public de.trion.microservices.avro.OrderState getState() { - return state; - } - - - /** - * Sets the value of the 'state' field. - * @param value The value of 'state'. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder setState(de.trion.microservices.avro.OrderState value) { - validate(fields()[1], value); - this.state = value; - fieldSetFlags()[1] = true; - return this; - } - - /** - * Checks whether the 'state' field has been set. - * @return True if the 'state' field has been set, false otherwise. - */ - public boolean hasState() { - return fieldSetFlags()[1]; - } - - - /** - * Clears the value of the 'state' field. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder clearState() { - state = null; - fieldSetFlags()[1] = false; - return this; - } - - /** - * Gets the value of the 'customerId' field. - * @return The value. - */ - public long getCustomerId() { - return customerId; - } - - - /** - * Sets the value of the 'customerId' field. - * @param value The value of 'customerId'. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder setCustomerId(long value) { - validate(fields()[2], value); - this.customerId = value; - fieldSetFlags()[2] = true; - return this; - } - - /** - * Checks whether the 'customerId' field has been set. - * @return True if the 'customerId' field has been set, false otherwise. - */ - public boolean hasCustomerId() { - return fieldSetFlags()[2]; - } - - - /** - * Clears the value of the 'customerId' field. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder clearCustomerId() { - fieldSetFlags()[2] = false; - return this; - } - - /** - * Gets the value of the 'orderId' field. - * @return The value. - */ - public long getOrderId() { - return orderId; - } - - - /** - * Sets the value of the 'orderId' field. - * @param value The value of 'orderId'. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder setOrderId(long value) { - validate(fields()[3], value); - this.orderId = value; - fieldSetFlags()[3] = true; - return this; - } - - /** - * Checks whether the 'orderId' field has been set. - * @return True if the 'orderId' field has been set, false otherwise. - */ - public boolean hasOrderId() { - return fieldSetFlags()[3]; - } - - - /** - * Clears the value of the 'orderId' field. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder clearOrderId() { - fieldSetFlags()[3] = false; - return this; - } - - /** - * Gets the value of the 'productId' field. - * @return The value. - */ - public long getProductId() { - return productId; - } - - - /** - * Sets the value of the 'productId' field. - * @param value The value of 'productId'. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder setProductId(long value) { - validate(fields()[4], value); - this.productId = value; - fieldSetFlags()[4] = true; - return this; - } - - /** - * Checks whether the 'productId' field has been set. - * @return True if the 'productId' field has been set, false otherwise. - */ - public boolean hasProductId() { - return fieldSetFlags()[4]; - } - - - /** - * Clears the value of the 'productId' field. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder clearProductId() { - fieldSetFlags()[4] = false; - return this; - } - - /** - * Gets the value of the 'quantity' field. - * @return The value. - */ - public int getQuantity() { - return quantity; - } - - - /** - * Sets the value of the 'quantity' field. - * @param value The value of 'quantity'. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder setQuantity(int value) { - validate(fields()[5], value); - this.quantity = value; - fieldSetFlags()[5] = true; - return this; - } - - /** - * Checks whether the 'quantity' field has been set. - * @return True if the 'quantity' field has been set, false otherwise. - */ - public boolean hasQuantity() { - return fieldSetFlags()[5]; - } - - - /** - * Clears the value of the 'quantity' field. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder clearQuantity() { - fieldSetFlags()[5] = false; - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Order build() { - try { - Order record = new Order(); - record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]); - record.state = fieldSetFlags()[1] ? this.state : (de.trion.microservices.avro.OrderState) defaultValue(fields()[1]); - record.customerId = fieldSetFlags()[2] ? this.customerId : (java.lang.Long) defaultValue(fields()[2]); - record.orderId = fieldSetFlags()[3] ? this.orderId : (java.lang.Long) defaultValue(fields()[3]); - record.productId = fieldSetFlags()[4] ? this.productId : (java.lang.Long) defaultValue(fields()[4]); - record.quantity = fieldSetFlags()[5] ? this.quantity : (java.lang.Integer) defaultValue(fields()[5]); - 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)); - } - - @Override protected boolean hasCustomCoders() { return true; } - - @Override public void customEncode(org.apache.avro.io.Encoder out) - throws java.io.IOException - { - out.writeString(this.id); - - out.writeEnum(this.state.ordinal()); - - out.writeLong(this.customerId); - - out.writeLong(this.orderId); - - out.writeLong(this.productId); - - out.writeInt(this.quantity); - - } - - @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in) - throws java.io.IOException - { - org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff(); - if (fieldOrder == null) { - this.id = in.readString(this.id instanceof Utf8 ? (Utf8)this.id : null); - - this.state = de.trion.microservices.avro.OrderState.values()[in.readEnum()]; - - this.customerId = in.readLong(); - - this.orderId = in.readLong(); - - this.productId = in.readLong(); - - this.quantity = in.readInt(); - - } else { - for (int i = 0; i < 6; i++) { - switch (fieldOrder[i].pos()) { - case 0: - this.id = in.readString(this.id instanceof Utf8 ? (Utf8)this.id : null); - break; - - case 1: - this.state = de.trion.microservices.avro.OrderState.values()[in.readEnum()]; - break; - - case 2: - this.customerId = in.readLong(); - break; - - case 3: - this.orderId = in.readLong(); - break; - - case 4: - this.productId = in.readLong(); - break; - - case 5: - this.quantity = in.readInt(); - break; - - default: - throw new java.io.IOException("Corrupt ResolvingDecoder."); - } - } - } - } -} - - - - - - - - - - diff --git a/validate-user/src/main/java/de/trion/microservices/avro/OrderAndUser.java b/validate-user/src/main/java/de/trion/microservices/avro/OrderAndUser.java deleted file mode 100644 index d3b9cfb..0000000 --- a/validate-user/src/main/java/de/trion/microservices/avro/OrderAndUser.java +++ /dev/null @@ -1,516 +0,0 @@ -/** - * Autogenerated by Avro - * - * DO NOT EDIT DIRECTLY - */ -package de.trion.microservices.avro; - -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; - -@org.apache.avro.specific.AvroGenerated -public class OrderAndUser extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { - private static final long serialVersionUID = 6432660008992245598L; - public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"OrderAndUser\",\"namespace\":\"de.trion.microservices.avro\",\"fields\":[{\"name\":\"order\",\"type\":{\"type\":\"record\",\"name\":\"Order\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"state\",\"type\":{\"type\":\"enum\",\"name\":\"OrderState\",\"symbols\":[\"CREATED\",\"APPROVED\",\"DECLINED\"],\"default\":\"CREATED\"}},{\"name\":\"customerId\",\"type\":\"long\"},{\"name\":\"orderId\",\"type\":\"long\"},{\"name\":\"productId\",\"type\":\"long\"},{\"name\":\"quantity\",\"type\":\"int\"}]}},{\"name\":\"user\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"User\",\"fields\":[{\"name\":\"id\",\"type\":\"long\"},{\"name\":\"level\",\"type\":{\"type\":\"enum\",\"name\":\"CustomerLevel\",\"symbols\":[\"BRONZE\",\"SILVER\",\"GOLD\",\"UNWANTED\"]}},{\"name\":\"name\",\"type\":\"string\"}]}]}]}"); - public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } - - private static SpecificData MODEL$ = new SpecificData(); - - 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 OrderAndUser 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 OrderAndUser from a ByteBuffer. - * @param b a byte buffer holding serialized data for an instance of this class - * @return a OrderAndUser 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 OrderAndUser fromByteBuffer( - java.nio.ByteBuffer b) throws java.io.IOException { - return DECODER.decode(b); - } - - @Deprecated public de.trion.microservices.avro.Order order; - @Deprecated public de.trion.microservices.avro.User user; - - /** - * 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 OrderAndUser() {} - - /** - * All-args constructor. - * @param order The new value for order - * @param user The new value for user - */ - public OrderAndUser(de.trion.microservices.avro.Order order, de.trion.microservices.avro.User user) { - this.order = order; - this.user = user; - } - - public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; } - public org.apache.avro.Schema getSchema() { return SCHEMA$; } - // Used by DatumWriter. Applications should not call. - public java.lang.Object get(int field$) { - switch (field$) { - case 0: return order; - case 1: return user; - default: throw new org.apache.avro.AvroRuntimeException("Bad index"); - } - } - - // Used by DatumReader. Applications should not call. - @SuppressWarnings(value="unchecked") - public void put(int field$, java.lang.Object value$) { - switch (field$) { - case 0: order = (de.trion.microservices.avro.Order)value$; break; - case 1: user = (de.trion.microservices.avro.User)value$; break; - default: throw new org.apache.avro.AvroRuntimeException("Bad index"); - } - } - - /** - * Gets the value of the 'order' field. - * @return The value of the 'order' field. - */ - public de.trion.microservices.avro.Order getOrder() { - return order; - } - - - /** - * Sets the value of the 'order' field. - * @param value the value to set. - */ - public void setOrder(de.trion.microservices.avro.Order value) { - this.order = value; - } - - /** - * Gets the value of the 'user' field. - * @return The value of the 'user' field. - */ - public de.trion.microservices.avro.User getUser() { - return user; - } - - - /** - * Sets the value of the 'user' field. - * @param value the value to set. - */ - public void setUser(de.trion.microservices.avro.User value) { - this.user = value; - } - - /** - * Creates a new OrderAndUser RecordBuilder. - * @return A new OrderAndUser RecordBuilder - */ - public static de.trion.microservices.avro.OrderAndUser.Builder newBuilder() { - return new de.trion.microservices.avro.OrderAndUser.Builder(); - } - - /** - * Creates a new OrderAndUser RecordBuilder by copying an existing Builder. - * @param other The existing builder to copy. - * @return A new OrderAndUser RecordBuilder - */ - public static de.trion.microservices.avro.OrderAndUser.Builder newBuilder(de.trion.microservices.avro.OrderAndUser.Builder other) { - if (other == null) { - return new de.trion.microservices.avro.OrderAndUser.Builder(); - } else { - return new de.trion.microservices.avro.OrderAndUser.Builder(other); - } - } - - /** - * Creates a new OrderAndUser RecordBuilder by copying an existing OrderAndUser instance. - * @param other The existing instance to copy. - * @return A new OrderAndUser RecordBuilder - */ - public static de.trion.microservices.avro.OrderAndUser.Builder newBuilder(de.trion.microservices.avro.OrderAndUser other) { - if (other == null) { - return new de.trion.microservices.avro.OrderAndUser.Builder(); - } else { - return new de.trion.microservices.avro.OrderAndUser.Builder(other); - } - } - - /** - * RecordBuilder for OrderAndUser instances. - */ - public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase - implements org.apache.avro.data.RecordBuilder { - - private de.trion.microservices.avro.Order order; - private de.trion.microservices.avro.Order.Builder orderBuilder; - private de.trion.microservices.avro.User user; - private de.trion.microservices.avro.User.Builder userBuilder; - - /** Creates a new Builder */ - private Builder() { - super(SCHEMA$); - } - - /** - * Creates a Builder by copying an existing Builder. - * @param other The existing Builder to copy. - */ - private Builder(de.trion.microservices.avro.OrderAndUser.Builder other) { - super(other); - if (isValidValue(fields()[0], other.order)) { - this.order = data().deepCopy(fields()[0].schema(), other.order); - fieldSetFlags()[0] = other.fieldSetFlags()[0]; - } - if (other.hasOrderBuilder()) { - this.orderBuilder = de.trion.microservices.avro.Order.newBuilder(other.getOrderBuilder()); - } - if (isValidValue(fields()[1], other.user)) { - this.user = data().deepCopy(fields()[1].schema(), other.user); - fieldSetFlags()[1] = other.fieldSetFlags()[1]; - } - if (other.hasUserBuilder()) { - this.userBuilder = de.trion.microservices.avro.User.newBuilder(other.getUserBuilder()); - } - } - - /** - * Creates a Builder by copying an existing OrderAndUser instance - * @param other The existing instance to copy. - */ - private Builder(de.trion.microservices.avro.OrderAndUser other) { - super(SCHEMA$); - if (isValidValue(fields()[0], other.order)) { - this.order = data().deepCopy(fields()[0].schema(), other.order); - fieldSetFlags()[0] = true; - } - this.orderBuilder = null; - if (isValidValue(fields()[1], other.user)) { - this.user = data().deepCopy(fields()[1].schema(), other.user); - fieldSetFlags()[1] = true; - } - this.userBuilder = null; - } - - /** - * Gets the value of the 'order' field. - * @return The value. - */ - public de.trion.microservices.avro.Order getOrder() { - return order; - } - - - /** - * Sets the value of the 'order' field. - * @param value The value of 'order'. - * @return This builder. - */ - public de.trion.microservices.avro.OrderAndUser.Builder setOrder(de.trion.microservices.avro.Order value) { - validate(fields()[0], value); - this.orderBuilder = null; - this.order = value; - fieldSetFlags()[0] = true; - return this; - } - - /** - * Checks whether the 'order' field has been set. - * @return True if the 'order' field has been set, false otherwise. - */ - public boolean hasOrder() { - return fieldSetFlags()[0]; - } - - /** - * Gets the Builder instance for the 'order' field and creates one if it doesn't exist yet. - * @return This builder. - */ - public de.trion.microservices.avro.Order.Builder getOrderBuilder() { - if (orderBuilder == null) { - if (hasOrder()) { - setOrderBuilder(de.trion.microservices.avro.Order.newBuilder(order)); - } else { - setOrderBuilder(de.trion.microservices.avro.Order.newBuilder()); - } - } - return orderBuilder; - } - - /** - * Sets the Builder instance for the 'order' field - * @param value The builder instance that must be set. - * @return This builder. - */ - public de.trion.microservices.avro.OrderAndUser.Builder setOrderBuilder(de.trion.microservices.avro.Order.Builder value) { - clearOrder(); - orderBuilder = value; - return this; - } - - /** - * Checks whether the 'order' field has an active Builder instance - * @return True if the 'order' field has an active Builder instance - */ - public boolean hasOrderBuilder() { - return orderBuilder != null; - } - - /** - * Clears the value of the 'order' field. - * @return This builder. - */ - public de.trion.microservices.avro.OrderAndUser.Builder clearOrder() { - order = null; - orderBuilder = null; - fieldSetFlags()[0] = false; - return this; - } - - /** - * Gets the value of the 'user' field. - * @return The value. - */ - public de.trion.microservices.avro.User getUser() { - return user; - } - - - /** - * Sets the value of the 'user' field. - * @param value The value of 'user'. - * @return This builder. - */ - public de.trion.microservices.avro.OrderAndUser.Builder setUser(de.trion.microservices.avro.User value) { - validate(fields()[1], value); - this.userBuilder = null; - this.user = value; - fieldSetFlags()[1] = true; - return this; - } - - /** - * Checks whether the 'user' field has been set. - * @return True if the 'user' field has been set, false otherwise. - */ - public boolean hasUser() { - return fieldSetFlags()[1]; - } - - /** - * Gets the Builder instance for the 'user' field and creates one if it doesn't exist yet. - * @return This builder. - */ - public de.trion.microservices.avro.User.Builder getUserBuilder() { - if (userBuilder == null) { - if (hasUser()) { - setUserBuilder(de.trion.microservices.avro.User.newBuilder(user)); - } else { - setUserBuilder(de.trion.microservices.avro.User.newBuilder()); - } - } - return userBuilder; - } - - /** - * Sets the Builder instance for the 'user' field - * @param value The builder instance that must be set. - * @return This builder. - */ - public de.trion.microservices.avro.OrderAndUser.Builder setUserBuilder(de.trion.microservices.avro.User.Builder value) { - clearUser(); - userBuilder = value; - return this; - } - - /** - * Checks whether the 'user' field has an active Builder instance - * @return True if the 'user' field has an active Builder instance - */ - public boolean hasUserBuilder() { - return userBuilder != null; - } - - /** - * Clears the value of the 'user' field. - * @return This builder. - */ - public de.trion.microservices.avro.OrderAndUser.Builder clearUser() { - user = null; - userBuilder = null; - fieldSetFlags()[1] = false; - return this; - } - - @Override - @SuppressWarnings("unchecked") - public OrderAndUser build() { - try { - OrderAndUser record = new OrderAndUser(); - if (orderBuilder != null) { - try { - record.order = this.orderBuilder.build(); - } catch (org.apache.avro.AvroMissingFieldException e) { - e.addParentField(record.getSchema().getField("order")); - throw e; - } - } else { - record.order = fieldSetFlags()[0] ? this.order : (de.trion.microservices.avro.Order) defaultValue(fields()[0]); - } - if (userBuilder != null) { - try { - record.user = this.userBuilder.build(); - } catch (org.apache.avro.AvroMissingFieldException e) { - e.addParentField(record.getSchema().getField("user")); - throw e; - } - } else { - record.user = fieldSetFlags()[1] ? this.user : (de.trion.microservices.avro.User) defaultValue(fields()[1]); - } - 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)); - } - - @Override protected boolean hasCustomCoders() { return true; } - - @Override public void customEncode(org.apache.avro.io.Encoder out) - throws java.io.IOException - { - this.order.customEncode(out); - - if (this.user == null) { - out.writeIndex(0); - out.writeNull(); - } else { - out.writeIndex(1); - this.user.customEncode(out); - } - - } - - @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in) - throws java.io.IOException - { - org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff(); - if (fieldOrder == null) { - if (this.order == null) { - this.order = new de.trion.microservices.avro.Order(); - } - this.order.customDecode(in); - - if (in.readIndex() != 1) { - in.readNull(); - this.user = null; - } else { - if (this.user == null) { - this.user = new de.trion.microservices.avro.User(); - } - this.user.customDecode(in); - } - - } else { - for (int i = 0; i < 2; i++) { - switch (fieldOrder[i].pos()) { - case 0: - if (this.order == null) { - this.order = new de.trion.microservices.avro.Order(); - } - this.order.customDecode(in); - break; - - case 1: - if (in.readIndex() != 1) { - in.readNull(); - this.user = null; - } else { - if (this.user == null) { - this.user = new de.trion.microservices.avro.User(); - } - this.user.customDecode(in); - } - break; - - default: - throw new java.io.IOException("Corrupt ResolvingDecoder."); - } - } - } - } -} - - - - - - - - - - diff --git a/validate-user/src/main/java/de/trion/microservices/avro/OrderState.java b/validate-user/src/main/java/de/trion/microservices/avro/OrderState.java deleted file mode 100644 index e06d650..0000000 --- a/validate-user/src/main/java/de/trion/microservices/avro/OrderState.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Autogenerated by Avro - * - * DO NOT EDIT DIRECTLY - */ -package de.trion.microservices.avro; -@org.apache.avro.specific.AvroGenerated -public enum OrderState implements org.apache.avro.generic.GenericEnumSymbol { - CREATED, APPROVED, DECLINED ; - public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"enum\",\"name\":\"OrderState\",\"namespace\":\"de.trion.microservices.avro\",\"symbols\":[\"CREATED\",\"APPROVED\",\"DECLINED\"],\"default\":\"CREATED\"}"); - public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } - public org.apache.avro.Schema getSchema() { return SCHEMA$; } -} diff --git a/validate-user/src/main/java/de/trion/microservices/avro/OrderValidation.java b/validate-user/src/main/java/de/trion/microservices/avro/OrderValidation.java deleted file mode 100644 index c15f3af..0000000 --- a/validate-user/src/main/java/de/trion/microservices/avro/OrderValidation.java +++ /dev/null @@ -1,587 +0,0 @@ -/** - * Autogenerated by Avro - * - * DO NOT EDIT DIRECTLY - */ -package de.trion.microservices.avro; - -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; - -@org.apache.avro.specific.AvroGenerated -public class OrderValidation extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { - private static final long serialVersionUID = 8233123483892962178L; - public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"OrderValidation\",\"namespace\":\"de.trion.microservices.avro\",\"fields\":[{\"name\":\"orderId\",\"type\":\"string\"},{\"name\":\"checkType\",\"type\":{\"type\":\"enum\",\"name\":\"OrderValidationType\",\"symbols\":[\"ORDER_DETAILS_CHECK\",\"ORDER_USER_CHECK\"]}},{\"name\":\"validationResult\",\"type\":{\"type\":\"enum\",\"name\":\"OrderValidationResult\",\"symbols\":[\"PASS\",\"FAIL\"]}},{\"name\":\"messages\",\"type\":{\"type\":\"array\",\"items\":\"string\"}}]}"); - public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } - - private static SpecificData MODEL$ = new SpecificData(); - - 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 OrderValidation 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 OrderValidation from a ByteBuffer. - * @param b a byte buffer holding serialized data for an instance of this class - * @return a OrderValidation 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 OrderValidation fromByteBuffer( - java.nio.ByteBuffer b) throws java.io.IOException { - return DECODER.decode(b); - } - - @Deprecated public java.lang.CharSequence orderId; - @Deprecated public de.trion.microservices.avro.OrderValidationType checkType; - @Deprecated public de.trion.microservices.avro.OrderValidationResult validationResult; - @Deprecated public java.util.List messages; - - /** - * 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 OrderValidation() {} - - /** - * All-args constructor. - * @param orderId The new value for orderId - * @param checkType The new value for checkType - * @param validationResult The new value for validationResult - * @param messages The new value for messages - */ - public OrderValidation(java.lang.CharSequence orderId, de.trion.microservices.avro.OrderValidationType checkType, de.trion.microservices.avro.OrderValidationResult validationResult, java.util.List messages) { - this.orderId = orderId; - this.checkType = checkType; - this.validationResult = validationResult; - this.messages = messages; - } - - public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; } - public org.apache.avro.Schema getSchema() { return SCHEMA$; } - // Used by DatumWriter. Applications should not call. - public java.lang.Object get(int field$) { - switch (field$) { - case 0: return orderId; - case 1: return checkType; - case 2: return validationResult; - case 3: return messages; - default: throw new org.apache.avro.AvroRuntimeException("Bad index"); - } - } - - // Used by DatumReader. Applications should not call. - @SuppressWarnings(value="unchecked") - public void put(int field$, java.lang.Object value$) { - switch (field$) { - case 0: orderId = (java.lang.CharSequence)value$; break; - case 1: checkType = (de.trion.microservices.avro.OrderValidationType)value$; break; - case 2: validationResult = (de.trion.microservices.avro.OrderValidationResult)value$; break; - case 3: messages = (java.util.List)value$; break; - default: throw new org.apache.avro.AvroRuntimeException("Bad index"); - } - } - - /** - * Gets the value of the 'orderId' field. - * @return The value of the 'orderId' field. - */ - public java.lang.CharSequence getOrderId() { - return orderId; - } - - - /** - * Sets the value of the 'orderId' field. - * @param value the value to set. - */ - public void setOrderId(java.lang.CharSequence value) { - this.orderId = value; - } - - /** - * Gets the value of the 'checkType' field. - * @return The value of the 'checkType' field. - */ - public de.trion.microservices.avro.OrderValidationType getCheckType() { - return checkType; - } - - - /** - * Sets the value of the 'checkType' field. - * @param value the value to set. - */ - public void setCheckType(de.trion.microservices.avro.OrderValidationType value) { - this.checkType = value; - } - - /** - * Gets the value of the 'validationResult' field. - * @return The value of the 'validationResult' field. - */ - public de.trion.microservices.avro.OrderValidationResult getValidationResult() { - return validationResult; - } - - - /** - * Sets the value of the 'validationResult' field. - * @param value the value to set. - */ - public void setValidationResult(de.trion.microservices.avro.OrderValidationResult value) { - this.validationResult = value; - } - - /** - * Gets the value of the 'messages' field. - * @return The value of the 'messages' field. - */ - public java.util.List getMessages() { - return messages; - } - - - /** - * Sets the value of the 'messages' field. - * @param value the value to set. - */ - public void setMessages(java.util.List value) { - this.messages = value; - } - - /** - * Creates a new OrderValidation RecordBuilder. - * @return A new OrderValidation RecordBuilder - */ - public static de.trion.microservices.avro.OrderValidation.Builder newBuilder() { - return new de.trion.microservices.avro.OrderValidation.Builder(); - } - - /** - * Creates a new OrderValidation RecordBuilder by copying an existing Builder. - * @param other The existing builder to copy. - * @return A new OrderValidation RecordBuilder - */ - public static de.trion.microservices.avro.OrderValidation.Builder newBuilder(de.trion.microservices.avro.OrderValidation.Builder other) { - if (other == null) { - return new de.trion.microservices.avro.OrderValidation.Builder(); - } else { - return new de.trion.microservices.avro.OrderValidation.Builder(other); - } - } - - /** - * Creates a new OrderValidation RecordBuilder by copying an existing OrderValidation instance. - * @param other The existing instance to copy. - * @return A new OrderValidation RecordBuilder - */ - public static de.trion.microservices.avro.OrderValidation.Builder newBuilder(de.trion.microservices.avro.OrderValidation other) { - if (other == null) { - return new de.trion.microservices.avro.OrderValidation.Builder(); - } else { - return new de.trion.microservices.avro.OrderValidation.Builder(other); - } - } - - /** - * RecordBuilder for OrderValidation instances. - */ - public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase - implements org.apache.avro.data.RecordBuilder { - - private java.lang.CharSequence orderId; - private de.trion.microservices.avro.OrderValidationType checkType; - private de.trion.microservices.avro.OrderValidationResult validationResult; - private java.util.List messages; - - /** Creates a new Builder */ - private Builder() { - super(SCHEMA$); - } - - /** - * Creates a Builder by copying an existing Builder. - * @param other The existing Builder to copy. - */ - private Builder(de.trion.microservices.avro.OrderValidation.Builder other) { - super(other); - if (isValidValue(fields()[0], other.orderId)) { - this.orderId = data().deepCopy(fields()[0].schema(), other.orderId); - fieldSetFlags()[0] = other.fieldSetFlags()[0]; - } - if (isValidValue(fields()[1], other.checkType)) { - this.checkType = data().deepCopy(fields()[1].schema(), other.checkType); - fieldSetFlags()[1] = other.fieldSetFlags()[1]; - } - if (isValidValue(fields()[2], other.validationResult)) { - this.validationResult = data().deepCopy(fields()[2].schema(), other.validationResult); - fieldSetFlags()[2] = other.fieldSetFlags()[2]; - } - if (isValidValue(fields()[3], other.messages)) { - this.messages = data().deepCopy(fields()[3].schema(), other.messages); - fieldSetFlags()[3] = other.fieldSetFlags()[3]; - } - } - - /** - * Creates a Builder by copying an existing OrderValidation instance - * @param other The existing instance to copy. - */ - private Builder(de.trion.microservices.avro.OrderValidation other) { - super(SCHEMA$); - if (isValidValue(fields()[0], other.orderId)) { - this.orderId = data().deepCopy(fields()[0].schema(), other.orderId); - fieldSetFlags()[0] = true; - } - if (isValidValue(fields()[1], other.checkType)) { - this.checkType = data().deepCopy(fields()[1].schema(), other.checkType); - fieldSetFlags()[1] = true; - } - if (isValidValue(fields()[2], other.validationResult)) { - this.validationResult = data().deepCopy(fields()[2].schema(), other.validationResult); - fieldSetFlags()[2] = true; - } - if (isValidValue(fields()[3], other.messages)) { - this.messages = data().deepCopy(fields()[3].schema(), other.messages); - fieldSetFlags()[3] = true; - } - } - - /** - * Gets the value of the 'orderId' field. - * @return The value. - */ - public java.lang.CharSequence getOrderId() { - return orderId; - } - - - /** - * Sets the value of the 'orderId' field. - * @param value The value of 'orderId'. - * @return This builder. - */ - public de.trion.microservices.avro.OrderValidation.Builder setOrderId(java.lang.CharSequence value) { - validate(fields()[0], value); - this.orderId = value; - fieldSetFlags()[0] = true; - return this; - } - - /** - * Checks whether the 'orderId' field has been set. - * @return True if the 'orderId' field has been set, false otherwise. - */ - public boolean hasOrderId() { - return fieldSetFlags()[0]; - } - - - /** - * Clears the value of the 'orderId' field. - * @return This builder. - */ - public de.trion.microservices.avro.OrderValidation.Builder clearOrderId() { - orderId = null; - fieldSetFlags()[0] = false; - return this; - } - - /** - * Gets the value of the 'checkType' field. - * @return The value. - */ - public de.trion.microservices.avro.OrderValidationType getCheckType() { - return checkType; - } - - - /** - * Sets the value of the 'checkType' field. - * @param value The value of 'checkType'. - * @return This builder. - */ - public de.trion.microservices.avro.OrderValidation.Builder setCheckType(de.trion.microservices.avro.OrderValidationType value) { - validate(fields()[1], value); - this.checkType = value; - fieldSetFlags()[1] = true; - return this; - } - - /** - * Checks whether the 'checkType' field has been set. - * @return True if the 'checkType' field has been set, false otherwise. - */ - public boolean hasCheckType() { - return fieldSetFlags()[1]; - } - - - /** - * Clears the value of the 'checkType' field. - * @return This builder. - */ - public de.trion.microservices.avro.OrderValidation.Builder clearCheckType() { - checkType = null; - fieldSetFlags()[1] = false; - return this; - } - - /** - * Gets the value of the 'validationResult' field. - * @return The value. - */ - public de.trion.microservices.avro.OrderValidationResult getValidationResult() { - return validationResult; - } - - - /** - * Sets the value of the 'validationResult' field. - * @param value The value of 'validationResult'. - * @return This builder. - */ - public de.trion.microservices.avro.OrderValidation.Builder setValidationResult(de.trion.microservices.avro.OrderValidationResult value) { - validate(fields()[2], value); - this.validationResult = value; - fieldSetFlags()[2] = true; - return this; - } - - /** - * Checks whether the 'validationResult' field has been set. - * @return True if the 'validationResult' field has been set, false otherwise. - */ - public boolean hasValidationResult() { - return fieldSetFlags()[2]; - } - - - /** - * Clears the value of the 'validationResult' field. - * @return This builder. - */ - public de.trion.microservices.avro.OrderValidation.Builder clearValidationResult() { - validationResult = null; - fieldSetFlags()[2] = false; - return this; - } - - /** - * Gets the value of the 'messages' field. - * @return The value. - */ - public java.util.List getMessages() { - return messages; - } - - - /** - * Sets the value of the 'messages' field. - * @param value The value of 'messages'. - * @return This builder. - */ - public de.trion.microservices.avro.OrderValidation.Builder setMessages(java.util.List value) { - validate(fields()[3], value); - this.messages = value; - fieldSetFlags()[3] = true; - return this; - } - - /** - * Checks whether the 'messages' field has been set. - * @return True if the 'messages' field has been set, false otherwise. - */ - public boolean hasMessages() { - return fieldSetFlags()[3]; - } - - - /** - * Clears the value of the 'messages' field. - * @return This builder. - */ - public de.trion.microservices.avro.OrderValidation.Builder clearMessages() { - messages = null; - fieldSetFlags()[3] = false; - return this; - } - - @Override - @SuppressWarnings("unchecked") - public OrderValidation build() { - try { - OrderValidation record = new OrderValidation(); - record.orderId = fieldSetFlags()[0] ? this.orderId : (java.lang.CharSequence) defaultValue(fields()[0]); - record.checkType = fieldSetFlags()[1] ? this.checkType : (de.trion.microservices.avro.OrderValidationType) defaultValue(fields()[1]); - record.validationResult = fieldSetFlags()[2] ? this.validationResult : (de.trion.microservices.avro.OrderValidationResult) defaultValue(fields()[2]); - record.messages = fieldSetFlags()[3] ? this.messages : (java.util.List) defaultValue(fields()[3]); - 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)); - } - - @Override protected boolean hasCustomCoders() { return true; } - - @Override public void customEncode(org.apache.avro.io.Encoder out) - throws java.io.IOException - { - out.writeString(this.orderId); - - out.writeEnum(this.checkType.ordinal()); - - out.writeEnum(this.validationResult.ordinal()); - - long size0 = this.messages.size(); - out.writeArrayStart(); - out.setItemCount(size0); - long actualSize0 = 0; - for (java.lang.CharSequence e0: this.messages) { - actualSize0++; - out.startItem(); - out.writeString(e0); - } - out.writeArrayEnd(); - if (actualSize0 != size0) - throw new java.util.ConcurrentModificationException("Array-size written was " + size0 + ", but element count was " + actualSize0 + "."); - - } - - @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in) - throws java.io.IOException - { - org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff(); - if (fieldOrder == null) { - this.orderId = in.readString(this.orderId instanceof Utf8 ? (Utf8)this.orderId : null); - - this.checkType = de.trion.microservices.avro.OrderValidationType.values()[in.readEnum()]; - - this.validationResult = de.trion.microservices.avro.OrderValidationResult.values()[in.readEnum()]; - - long size0 = in.readArrayStart(); - java.util.List a0 = this.messages; - if (a0 == null) { - a0 = new SpecificData.Array((int)size0, SCHEMA$.getField("messages").schema()); - this.messages = a0; - } else a0.clear(); - SpecificData.Array ga0 = (a0 instanceof SpecificData.Array ? (SpecificData.Array)a0 : null); - for ( ; 0 < size0; size0 = in.arrayNext()) { - for ( ; size0 != 0; size0--) { - java.lang.CharSequence e0 = (ga0 != null ? ga0.peek() : null); - e0 = in.readString(e0 instanceof Utf8 ? (Utf8)e0 : null); - a0.add(e0); - } - } - - } else { - for (int i = 0; i < 4; i++) { - switch (fieldOrder[i].pos()) { - case 0: - this.orderId = in.readString(this.orderId instanceof Utf8 ? (Utf8)this.orderId : null); - break; - - case 1: - this.checkType = de.trion.microservices.avro.OrderValidationType.values()[in.readEnum()]; - break; - - case 2: - this.validationResult = de.trion.microservices.avro.OrderValidationResult.values()[in.readEnum()]; - break; - - case 3: - long size0 = in.readArrayStart(); - java.util.List a0 = this.messages; - if (a0 == null) { - a0 = new SpecificData.Array((int)size0, SCHEMA$.getField("messages").schema()); - this.messages = a0; - } else a0.clear(); - SpecificData.Array ga0 = (a0 instanceof SpecificData.Array ? (SpecificData.Array)a0 : null); - for ( ; 0 < size0; size0 = in.arrayNext()) { - for ( ; size0 != 0; size0--) { - java.lang.CharSequence e0 = (ga0 != null ? ga0.peek() : null); - e0 = in.readString(e0 instanceof Utf8 ? (Utf8)e0 : null); - a0.add(e0); - } - } - break; - - default: - throw new java.io.IOException("Corrupt ResolvingDecoder."); - } - } - } - } -} - - - - - - - - - - diff --git a/validate-user/src/main/java/de/trion/microservices/avro/OrderValidationResult.java b/validate-user/src/main/java/de/trion/microservices/avro/OrderValidationResult.java deleted file mode 100644 index 879e136..0000000 --- a/validate-user/src/main/java/de/trion/microservices/avro/OrderValidationResult.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Autogenerated by Avro - * - * DO NOT EDIT DIRECTLY - */ -package de.trion.microservices.avro; -@org.apache.avro.specific.AvroGenerated -public enum OrderValidationResult implements org.apache.avro.generic.GenericEnumSymbol { - PASS, FAIL ; - public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"enum\",\"name\":\"OrderValidationResult\",\"namespace\":\"de.trion.microservices.avro\",\"symbols\":[\"PASS\",\"FAIL\"]}"); - public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } - public org.apache.avro.Schema getSchema() { return SCHEMA$; } -} diff --git a/validate-user/src/main/java/de/trion/microservices/avro/OrderValidationType.java b/validate-user/src/main/java/de/trion/microservices/avro/OrderValidationType.java deleted file mode 100644 index cdd7147..0000000 --- a/validate-user/src/main/java/de/trion/microservices/avro/OrderValidationType.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Autogenerated by Avro - * - * DO NOT EDIT DIRECTLY - */ -package de.trion.microservices.avro; -@org.apache.avro.specific.AvroGenerated -public enum OrderValidationType implements org.apache.avro.generic.GenericEnumSymbol { - ORDER_DETAILS_CHECK, ORDER_USER_CHECK ; - public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"enum\",\"name\":\"OrderValidationType\",\"namespace\":\"de.trion.microservices.avro\",\"symbols\":[\"ORDER_DETAILS_CHECK\",\"ORDER_USER_CHECK\"]}"); - public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } - public org.apache.avro.Schema getSchema() { return SCHEMA$; } -} diff --git a/validate-user/src/main/java/de/trion/microservices/avro/User.java b/validate-user/src/main/java/de/trion/microservices/avro/User.java deleted file mode 100644 index c745e7a..0000000 --- a/validate-user/src/main/java/de/trion/microservices/avro/User.java +++ /dev/null @@ -1,469 +0,0 @@ -/** - * Autogenerated by Avro - * - * DO NOT EDIT DIRECTLY - */ -package de.trion.microservices.avro; - -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; - -@org.apache.avro.specific.AvroGenerated -public class User extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { - private static final long serialVersionUID = 2154150202977610190L; - public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"User\",\"namespace\":\"de.trion.microservices.avro\",\"fields\":[{\"name\":\"id\",\"type\":\"long\"},{\"name\":\"level\",\"type\":{\"type\":\"enum\",\"name\":\"CustomerLevel\",\"symbols\":[\"BRONZE\",\"SILVER\",\"GOLD\",\"UNWANTED\"]}},{\"name\":\"name\",\"type\":\"string\"}]}"); - public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } - - private static SpecificData MODEL$ = new SpecificData(); - - 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 User 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 User from a ByteBuffer. - * @param b a byte buffer holding serialized data for an instance of this class - * @return a User 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 User fromByteBuffer( - java.nio.ByteBuffer b) throws java.io.IOException { - return DECODER.decode(b); - } - - @Deprecated public long id; - @Deprecated public de.trion.microservices.avro.CustomerLevel level; - @Deprecated public java.lang.CharSequence name; - - /** - * 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 User() {} - - /** - * All-args constructor. - * @param id The new value for id - * @param level The new value for level - * @param name The new value for name - */ - public User(java.lang.Long id, de.trion.microservices.avro.CustomerLevel level, java.lang.CharSequence name) { - this.id = id; - this.level = level; - this.name = name; - } - - public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; } - public org.apache.avro.Schema getSchema() { return SCHEMA$; } - // Used by DatumWriter. Applications should not call. - public java.lang.Object get(int field$) { - switch (field$) { - case 0: return id; - case 1: return level; - case 2: return name; - default: throw new org.apache.avro.AvroRuntimeException("Bad index"); - } - } - - // Used by DatumReader. Applications should not call. - @SuppressWarnings(value="unchecked") - public void put(int field$, java.lang.Object value$) { - switch (field$) { - case 0: id = (java.lang.Long)value$; break; - case 1: level = (de.trion.microservices.avro.CustomerLevel)value$; break; - case 2: name = (java.lang.CharSequence)value$; break; - default: throw new org.apache.avro.AvroRuntimeException("Bad index"); - } - } - - /** - * Gets the value of the 'id' field. - * @return The value of the 'id' field. - */ - public long getId() { - return id; - } - - - /** - * Sets the value of the 'id' field. - * @param value the value to set. - */ - public void setId(long value) { - this.id = value; - } - - /** - * Gets the value of the 'level' field. - * @return The value of the 'level' field. - */ - public de.trion.microservices.avro.CustomerLevel getLevel() { - return level; - } - - - /** - * Sets the value of the 'level' field. - * @param value the value to set. - */ - public void setLevel(de.trion.microservices.avro.CustomerLevel value) { - this.level = value; - } - - /** - * Gets the value of the 'name' field. - * @return The value of the 'name' field. - */ - public java.lang.CharSequence getName() { - return name; - } - - - /** - * Sets the value of the 'name' field. - * @param value the value to set. - */ - public void setName(java.lang.CharSequence value) { - this.name = value; - } - - /** - * Creates a new User RecordBuilder. - * @return A new User RecordBuilder - */ - public static de.trion.microservices.avro.User.Builder newBuilder() { - return new de.trion.microservices.avro.User.Builder(); - } - - /** - * Creates a new User RecordBuilder by copying an existing Builder. - * @param other The existing builder to copy. - * @return A new User RecordBuilder - */ - public static de.trion.microservices.avro.User.Builder newBuilder(de.trion.microservices.avro.User.Builder other) { - if (other == null) { - return new de.trion.microservices.avro.User.Builder(); - } else { - return new de.trion.microservices.avro.User.Builder(other); - } - } - - /** - * Creates a new User RecordBuilder by copying an existing User instance. - * @param other The existing instance to copy. - * @return A new User RecordBuilder - */ - public static de.trion.microservices.avro.User.Builder newBuilder(de.trion.microservices.avro.User other) { - if (other == null) { - return new de.trion.microservices.avro.User.Builder(); - } else { - return new de.trion.microservices.avro.User.Builder(other); - } - } - - /** - * RecordBuilder for User instances. - */ - public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase - implements org.apache.avro.data.RecordBuilder { - - private long id; - private de.trion.microservices.avro.CustomerLevel level; - private java.lang.CharSequence name; - - /** Creates a new Builder */ - private Builder() { - super(SCHEMA$); - } - - /** - * Creates a Builder by copying an existing Builder. - * @param other The existing Builder to copy. - */ - private Builder(de.trion.microservices.avro.User.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.level)) { - this.level = data().deepCopy(fields()[1].schema(), other.level); - fieldSetFlags()[1] = other.fieldSetFlags()[1]; - } - if (isValidValue(fields()[2], other.name)) { - this.name = data().deepCopy(fields()[2].schema(), other.name); - fieldSetFlags()[2] = other.fieldSetFlags()[2]; - } - } - - /** - * Creates a Builder by copying an existing User instance - * @param other The existing instance to copy. - */ - private Builder(de.trion.microservices.avro.User other) { - super(SCHEMA$); - if (isValidValue(fields()[0], other.id)) { - this.id = data().deepCopy(fields()[0].schema(), other.id); - fieldSetFlags()[0] = true; - } - if (isValidValue(fields()[1], other.level)) { - this.level = data().deepCopy(fields()[1].schema(), other.level); - fieldSetFlags()[1] = true; - } - if (isValidValue(fields()[2], other.name)) { - this.name = data().deepCopy(fields()[2].schema(), other.name); - fieldSetFlags()[2] = true; - } - } - - /** - * Gets the value of the 'id' field. - * @return The value. - */ - public long getId() { - return id; - } - - - /** - * Sets the value of the 'id' field. - * @param value The value of 'id'. - * @return This builder. - */ - public de.trion.microservices.avro.User.Builder setId(long value) { - validate(fields()[0], value); - this.id = value; - fieldSetFlags()[0] = true; - return this; - } - - /** - * Checks whether the 'id' field has been set. - * @return True if the 'id' field has been set, false otherwise. - */ - public boolean hasId() { - return fieldSetFlags()[0]; - } - - - /** - * Clears the value of the 'id' field. - * @return This builder. - */ - public de.trion.microservices.avro.User.Builder clearId() { - fieldSetFlags()[0] = false; - return this; - } - - /** - * Gets the value of the 'level' field. - * @return The value. - */ - public de.trion.microservices.avro.CustomerLevel getLevel() { - return level; - } - - - /** - * Sets the value of the 'level' field. - * @param value The value of 'level'. - * @return This builder. - */ - public de.trion.microservices.avro.User.Builder setLevel(de.trion.microservices.avro.CustomerLevel value) { - validate(fields()[1], value); - this.level = value; - fieldSetFlags()[1] = true; - return this; - } - - /** - * Checks whether the 'level' field has been set. - * @return True if the 'level' field has been set, false otherwise. - */ - public boolean hasLevel() { - return fieldSetFlags()[1]; - } - - - /** - * Clears the value of the 'level' field. - * @return This builder. - */ - public de.trion.microservices.avro.User.Builder clearLevel() { - level = null; - fieldSetFlags()[1] = false; - return this; - } - - /** - * Gets the value of the 'name' field. - * @return The value. - */ - public java.lang.CharSequence getName() { - return name; - } - - - /** - * Sets the value of the 'name' field. - * @param value The value of 'name'. - * @return This builder. - */ - public de.trion.microservices.avro.User.Builder setName(java.lang.CharSequence value) { - validate(fields()[2], value); - this.name = value; - fieldSetFlags()[2] = true; - return this; - } - - /** - * Checks whether the 'name' field has been set. - * @return True if the 'name' field has been set, false otherwise. - */ - public boolean hasName() { - return fieldSetFlags()[2]; - } - - - /** - * Clears the value of the 'name' field. - * @return This builder. - */ - public de.trion.microservices.avro.User.Builder clearName() { - name = null; - fieldSetFlags()[2] = false; - return this; - } - - @Override - @SuppressWarnings("unchecked") - public User build() { - try { - User record = new User(); - record.id = fieldSetFlags()[0] ? this.id : (java.lang.Long) defaultValue(fields()[0]); - record.level = fieldSetFlags()[1] ? this.level : (de.trion.microservices.avro.CustomerLevel) defaultValue(fields()[1]); - record.name = fieldSetFlags()[2] ? this.name : (java.lang.CharSequence) defaultValue(fields()[2]); - 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)); - } - - @Override protected boolean hasCustomCoders() { return true; } - - @Override public void customEncode(org.apache.avro.io.Encoder out) - throws java.io.IOException - { - out.writeLong(this.id); - - out.writeEnum(this.level.ordinal()); - - out.writeString(this.name); - - } - - @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in) - throws java.io.IOException - { - org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff(); - if (fieldOrder == null) { - this.id = in.readLong(); - - this.level = de.trion.microservices.avro.CustomerLevel.values()[in.readEnum()]; - - this.name = in.readString(this.name instanceof Utf8 ? (Utf8)this.name : null); - - } else { - for (int i = 0; i < 3; i++) { - switch (fieldOrder[i].pos()) { - case 0: - this.id = in.readLong(); - break; - - case 1: - this.level = de.trion.microservices.avro.CustomerLevel.values()[in.readEnum()]; - break; - - case 2: - this.name = in.readString(this.name instanceof Utf8 ? (Utf8)this.name : null); - break; - - default: - throw new java.io.IOException("Corrupt ResolvingDecoder."); - } - } - } - } -} - - - - - - - - - - diff --git a/validate-user/src/main/java/de/trion/microservices/validateuser/ApplicationProperties.java b/validate-user/src/main/java/de/trion/microservices/validateuser/ApplicationProperties.java index c632eef..8c1792c 100644 --- a/validate-user/src/main/java/de/trion/microservices/validateuser/ApplicationProperties.java +++ b/validate-user/src/main/java/de/trion/microservices/validateuser/ApplicationProperties.java @@ -4,7 +4,7 @@ package de.trion.microservices.validateorder; import org.springframework.boot.context.properties.ConfigurationProperties; -@ConfigurationProperties("take-order") +@ConfigurationProperties("validate-user") public class ApplicationProperties { String bootstrapServers = "kafka:9092";