public RouteInfo deepCopy() { return new RouteInfo(this); }
public Object getFieldValue(_Fields field) { switch (field) { case UPDATE_TYPE: return getUpdateType(); case EVENT_CLASS_FAMILY_VERSION: return getEventClassFamilyVersion(); case APPLICATION_TOKEN: return getApplicationToken(); case ENDPOINT_ID: return getEndpointId(); } throw new IllegalStateException(); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof RouteInfo) return this.equals((RouteInfo)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 UPDATE_TYPE: return isSetUpdateType(); case EVENT_CLASS_FAMILY_VERSION: return isSetEventClassFamilyVersion(); case APPLICATION_TOKEN: return isSetApplicationToken(); case ENDPOINT_ID: return isSetEndpointId(); } throw new IllegalStateException(); }
/** * 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 RouteInfo(RouteInfo other) { if (other.isSetUpdateType()) { this.updateType = other.updateType; } if (other.isSetEventClassFamilyVersion()) { List<EventClassFamilyVersion> __this__eventClassFamilyVersion = new ArrayList<EventClassFamilyVersion>(other.eventClassFamilyVersion.size()); for (EventClassFamilyVersion other_element : other.eventClassFamilyVersion) { __this__eventClassFamilyVersion.add(new EventClassFamilyVersion(other_element)); } this.eventClassFamilyVersion = __this__eventClassFamilyVersion; } if (other.isSetApplicationToken()) { this.applicationToken = other.applicationToken; } if (other.isSetEndpointId()) { this.endpointId = other.endpointId; } }
return false; boolean this_present_updateType = true && this.isSetUpdateType(); boolean that_present_updateType = true && that.isSetUpdateType(); if (this_present_updateType || that_present_updateType) { if (!(this_present_updateType && that_present_updateType)) boolean this_present_eventClassFamilyVersion = true && this.isSetEventClassFamilyVersion(); boolean that_present_eventClassFamilyVersion = true && that.isSetEventClassFamilyVersion(); if (this_present_eventClassFamilyVersion || that_present_eventClassFamilyVersion) { if (!(this_present_eventClassFamilyVersion && that_present_eventClassFamilyVersion)) boolean this_present_applicationToken = true && this.isSetApplicationToken(); boolean that_present_applicationToken = true && that.isSetApplicationToken(); if (this_present_applicationToken || that_present_applicationToken) { if (!(this_present_applicationToken && that_present_applicationToken)) boolean this_present_endpointId = true && this.isSetEndpointId(); boolean that_present_endpointId = true && that.isSetEndpointId(); if (this_present_endpointId || that_present_endpointId) { if (!(this_present_endpointId && that_present_endpointId))
/** * 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; } }
@Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_updateType = true && (isSetUpdateType()); list.add(present_updateType); if (present_updateType) list.add(updateType.getValue()); boolean present_eventClassFamilyVersion = true && (isSetEventClassFamilyVersion()); list.add(present_eventClassFamilyVersion); if (present_eventClassFamilyVersion) list.add(eventClassFamilyVersion); boolean present_applicationToken = true && (isSetApplicationToken()); list.add(present_applicationToken); if (present_applicationToken) list.add(applicationToken); boolean present_endpointId = true && (isSetEndpointId()); list.add(present_endpointId); if (present_endpointId) list.add(endpointId); return list.hashCode(); }
/** * 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; }
lastComparison = Boolean.valueOf(isSetUpdateType()).compareTo(other.isSetUpdateType()); if (lastComparison != 0) { return lastComparison; if (isSetUpdateType()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updateType, other.updateType); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetEventClassFamilyVersion()).compareTo(other.isSetEventClassFamilyVersion()); if (lastComparison != 0) { return lastComparison; if (isSetEventClassFamilyVersion()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.eventClassFamilyVersion, other.eventClassFamilyVersion); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetApplicationToken()).compareTo(other.isSetApplicationToken()); if (lastComparison != 0) { return lastComparison; if (isSetApplicationToken()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationToken, other.applicationToken); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetEndpointId()).compareTo(other.isSetEndpointId()); if (lastComparison != 0) { return lastComparison; if (isSetEndpointId()) {
routes.add(new RouteInfo(address, maskLength, metric));
TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetUpdateType()) { optionals.set(0); if (struct.isSetEventClassFamilyVersion()) { optionals.set(1); if (struct.isSetApplicationToken()) { optionals.set(2); if (struct.isSetEndpointId()) { optionals.set(3); if (struct.isSetUpdateType()) { oprot.writeI32(struct.updateType.getValue()); if (struct.isSetEventClassFamilyVersion()) { if (struct.isSetApplicationToken()) { oprot.writeString(struct.applicationToken); if (struct.isSetEndpointId()) { oprot.writeBinary(struct.endpointId);