org.jlab.jaws.entity.EffectiveRegistration Maven / Gradle / Ivy
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package org.jlab.jaws.entity;
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;
/** Processed registration (instance + class) */
@org.apache.avro.specific.AvroGenerated
public class EffectiveRegistration extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
private static final long serialVersionUID = -3586780451456546917L;
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"EffectiveRegistration\",\"namespace\":\"org.jlab.jaws.entity\",\"doc\":\"Processed registration (instance + class)\",\"fields\":[{\"name\":\"instance\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"AlarmInstance\",\"doc\":\"Instance of an alarm class\",\"fields\":[{\"name\":\"alarmclass\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"The alarm class; provides inheritable shared values\",\"default\":\"base\"},{\"name\":\"device\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"The name of the associated device\"},{\"name\":\"source\",\"type\":[{\"type\":\"record\",\"name\":\"Source\",\"doc\":\"Base registration with no specific source info\",\"fields\":[]},{\"type\":\"record\",\"name\":\"EPICSSource\",\"doc\":\"EPICS source registration\",\"fields\":[{\"name\":\"pv\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"The name of the EPICS CA PV\"}]},{\"type\":\"record\",\"name\":\"CALCSource\",\"doc\":\"CALC Expression Alarm Generator source registration\",\"fields\":[{\"name\":\"expression\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"The CALC expression used to generate alarms\"}]}],\"doc\":\"Provides source specific information via a union.\"},{\"name\":\"location\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":[]},\"doc\":\"The locations associated with the alarm\"},{\"name\":\"maskedby\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"The name of the parent alarm, which if active, masks this alarm (flood suppression via logical hierarchy)\"},{\"name\":\"screencommand\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}],\"doc\":\"The command to open the related control system screen\"}]}],\"doc\":\"The alarm instance\",\"default\":null},{\"name\":\"class\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"AlarmClass\",\"doc\":\"An alarm class\",\"fields\":[{\"name\":\"category\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"The alarm category\"},{\"name\":\"priority\",\"type\":{\"type\":\"enum\",\"name\":\"AlarmPriority\",\"doc\":\"Enumeration of possible priorities; useful for operators to know which alarms to handle first\",\"symbols\":[\"P1_CRITICAL\",\"P2_MAJOR\",\"P3_MINOR\",\"P4_INCIDENTAL\"]},\"doc\":\"The alarm priority\"},{\"name\":\"rationale\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Markdown formatted text describing the reason this alarm is necessary\"},{\"name\":\"correctiveaction\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Markdown formatted text describing the corrective action to take when the alarm becomes active\"},{\"name\":\"pointofcontactusername\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Username (identifier) of point of contact. Full contact info should be obtained from user database (LDAP for example)\"},{\"name\":\"latchable\",\"type\":\"boolean\",\"doc\":\"Indicates whether this alarm latches when activated and can only be cleared after an explicit acknowledgement\",\"default\":false},{\"name\":\"filterable\",\"type\":\"boolean\",\"doc\":\"Indicates whether this alarm can be filtered out of view (typically done when a portion of the machine is turned off). Some alarms must always be monitored, regardless of program.\",\"default\":true},{\"name\":\"ondelayseconds\",\"type\":[\"null\",\"long\"],\"doc\":\"The number of seconds of on-delay\"},{\"name\":\"offdelayseconds\",\"type\":[\"null\",\"long\"],\"doc\":\"The number of seconds of off-delay\"}]}],\"doc\":\"The alarm class\",\"default\":null}]}");
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
private static final 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 EffectiveRegistration 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 EffectiveRegistration from a ByteBuffer.
* @param b a byte buffer holding serialized data for an instance of this class
* @return a EffectiveRegistration 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 EffectiveRegistration fromByteBuffer(
java.nio.ByteBuffer b) throws java.io.IOException {
return DECODER.decode(b);
}
/** The alarm instance */
private org.jlab.jaws.entity.AlarmInstance instance;
/** The alarm class */
private org.jlab.jaws.entity.AlarmClass class$;
/**
* 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 EffectiveRegistration() {}
/**
* All-args constructor.
* @param instance The alarm instance
* @param class$ The alarm class
*/
public EffectiveRegistration(org.jlab.jaws.entity.AlarmInstance instance, org.jlab.jaws.entity.AlarmClass class$) {
this.instance = instance;
this.class$ = class$;
}
@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 instance;
case 1: return class$;
default: throw new IndexOutOfBoundsException("Invalid index: " + 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: instance = (org.jlab.jaws.entity.AlarmInstance)value$; break;
case 1: class$ = (org.jlab.jaws.entity.AlarmClass)value$; break;
default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
}
}
/**
* Gets the value of the 'instance' field.
* @return The alarm instance
*/
public org.jlab.jaws.entity.AlarmInstance getInstance() {
return instance;
}
/**
* Sets the value of the 'instance' field.
* The alarm instance
* @param value the value to set.
*/
public void setInstance(org.jlab.jaws.entity.AlarmInstance value) {
this.instance = value;
}
/**
* Gets the value of the 'class$' field.
* @return The alarm class
*/
public org.jlab.jaws.entity.AlarmClass getClass$() {
return class$;
}
/**
* Sets the value of the 'class$' field.
* The alarm class
* @param value the value to set.
*/
public void setClass$(org.jlab.jaws.entity.AlarmClass value) {
this.class$ = value;
}
/**
* Creates a new EffectiveRegistration RecordBuilder.
* @return A new EffectiveRegistration RecordBuilder
*/
public static org.jlab.jaws.entity.EffectiveRegistration.Builder newBuilder() {
return new org.jlab.jaws.entity.EffectiveRegistration.Builder();
}
/**
* Creates a new EffectiveRegistration RecordBuilder by copying an existing Builder.
* @param other The existing builder to copy.
* @return A new EffectiveRegistration RecordBuilder
*/
public static org.jlab.jaws.entity.EffectiveRegistration.Builder newBuilder(org.jlab.jaws.entity.EffectiveRegistration.Builder other) {
if (other == null) {
return new org.jlab.jaws.entity.EffectiveRegistration.Builder();
} else {
return new org.jlab.jaws.entity.EffectiveRegistration.Builder(other);
}
}
/**
* Creates a new EffectiveRegistration RecordBuilder by copying an existing EffectiveRegistration instance.
* @param other The existing instance to copy.
* @return A new EffectiveRegistration RecordBuilder
*/
public static org.jlab.jaws.entity.EffectiveRegistration.Builder newBuilder(org.jlab.jaws.entity.EffectiveRegistration other) {
if (other == null) {
return new org.jlab.jaws.entity.EffectiveRegistration.Builder();
} else {
return new org.jlab.jaws.entity.EffectiveRegistration.Builder(other);
}
}
/**
* RecordBuilder for EffectiveRegistration instances.
*/
@org.apache.avro.specific.AvroGenerated
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
implements org.apache.avro.data.RecordBuilder {
/** The alarm instance */
private org.jlab.jaws.entity.AlarmInstance instance;
private org.jlab.jaws.entity.AlarmInstance.Builder instanceBuilder;
/** The alarm class */
private org.jlab.jaws.entity.AlarmClass class$;
private org.jlab.jaws.entity.AlarmClass.Builder class$Builder;
/** 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(org.jlab.jaws.entity.EffectiveRegistration.Builder other) {
super(other);
if (isValidValue(fields()[0], other.instance)) {
this.instance = data().deepCopy(fields()[0].schema(), other.instance);
fieldSetFlags()[0] = other.fieldSetFlags()[0];
}
if (other.hasInstanceBuilder()) {
this.instanceBuilder = org.jlab.jaws.entity.AlarmInstance.newBuilder(other.getInstanceBuilder());
}
if (isValidValue(fields()[1], other.class$)) {
this.class$ = data().deepCopy(fields()[1].schema(), other.class$);
fieldSetFlags()[1] = other.fieldSetFlags()[1];
}
if (other.hasClass$Builder()) {
this.class$Builder = org.jlab.jaws.entity.AlarmClass.newBuilder(other.getClass$Builder());
}
}
/**
* Creates a Builder by copying an existing EffectiveRegistration instance
* @param other The existing instance to copy.
*/
private Builder(org.jlab.jaws.entity.EffectiveRegistration other) {
super(SCHEMA$, MODEL$);
if (isValidValue(fields()[0], other.instance)) {
this.instance = data().deepCopy(fields()[0].schema(), other.instance);
fieldSetFlags()[0] = true;
}
this.instanceBuilder = null;
if (isValidValue(fields()[1], other.class$)) {
this.class$ = data().deepCopy(fields()[1].schema(), other.class$);
fieldSetFlags()[1] = true;
}
this.class$Builder = null;
}
/**
* Gets the value of the 'instance' field.
* The alarm instance
* @return The value.
*/
public org.jlab.jaws.entity.AlarmInstance getInstance() {
return instance;
}
/**
* Sets the value of the 'instance' field.
* The alarm instance
* @param value The value of 'instance'.
* @return This builder.
*/
public org.jlab.jaws.entity.EffectiveRegistration.Builder setInstance(org.jlab.jaws.entity.AlarmInstance value) {
validate(fields()[0], value);
this.instanceBuilder = null;
this.instance = value;
fieldSetFlags()[0] = true;
return this;
}
/**
* Checks whether the 'instance' field has been set.
* The alarm instance
* @return True if the 'instance' field has been set, false otherwise.
*/
public boolean hasInstance() {
return fieldSetFlags()[0];
}
/**
* Gets the Builder instance for the 'instance' field and creates one if it doesn't exist yet.
* The alarm instance
* @return This builder.
*/
public org.jlab.jaws.entity.AlarmInstance.Builder getInstanceBuilder() {
if (instanceBuilder == null) {
if (hasInstance()) {
setInstanceBuilder(org.jlab.jaws.entity.AlarmInstance.newBuilder(instance));
} else {
setInstanceBuilder(org.jlab.jaws.entity.AlarmInstance.newBuilder());
}
}
return instanceBuilder;
}
/**
* Sets the Builder instance for the 'instance' field
* The alarm instance
* @param value The builder instance that must be set.
* @return This builder.
*/
public org.jlab.jaws.entity.EffectiveRegistration.Builder setInstanceBuilder(org.jlab.jaws.entity.AlarmInstance.Builder value) {
clearInstance();
instanceBuilder = value;
return this;
}
/**
* Checks whether the 'instance' field has an active Builder instance
* The alarm instance
* @return True if the 'instance' field has an active Builder instance
*/
public boolean hasInstanceBuilder() {
return instanceBuilder != null;
}
/**
* Clears the value of the 'instance' field.
* The alarm instance
* @return This builder.
*/
public org.jlab.jaws.entity.EffectiveRegistration.Builder clearInstance() {
instance = null;
instanceBuilder = null;
fieldSetFlags()[0] = false;
return this;
}
/**
* Gets the value of the 'class$' field.
* The alarm class
* @return The value.
*/
public org.jlab.jaws.entity.AlarmClass getClass$() {
return class$;
}
/**
* Sets the value of the 'class$' field.
* The alarm class
* @param value The value of 'class$'.
* @return This builder.
*/
public org.jlab.jaws.entity.EffectiveRegistration.Builder setClass$(org.jlab.jaws.entity.AlarmClass value) {
validate(fields()[1], value);
this.class$Builder = null;
this.class$ = value;
fieldSetFlags()[1] = true;
return this;
}
/**
* Checks whether the 'class$' field has been set.
* The alarm class
* @return True if the 'class$' field has been set, false otherwise.
*/
public boolean hasClass$() {
return fieldSetFlags()[1];
}
/**
* Gets the Builder instance for the 'class$' field and creates one if it doesn't exist yet.
* The alarm class
* @return This builder.
*/
public org.jlab.jaws.entity.AlarmClass.Builder getClass$Builder() {
if (class$Builder == null) {
if (hasClass$()) {
setClass$Builder(org.jlab.jaws.entity.AlarmClass.newBuilder(class$));
} else {
setClass$Builder(org.jlab.jaws.entity.AlarmClass.newBuilder());
}
}
return class$Builder;
}
/**
* Sets the Builder instance for the 'class$' field
* The alarm class
* @param value The builder instance that must be set.
* @return This builder.
*/
public org.jlab.jaws.entity.EffectiveRegistration.Builder setClass$Builder(org.jlab.jaws.entity.AlarmClass.Builder value) {
clearClass$();
class$Builder = value;
return this;
}
/**
* Checks whether the 'class$' field has an active Builder instance
* The alarm class
* @return True if the 'class$' field has an active Builder instance
*/
public boolean hasClass$Builder() {
return class$Builder != null;
}
/**
* Clears the value of the 'class$' field.
* The alarm class
* @return This builder.
*/
public org.jlab.jaws.entity.EffectiveRegistration.Builder clearClass$() {
class$ = null;
class$Builder = null;
fieldSetFlags()[1] = false;
return this;
}
@Override
@SuppressWarnings("unchecked")
public EffectiveRegistration build() {
try {
EffectiveRegistration record = new EffectiveRegistration();
if (instanceBuilder != null) {
try {
record.instance = this.instanceBuilder.build();
} catch (org.apache.avro.AvroMissingFieldException e) {
e.addParentField(record.getSchema().getField("instance"));
throw e;
}
} else {
record.instance = fieldSetFlags()[0] ? this.instance : (org.jlab.jaws.entity.AlarmInstance) defaultValue(fields()[0]);
}
if (class$Builder != null) {
try {
record.class$ = this.class$Builder.build();
} catch (org.apache.avro.AvroMissingFieldException e) {
e.addParentField(record.getSchema().getField("class$"));
throw e;
}
} else {
record.class$ = fieldSetFlags()[1] ? this.class$ : (org.jlab.jaws.entity.AlarmClass) 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));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy