private void parseUserClientSync(ClientSync sync, ByteBuffer buf, int options, int payloadLength) { int payloadLimitPosition = buf.position() + payloadLength; UserClientSync userSync = new UserClientSync(); while (buf.position() < payloadLimitPosition) { byte fieldId = buf.get(); switch (fieldId) { case USER_ATTACH_FIELD_ID: userSync.setUserAttachRequest(parseUserAttachRequest(buf)); break; case ENDPOINT_ATTACH_FIELD_ID: userSync.setEndpointAttachRequests(parseEndpointAttachRequests(buf)); break; case ENDPOINT_DETACH_FIELD_ID: userSync.setEndpointDetachRequests(parseEndpointDetachRequests(buf)); break; default: break; } } sync.setUserSync(userSync); }
private UserServerSync processUserSyncRequest(String endpointId, int requestHash, UserClientSync request, EndpointProfileDto profile) { UserServerSync response = new UserServerSync(); if (request.getEndpointAttachRequests() != null) { response.setEndpointAttachResponses(processEndpointAttachRequests( endpointId, requestHash, request, profile)); } if (request.getEndpointDetachRequests() != null) { response.setEndpointDetachResponses(processEndpointDetachRequests( endpointId, requestHash, request, profile)); } return response; }
private void processUserAttachRequest(ActorContext context, ClientSync syncRequest, SyncContext responseHolder) { UserClientSync request = syncRequest.getUserSync(); if (request != null && request.getUserAttachRequest() != null) { UserAttachRequest attachRequest = request.getUserAttachRequest(); context.parent().tell(new UserVerificationRequestMessage( context.self(), attachRequest.getUserVerifierId(), attachRequest.getUserExternalId(), attachRequest.getUserAccessToken()), context.self()); LOG.debug("[{}][{}] received and forwarded user attach request {}", endpointKey, actorKey, request.getUserAttachRequest()); if (userAttachResponseMap.size() > 0) { Entry<UUID, UserVerificationResponseMessage> entryToSend = userAttachResponseMap.entrySet() .iterator() .next(); updateResponseWithUserAttachResults(responseHolder.getResponse(), entryToSend.getValue()); userAttachResponseMap.remove(entryToSend.getKey()); } } }
/** * Updates a request. */ public void updateRequest(ServerSync response) { UUID channelUuid = getChannelUuid(); LOG.debug("[{}] Cleanup profile request", channelUuid); request.setProfileSync(null); if (request.getUserSync() != null) { LOG.debug("[{}] Cleanup user request", channelUuid); request.setUserSync(new UserClientSync()); } if (request.getEventSync() != null) { LOG.debug("[{}] Cleanup event request", channelUuid); request.setEventSync(new EventClientSync()); } if (request.getLogSync() != null) { LOG.debug("[{}] Cleanup log request", channelUuid); request.getLogSync().setLogEntries(null); } if (request.getNotificationSync() != null) { LOG.debug("[{}] Cleanup/update notification request", channelUuid); request.getNotificationSync().setSubscriptionCommands(null); request.getNotificationSync().setAcceptedUnicastNotifications(null); } }
private List<EndpointDetachResponse> processEndpointDetachRequests(String endpointId, int requestHash, UserClientSync syncRequest, EndpointProfileDto profile) { List<EndpointDetachRequest> requests = syncRequest.getEndpointDetachRequests(); if (requests != null && !requests.isEmpty()) { LOG.debug("[{}] processing {} endpoint detach requests", endpointId, requests.size()); List<EndpointDetachResponse> responses = new ArrayList<>(requests.size()); for (EndpointDetachRequest request : requests) { LOG.debug("[{}] processing endpoint detach request {}", endpointId, request); EndpointDetachResponse response = endpointUserService.detachEndpoint(profile, request); LOG.debug("[{}] endpoint detach response {}", endpointId, response); responses.add(response); } return responses; } else { return Collections.emptyList(); } }
private List<EndpointAttachResponse> processEndpointAttachRequests(String endpointId, int requestHash, UserClientSync syncRequest, EndpointProfileDto profile) { List<EndpointAttachRequest> requests = syncRequest.getEndpointAttachRequests(); if (requests != null && !requests.isEmpty()) { LOG.debug("[{}][{}] processing {} endpoint attach requests", endpointId, requestHash, requests.size()); List<EndpointAttachResponse> responses = new ArrayList<>(requests.size()); for (EndpointAttachRequest request : syncRequest.getEndpointAttachRequests()) { LOG.debug("[{}][{}] processing endpoint attach request {}", endpointId, requestHash, request); EndpointAttachResponse response = endpointUserService.attachEndpoint(profile, request); LOG.debug("[{}][{}] endpoint attach response {}", endpointId, requestHash, response); responses.add(response); } return responses; } else { return Collections.emptyList(); } }
if (userSync != null ? !userSync.equals(that.userSync) : that.userSync != null) { return false;
@Override public int hashCode() { int result = requestId; result = 31 * result + (clientSyncMetaData != null ? clientSyncMetaData.hashCode() : 0); result = 31 * result + (bootstrapSync != null ? bootstrapSync.hashCode() : 0); result = 31 * result + (profileSync != null ? profileSync.hashCode() : 0); result = 31 * result + (forceConfigurationSync ? 1 : 0); result = 31 * result + (configurationSync != null ? configurationSync.hashCode() : 0); result = 31 * result + (forceNotificationSync ? 1 : 0); result = 31 * result + (notificationSync != null ? notificationSync.hashCode() : 0); result = 31 * result + (userSync != null ? userSync.hashCode() : 0); result = 31 * result + (eventSync != null ? eventSync.hashCode() : 0); result = 31 * result + (logSync != null ? logSync.hashCode() : 0); result = 31 * result + (useConfigurationRawSchema ? 1 : 0); return result; }
: request.getUserSync().getEndpointDetachRequests(); if (detachRequests != null && !detachRequests.isEmpty()) { state.resetEventSeqNumber();
return null; UserClientSync sync = new UserClientSync(); if (source.getUserAttachRequest() != null) { sync.setUserAttachRequest(new UserAttachRequest( source.getUserAttachRequest().getUserVerifierId(), source.getUserAttachRequest().getUserExternalId(), request.getRequestId(), request.getEndpointAccessToken())); sync.setEndpointAttachRequests(requests); request.getRequestId(), request.getEndpointKeyHash())); sync.setEndpointDetachRequests(requests);