public Message deepCopy() { return new Message(this); }
public Object getFieldValue(_Fields field) { switch (field) { case TYPE: return getType(); case EVENT_ID: return getEventId(); case EVENT: return getEvent(); case ROUTE: return getRoute(); case USER_ROUTE: return getUserRoute(); case ENDPOINT_ROUTE_UPDATE: return getEndpointRouteUpdate(); case ENDPOINT_STATE_UPDATE: return getEndpointStateUpdate(); } throw new IllegalStateException(); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof Message) return this.equals((Message)that); return false; }
/** 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 TYPE: return isSetType(); case EVENT_ID: return isSetEventId(); case EVENT: return isSetEvent(); case ROUTE: return isSetRoute(); case USER_ROUTE: return isSetUserRoute(); case ENDPOINT_ROUTE_UPDATE: return isSetEndpointRouteUpdate(); case ENDPOINT_STATE_UPDATE: return isSetEndpointStateUpdate(); } throw new IllegalStateException(); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, sendMessages_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.messages = new ArrayList<Message>(_list21.size); Message _elem22; for (int _i23 = 0; _i23 < _list21.size; ++_i23) { _elem22 = new Message(); _elem22.read(iprot); struct.messages.add(_elem22); } } struct.setMessagesIsSet(true); } } }
/** * Performs a deep copy on <i>other</i>. */ public Message(Message other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetType()) { this.type = other.type; } this.eventId = other.eventId; if (other.isSetEvent()) { this.event = new Event(other.event); } if (other.isSetRoute()) { this.route = new EventRoute(other.route); } if (other.isSetUserRoute()) { this.userRoute = new UserRouteInfo(other.userRoute); } if (other.isSetEndpointRouteUpdate()) { this.endpointRouteUpdate = new EndpointRouteUpdate(other.endpointRouteUpdate); } if (other.isSetEndpointStateUpdate()) { this.endpointStateUpdate = new EndpointStateUpdate(other.endpointStateUpdate); } }
@Override public void sendEventMessage(List<Message> messages) { for (Message message : messages) { switch (message.getType()) { case ROUTE_UPDATE: onRouteUpdate(message.getRoute()); break; case USER_ROUTE_INFO: onUserRouteInfo(message.getUserRoute()); break; case EVENT: onEvent(message.getEvent()); break; case ENDPOINT_ROUTE_UPDATE: onEndpointRouteUpdate(message.getEndpointRouteUpdate()); break; case ENDPOINT_STATE_UPDATE: onEndpointStateUpdate(message.getEndpointStateUpdate()); break; default: break; } } }
boolean present_type = true && (isSetType()); list.add(present_type); if (present_type) boolean present_event = true && (isSetEvent()); list.add(present_event); if (present_event) list.add(event); boolean present_route = true && (isSetRoute()); list.add(present_route); if (present_route) list.add(route); boolean present_userRoute = true && (isSetUserRoute()); list.add(present_userRoute); if (present_userRoute) list.add(userRoute); boolean present_endpointRouteUpdate = true && (isSetEndpointRouteUpdate()); list.add(present_endpointRouteUpdate); if (present_endpointRouteUpdate) list.add(endpointRouteUpdate); boolean present_endpointStateUpdate = true && (isSetEndpointStateUpdate()); list.add(present_endpointStateUpdate); if (present_endpointStateUpdate)
/** * Pack Event into list of EventMessage. * * @param event Event * @return List(EventMessage) */ private List<Message> packMessage(Event event) { return Collections.singletonList(new Message( EventMessageType.EVENT, getEventId(), event, null, null, null, null)); }
boolean this_present_type = true && this.isSetType(); boolean that_present_type = true && that.isSetType(); if (this_present_type || that_present_type) { if (!(this_present_type && that_present_type)) boolean this_present_event = true && this.isSetEvent(); boolean that_present_event = true && that.isSetEvent(); if (this_present_event || that_present_event) { if (!(this_present_event && that_present_event)) boolean this_present_route = true && this.isSetRoute(); boolean that_present_route = true && that.isSetRoute(); if (this_present_route || that_present_route) { if (!(this_present_route && that_present_route)) boolean this_present_userRoute = true && this.isSetUserRoute(); boolean that_present_userRoute = true && that.isSetUserRoute(); if (this_present_userRoute || that_present_userRoute) { if (!(this_present_userRoute && that_present_userRoute)) boolean this_present_endpointRouteUpdate = true && this.isSetEndpointRouteUpdate(); boolean that_present_endpointRouteUpdate = true && that.isSetEndpointRouteUpdate(); if (this_present_endpointRouteUpdate || that_present_endpointRouteUpdate) { if (!(this_present_endpointRouteUpdate && that_present_endpointRouteUpdate)) boolean this_present_endpointStateUpdate = true && this.isSetEndpointStateUpdate(); boolean that_present_endpointStateUpdate = true && that.isSetEndpointStateUpdate(); if (this_present_endpointStateUpdate || that_present_endpointStateUpdate) { if (!(this_present_endpointStateUpdate && that_present_endpointStateUpdate))
/** * Performs a deep copy on <i>other</i>. */ public sendMessages_args(sendMessages_args other) { if (other.isSetMessages()) { List<Message> __this__messages = new ArrayList<Message>(other.messages.size()); for (Message other_element : other.messages) { __this__messages.add(new Message(other_element)); } this.messages = __this__messages; } }
lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType()); if (lastComparison != 0) { return lastComparison; if (isSetType()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetEventId()).compareTo(other.isSetEventId()); if (lastComparison != 0) { return lastComparison; if (isSetEventId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.eventId, other.eventId); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetEvent()).compareTo(other.isSetEvent()); if (lastComparison != 0) { return lastComparison; if (isSetEvent()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.event, other.event); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetRoute()).compareTo(other.isSetRoute()); if (lastComparison != 0) { return lastComparison; if (isSetRoute()) {
/** * Pack UserRouteInfo into list of EventMessage. * * @param userRoute UserRouteInfo * @return List(EventMessage) */ private List<Message> packMessage(UserRouteInfo userRoute) { return Collections.singletonList(new Message( EventMessageType.USER_ROUTE_INFO, getEventId(), null, null, userRoute, null, null)); }
TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetType()) { optionals.set(0); if (struct.isSetEventId()) { optionals.set(1); if (struct.isSetEvent()) { optionals.set(2); if (struct.isSetRoute()) { optionals.set(3); if (struct.isSetUserRoute()) { optionals.set(4); if (struct.isSetEndpointRouteUpdate()) { optionals.set(5); if (struct.isSetEndpointStateUpdate()) { optionals.set(6); if (struct.isSetType()) { oprot.writeI32(struct.type.getValue()); if (struct.isSetEventId()) { oprot.writeI64(struct.eventId);
/** * Repack list of EventRoute messages to list of EventMessage. * * @param routes List(EventRoute) * @return List(EventMessage) */ private List<Message> packMessage(List<EventRoute> routes) { EventMessageType type = EventMessageType.ROUTE_UPDATE; List<Message> messages = new LinkedList<>(); for (EventRoute route : routes) { messages.add(new Message(type, getEventId(), null, route, null, null, null)); } return messages; }
private List<Message> packMessage(EndpointUserConfigurationUpdate update) { final EventMessageType type = EventMessageType.ENDPOINT_STATE_UPDATE; final List<Message> messages = new LinkedList<>(); EndpointStateUpdate msg = new EndpointStateUpdate(); msg.setTenantId(update.getTenantId()); msg.setUserId(update.getUserId()); msg.setApplicationToken(update.getApplicationToken()); msg.setEndpointKey(update.getKey().getData()); msg.setUcfHash(update.getHash()); messages.add(new Message(type, getEventId(), null, null, null, null, msg)); return messages; }
private List<Message> packMessage(GlobalRouteInfo routeInfo) { final EventMessageType type = EventMessageType.ENDPOINT_ROUTE_UPDATE; final List<Message> messages = new LinkedList<>(); EndpointRouteUpdate route = new EndpointRouteUpdate(); route.setTenantId(routeInfo.getTenantId()); route.setUserId(routeInfo.getUserId()); route.setUpdateType(transformUpdateType(routeInfo.getRouteOperation())); route.setCfSchemaVersion(routeInfo.getCfVersion()); route.setUcfHash(routeInfo.getUcfHash()); String opsServerId = routeInfo.getAddress().getServerId(); if (opsServerId == null) { opsServerId = id; } RouteAddress routeAddress = new RouteAddress( ByteBuffer.wrap(routeInfo.getAddress().getEndpointKey().getData()), routeInfo .getAddress().getApplicationToken(), opsServerId); route.setRouteAddress(routeAddress); messages.add(new Message(type, getEventId(), null, null, null, route, null)); return messages; }