public Object getFieldValue(_Fields field) { switch (field) { case ROOT_ID: return Integer.valueOf(getRootId()); case NODE_MAP: return getNodeMap(); } throw new IllegalStateException(); }
public TPathsDump deepCopy() { return new TPathsDump(this); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TPathsDump) return this.equals((TPathsDump)that); return false; }
public void setFieldValue(_Fields field, Object value) { switch (field) { case ROOT_ID: if (value == null) { unsetRootId(); } else { setRootId((Integer)value); } break; case NODE_MAP: if (value == null) { unsetNodeMap(); } else { setNodeMap((Map<Integer,TPathEntry>)value); } break; } }
/** 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 ROOT_ID: return isSetRootId(); case NODE_MAP: return isSetNodeMap(); } throw new IllegalStateException(); }
public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetRootId()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'rootId' is unset! Struct:" + toString()); } if (!isSetNodeMap()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'nodeMap' is unset! Struct:" + toString()); } // check for sub-struct validity }
/** * Test retrieveFullPathsImageUpdate() when no image is present. * @throws Exception */ @Test public void testRetrieveEmptyPathImage() throws Exception { String[] prefixes = {}; PathsUpdate pathsUpdate = sentryStore.retrieveFullPathsImageUpdate(prefixes); TPathsUpdate tPathsUpdate = pathsUpdate.toThrift(); TPathsDump pathDump = tPathsUpdate.getPathsDump(); Map<Integer, TPathEntry> nodeMap = pathDump.getNodeMap(); assertEquals(1, nodeMap.size()); System.out.printf(nodeMap.toString()); }
if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.rootId = iprot.readI32(); struct.setRootIdIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.setNodeMapIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.validate();
case 2: // PATHS_DUMP if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.pathsDump = new TPathsDump(); struct.pathsDump.read(iprot); struct.setPathsDumpIsSet(true); } else {
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TPathsDump struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.rootId = iprot.readI32(); struct.setRootIdIsSet(true); { org.apache.thrift.protocol.TMap _map54 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.nodeMap = new HashMap<Integer,TPathEntry>(2*_map54.size); for (int _i55 = 0; _i55 < _map54.size; ++_i55) { int _key56; // required TPathEntry _val57; // required _key56 = iprot.readI32(); _val57 = new TPathEntry(); _val57.read(iprot); struct.nodeMap.put(_key56, _val57); } } struct.setNodeMapIsSet(true); } }
public boolean equals(TPathsDump that) { if (that == null) return false; boolean this_present_rootId = true; boolean that_present_rootId = true; if (this_present_rootId || that_present_rootId) { if (!(this_present_rootId && that_present_rootId)) return false; if (this.rootId != that.rootId) return false; } boolean this_present_nodeMap = true && this.isSetNodeMap(); boolean that_present_nodeMap = true && that.isSetNodeMap(); if (this_present_nodeMap || that_present_nodeMap) { if (!(this_present_nodeMap && that_present_nodeMap)) return false; if (!this.nodeMap.equals(that.nodeMap)) return false; } return true; }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; 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); } }
TPathsDump pathDump = pathsUpdate.toThrift().getPathsDump(); assertNotNull(pathDump); Map<Integer, TPathEntry> nodeMap = pathDump.getNodeMap(); int nodeCount = prefixSize + dbCount + (dbCount * tableCount) + (dbCount * tableCount * partitionCount);
public int compareTo(TPathsDump other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; TPathsDump typedOther = (TPathsDump)other; lastComparison = Boolean.valueOf(isSetRootId()).compareTo(typedOther.isSetRootId()); if (lastComparison != 0) { return lastComparison; } if (isSetRootId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rootId, typedOther.rootId); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetNodeMap()).compareTo(typedOther.isSetNodeMap()); if (lastComparison != 0) { return lastComparison; } if (isSetNodeMap()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nodeMap, typedOther.nodeMap); if (lastComparison != 0) { return lastComparison; } } return 0; }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TPathsUpdate struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.hasFullImage = iprot.readBool(); struct.setHasFullImageIsSet(true); struct.seqNum = iprot.readI64(); struct.setSeqNumIsSet(true); { org.apache.thrift.protocol.TList _list63 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.pathChanges = new ArrayList<TPathChanges>(_list63.size); for (int _i64 = 0; _i64 < _list63.size; ++_i64) { TPathChanges _elem65; // required _elem65 = new TPathChanges(); _elem65.read(iprot); struct.pathChanges.add(_elem65); } } struct.setPathChangesIsSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.pathsDump = new TPathsDump(); struct.pathsDump.read(iprot); struct.setPathsDumpIsSet(true); } } }
@Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present_rootId = true; builder.append(present_rootId); if (present_rootId) builder.append(rootId); boolean present_nodeMap = true && (isSetNodeMap()); builder.append(present_nodeMap); if (present_nodeMap) builder.append(nodeMap); return builder.toHashCode(); }
@Override public HMSPaths initializeFromDump(TPathsDump pathDump) { HMSPaths hmsPaths = new HMSPaths(this.hmsPaths.getPrefixes()); TPathEntry tRootEntry = pathDump.getNodeMap().get(pathDump.getRootId()); Entry rootEntry = hmsPaths.getRootEntry(); Map<String, Set<Entry>> authzObjToPath = new HashMap<String, Set<Entry>>(); cloneToEntry(tRootEntry, rootEntry, pathDump.getNodeMap(), authzObjToPath, rootEntry.getType() == EntryType.PREFIX); hmsPaths.setRootEntry(rootEntry); hmsPaths.setAuthzObjToPathMapping(authzObjToPath); return hmsPaths; }
TPathsUpdate tPathsUpdate = pathsUpdate.toThrift(); TPathsDump pathDump = tPathsUpdate.getPathsDump(); Map<Integer, TPathEntry> nodeMap = pathDump.getNodeMap(); assertEquals(7, nodeMap.size()); tPathsUpdate = pathsUpdate.toThrift(); pathDump = tPathsUpdate.getPathsDump(); nodeMap = pathDump.getNodeMap(); assertEquals(7, nodeMap.size()); tPathsUpdate = pathsUpdate.toThrift(); pathDump = tPathsUpdate.getPathsDump(); nodeMap = pathDump.getNodeMap(); assertEquals(7, nodeMap.size());
@Override public TPathsDump createPathsDump() { AtomicInteger counter = new AtomicInteger(0); Map<Integer, TPathEntry> idMap = new HashMap<Integer, TPathEntry>(); Tuple tRootTuple = createTPathEntry(hmsPaths.getRootEntry(), counter, idMap); idMap.put(tRootTuple.id, tRootTuple.entry); cloneToTPathEntry(hmsPaths.getRootEntry(), tRootTuple.entry, counter, idMap); return new TPathsDump(tRootTuple.id, idMap); }
/** * Performs a deep copy on <i>other</i>. */ public TPathsDump(TPathsDump other) { __isset_bitfield = other.__isset_bitfield; this.rootId = other.rootId; if (other.isSetNodeMap()) { Map<Integer,TPathEntry> __this__nodeMap = new HashMap<Integer,TPathEntry>(); for (Map.Entry<Integer, TPathEntry> other_element : other.nodeMap.entrySet()) { Integer other_element_key = other_element.getKey(); TPathEntry other_element_value = other_element.getValue(); Integer __this__nodeMap_copy_key = other_element_key; TPathEntry __this__nodeMap_copy_value = new TPathEntry(other_element_value); __this__nodeMap.put(__this__nodeMap_copy_key, __this__nodeMap_copy_value); } this.nodeMap = __this__nodeMap; } }