public EventRoute deepCopy() { return new EventRoute(this); }
public Object getFieldValue(_Fields field) { switch (field) { case USER_ID: return getUserId(); case TENANT_ID: return getTenantId(); case ROUTE_INFO: return getRouteInfo(); case OPERATIONS_SERVER_ID: return getOperationsServerId(); } throw new IllegalStateException(); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof EventRoute) return this.equals((EventRoute)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 USER_ID: return isSetUserId(); case TENANT_ID: return isSetTenantId(); case ROUTE_INFO: return isSetRouteInfo(); case OPERATIONS_SERVER_ID: return isSetOperationsServerId(); } throw new IllegalStateException(); }
case 4: // ROUTE if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.route = new EventRoute(); struct.route.read(iprot); struct.setRouteIsSet(true); } else {
return false; boolean this_present_userId = true && this.isSetUserId(); boolean that_present_userId = true && that.isSetUserId(); if (this_present_userId || that_present_userId) { if (!(this_present_userId && that_present_userId)) boolean this_present_tenantId = true && this.isSetTenantId(); boolean that_present_tenantId = true && that.isSetTenantId(); if (this_present_tenantId || that_present_tenantId) { if (!(this_present_tenantId && that_present_tenantId)) boolean this_present_routeInfo = true && this.isSetRouteInfo(); boolean that_present_routeInfo = true && that.isSetRouteInfo(); if (this_present_routeInfo || that_present_routeInfo) { if (!(this_present_routeInfo && that_present_routeInfo)) boolean this_present_operationsServerId = true && this.isSetOperationsServerId(); boolean that_present_operationsServerId = true && that.isSetOperationsServerId(); if (this_present_operationsServerId || that_present_operationsServerId) { if (!(this_present_operationsServerId && that_present_operationsServerId))
struct.route = new EventRoute(); struct.route.read(iprot); struct.setRouteIsSet(true);
/** * Transform EventRoute message from thrift service into RouteInfo and push * it to EventService listeners. * * @param route EventRoute */ private void onRouteUpdate(EventRoute route) { LOG.debug("onEventRouteUpdate .... {} routes updated in {} listeners", route.getRouteInfo().size(), listeners.size()); for (EventServiceListener listener : listeners) { for (org.kaaproject.kaa.server.common.thrift.gen.operations.RouteInfo routeInfo : route.getRouteInfo()) { String applicationToken = routeInfo.getApplicationToken(); EndpointObjectHash endpointKey = EndpointObjectHash.fromBytes(routeInfo.getEndpointId()); RouteTableAddress address = new RouteTableAddress( endpointKey, applicationToken, route.getOperationsServerId()); List<EventClassFamilyVersion> ecfVersions = new ArrayList<>(); for (org.kaaproject.kaa.server.common.thrift.gen.operations.EventClassFamilyVersion ecfv : routeInfo.getEventClassFamilyVersion()) { EventClassFamilyVersion ecf = new EventClassFamilyVersion( ecfv.getEndpointClassFamilyId(), ecfv.getEndpointClassFamilyVersion()); ecfVersions.add(ecf); } listener.onRouteInfo(new RouteInfo( route.getTenantId(), route.getUserId(), address, ecfVersions)); } } }
/** * Performs a deep copy on <i>other</i>. */ public EventRoute(EventRoute other) { if (other.isSetUserId()) { this.userId = other.userId; } if (other.isSetTenantId()) { this.tenantId = other.tenantId; } if (other.isSetRouteInfo()) { List<RouteInfo> __this__routeInfo = new ArrayList<RouteInfo>(other.routeInfo.size()); for (RouteInfo other_element : other.routeInfo) { __this__routeInfo.add(new RouteInfo(other_element)); } this.routeInfo = __this__routeInfo; } if (other.isSetOperationsServerId()) { this.operationsServerId = other.operationsServerId; } }
/** * Transform Collection(RouteInfo) into List(EventRoute). * * @param routeInfos Collection(RouteInfo) * @return List(EventRoute) */ private List<EventRoute> transformEventRouteFromRouteInfoCollection( Collection<RouteInfo> routeInfos) { List<EventRoute> routes = new ArrayList<>(); HashMap<UserTenantKey, List<org.kaaproject.kaa.server.common.thrift.gen.operations.RouteInfo>> routeInfosTh = new HashMap<>(); // NOSONAR for (RouteInfo ri : routeInfos) { org.kaaproject.kaa.server.common.thrift.gen.operations.RouteInfo riTh = new org.kaaproject.kaa.server.common.thrift.gen.operations.RouteInfo( transformUpdateType(ri.getRouteOperation()), transformEcfv(ri.getEcfVersions()), ri.getAddress().getApplicationToken(), ByteBuffer.wrap(ri.getAddress().getEndpointKey().getData())); UserTenantKey key = new UserTenantKey(ri.getUserId(), ri.getTenantId()); if (!routeInfosTh.containsKey(key)) { routeInfosTh.put(key, new ArrayList<>()); } routeInfosTh.get(key).add(riTh); } for (UserTenantKey key : routeInfosTh.keySet()) { routes.add(new EventRoute(key.getUserId(), key.getTenantId(), routeInfosTh.get(key), id)); } return routes; }
if (!(this_present_route && that_present_route)) return false; if (!this.route.equals(that.route)) return false;
@Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_userId = true && (isSetUserId()); list.add(present_userId); if (present_userId) list.add(userId); boolean present_tenantId = true && (isSetTenantId()); list.add(present_tenantId); if (present_tenantId) list.add(tenantId); boolean present_routeInfo = true && (isSetRouteInfo()); list.add(present_routeInfo); if (present_routeInfo) list.add(routeInfo); boolean present_operationsServerId = true && (isSetOperationsServerId()); list.add(present_operationsServerId); if (present_operationsServerId) list.add(operationsServerId); return list.hashCode(); }
/** * 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); } }
lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); if (lastComparison != 0) { return lastComparison; if (isSetUserId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetTenantId()).compareTo(other.isSetTenantId()); if (lastComparison != 0) { return lastComparison; if (isSetTenantId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tenantId, other.tenantId); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetRouteInfo()).compareTo(other.isSetRouteInfo()); if (lastComparison != 0) { return lastComparison; if (isSetRouteInfo()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.routeInfo, other.routeInfo); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetOperationsServerId()).compareTo(other.isSetOperationsServerId()); if (lastComparison != 0) { return lastComparison; if (isSetOperationsServerId()) {
TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetUserId()) { optionals.set(0); if (struct.isSetTenantId()) { optionals.set(1); if (struct.isSetRouteInfo()) { optionals.set(2); if (struct.isSetOperationsServerId()) { optionals.set(3); if (struct.isSetUserId()) { oprot.writeString(struct.userId); if (struct.isSetTenantId()) { oprot.writeString(struct.tenantId); if (struct.isSetRouteInfo()) { if (struct.isSetOperationsServerId()) { oprot.writeString(struct.operationsServerId);