From e48a7c0c45cf002e8865dc316766dd9074790d90 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 23 Nov 2018 15:06:52 +0100 Subject: [thrift] Sat interface for getting predefined shares/filters --- .../openslx/bwlp/thrift/iface/PredefinedData.java | 611 +++++++++++++++++++++ 1 file changed, 611 insertions(+) create mode 100644 src/main/java/org/openslx/bwlp/thrift/iface/PredefinedData.java (limited to 'src/main/java/org/openslx/bwlp/thrift/iface/PredefinedData.java') diff --git a/src/main/java/org/openslx/bwlp/thrift/iface/PredefinedData.java b/src/main/java/org/openslx/bwlp/thrift/iface/PredefinedData.java new file mode 100644 index 0000000..67e2463 --- /dev/null +++ b/src/main/java/org/openslx/bwlp/thrift/iface/PredefinedData.java @@ -0,0 +1,611 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.openslx.bwlp.thrift.iface; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-11-23") +public class PredefinedData implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PredefinedData"); + + private static final org.apache.thrift.protocol.TField NET_SHARES_FIELD_DESC = new org.apache.thrift.protocol.TField("netShares", org.apache.thrift.protocol.TType.LIST, (short)1); + private static final org.apache.thrift.protocol.TField LDAP_FILTER_FIELD_DESC = new org.apache.thrift.protocol.TField("ldapFilter", org.apache.thrift.protocol.TType.LIST, (short)2); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new PredefinedDataStandardSchemeFactory()); + schemes.put(TupleScheme.class, new PredefinedDataTupleSchemeFactory()); + } + + public List netShares; // required + public List ldapFilter; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NET_SHARES((short)1, "netShares"), + LDAP_FILTER((short)2, "ldapFilter"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // NET_SHARES + return NET_SHARES; + case 2: // LDAP_FILTER + return LDAP_FILTER; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.NET_SHARES, new org.apache.thrift.meta_data.FieldMetaData("netShares", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, NetShare.class)))); + tmpMap.put(_Fields.LDAP_FILTER, new org.apache.thrift.meta_data.FieldMetaData("ldapFilter", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, LdapFilter.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PredefinedData.class, metaDataMap); + } + + public PredefinedData() { + } + + public PredefinedData( + List netShares, + List ldapFilter) + { + this(); + this.netShares = netShares; + this.ldapFilter = ldapFilter; + } + + /** + * Performs a deep copy on other. + */ + public PredefinedData(PredefinedData other) { + if (other.isSetNetShares()) { + List __this__netShares = new ArrayList(other.netShares.size()); + for (NetShare other_element : other.netShares) { + __this__netShares.add(new NetShare(other_element)); + } + this.netShares = __this__netShares; + } + if (other.isSetLdapFilter()) { + List __this__ldapFilter = new ArrayList(other.ldapFilter.size()); + for (LdapFilter other_element : other.ldapFilter) { + __this__ldapFilter.add(new LdapFilter(other_element)); + } + this.ldapFilter = __this__ldapFilter; + } + } + + public PredefinedData deepCopy() { + return new PredefinedData(this); + } + + @Override + public void clear() { + this.netShares = null; + this.ldapFilter = null; + } + + public int getNetSharesSize() { + return (this.netShares == null) ? 0 : this.netShares.size(); + } + + public java.util.Iterator getNetSharesIterator() { + return (this.netShares == null) ? null : this.netShares.iterator(); + } + + public void addToNetShares(NetShare elem) { + if (this.netShares == null) { + this.netShares = new ArrayList(); + } + this.netShares.add(elem); + } + + public List getNetShares() { + return this.netShares; + } + + public PredefinedData setNetShares(List netShares) { + this.netShares = netShares; + return this; + } + + public void unsetNetShares() { + this.netShares = null; + } + + /** Returns true if field netShares is set (has been assigned a value) and false otherwise */ + public boolean isSetNetShares() { + return this.netShares != null; + } + + public void setNetSharesIsSet(boolean value) { + if (!value) { + this.netShares = null; + } + } + + public int getLdapFilterSize() { + return (this.ldapFilter == null) ? 0 : this.ldapFilter.size(); + } + + public java.util.Iterator getLdapFilterIterator() { + return (this.ldapFilter == null) ? null : this.ldapFilter.iterator(); + } + + public void addToLdapFilter(LdapFilter elem) { + if (this.ldapFilter == null) { + this.ldapFilter = new ArrayList(); + } + this.ldapFilter.add(elem); + } + + public List getLdapFilter() { + return this.ldapFilter; + } + + public PredefinedData setLdapFilter(List ldapFilter) { + this.ldapFilter = ldapFilter; + return this; + } + + public void unsetLdapFilter() { + this.ldapFilter = null; + } + + /** Returns true if field ldapFilter is set (has been assigned a value) and false otherwise */ + public boolean isSetLdapFilter() { + return this.ldapFilter != null; + } + + public void setLdapFilterIsSet(boolean value) { + if (!value) { + this.ldapFilter = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NET_SHARES: + if (value == null) { + unsetNetShares(); + } else { + setNetShares((List)value); + } + break; + + case LDAP_FILTER: + if (value == null) { + unsetLdapFilter(); + } else { + setLdapFilter((List)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NET_SHARES: + return getNetShares(); + + case LDAP_FILTER: + return getLdapFilter(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NET_SHARES: + return isSetNetShares(); + case LDAP_FILTER: + return isSetLdapFilter(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof PredefinedData) + return this.equals((PredefinedData)that); + return false; + } + + public boolean equals(PredefinedData that) { + if (that == null) + return false; + + boolean this_present_netShares = true && this.isSetNetShares(); + boolean that_present_netShares = true && that.isSetNetShares(); + if (this_present_netShares || that_present_netShares) { + if (!(this_present_netShares && that_present_netShares)) + return false; + if (!this.netShares.equals(that.netShares)) + return false; + } + + boolean this_present_ldapFilter = true && this.isSetLdapFilter(); + boolean that_present_ldapFilter = true && that.isSetLdapFilter(); + if (this_present_ldapFilter || that_present_ldapFilter) { + if (!(this_present_ldapFilter && that_present_ldapFilter)) + return false; + if (!this.ldapFilter.equals(that.ldapFilter)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_netShares = true && (isSetNetShares()); + list.add(present_netShares); + if (present_netShares) + list.add(netShares); + + boolean present_ldapFilter = true && (isSetLdapFilter()); + list.add(present_ldapFilter); + if (present_ldapFilter) + list.add(ldapFilter); + + return list.hashCode(); + } + + @Override + public int compareTo(PredefinedData other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetNetShares()).compareTo(other.isSetNetShares()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNetShares()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.netShares, other.netShares); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetLdapFilter()).compareTo(other.isSetLdapFilter()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetLdapFilter()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ldapFilter, other.ldapFilter); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("PredefinedData("); + boolean first = true; + + sb.append("netShares:"); + if (this.netShares == null) { + sb.append("null"); + } else { + sb.append(this.netShares); + } + first = false; + if (!first) sb.append(", "); + sb.append("ldapFilter:"); + if (this.ldapFilter == null) { + sb.append("null"); + } else { + sb.append(this.ldapFilter); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class PredefinedDataStandardSchemeFactory implements SchemeFactory { + public PredefinedDataStandardScheme getScheme() { + return new PredefinedDataStandardScheme(); + } + } + + private static class PredefinedDataStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, PredefinedData struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NET_SHARES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list90 = iprot.readListBegin(); + struct.netShares = new ArrayList(_list90.size); + NetShare _elem91; + for (int _i92 = 0; _i92 < _list90.size; ++_i92) + { + _elem91 = new NetShare(); + _elem91.read(iprot); + struct.netShares.add(_elem91); + } + iprot.readListEnd(); + } + struct.setNetSharesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // LDAP_FILTER + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list93 = iprot.readListBegin(); + struct.ldapFilter = new ArrayList(_list93.size); + LdapFilter _elem94; + for (int _i95 = 0; _i95 < _list93.size; ++_i95) + { + _elem94 = new LdapFilter(); + _elem94.read(iprot); + struct.ldapFilter.add(_elem94); + } + iprot.readListEnd(); + } + struct.setLdapFilterIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, PredefinedData struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.netShares != null) { + oprot.writeFieldBegin(NET_SHARES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.netShares.size())); + for (NetShare _iter96 : struct.netShares) + { + _iter96.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.ldapFilter != null) { + oprot.writeFieldBegin(LDAP_FILTER_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.ldapFilter.size())); + for (LdapFilter _iter97 : struct.ldapFilter) + { + _iter97.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class PredefinedDataTupleSchemeFactory implements SchemeFactory { + public PredefinedDataTupleScheme getScheme() { + return new PredefinedDataTupleScheme(); + } + } + + private static class PredefinedDataTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, PredefinedData struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetNetShares()) { + optionals.set(0); + } + if (struct.isSetLdapFilter()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetNetShares()) { + { + oprot.writeI32(struct.netShares.size()); + for (NetShare _iter98 : struct.netShares) + { + _iter98.write(oprot); + } + } + } + if (struct.isSetLdapFilter()) { + { + oprot.writeI32(struct.ldapFilter.size()); + for (LdapFilter _iter99 : struct.ldapFilter) + { + _iter99.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, PredefinedData struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + { + org.apache.thrift.protocol.TList _list100 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.netShares = new ArrayList(_list100.size); + NetShare _elem101; + for (int _i102 = 0; _i102 < _list100.size; ++_i102) + { + _elem101 = new NetShare(); + _elem101.read(iprot); + struct.netShares.add(_elem101); + } + } + struct.setNetSharesIsSet(true); + } + if (incoming.get(1)) { + { + org.apache.thrift.protocol.TList _list103 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.ldapFilter = new ArrayList(_list103.size); + LdapFilter _elem104; + for (int _i105 = 0; _i105 < _list103.size; ++_i105) + { + _elem104 = new LdapFilter(); + _elem104.read(iprot); + struct.ldapFilter.add(_elem104); + } + } + struct.setLdapFilterIsSet(true); + } + } + } + +} + -- cgit v1.2.3-55-g7522