@Override public EndpointAttachResponse attachEndpoint(EndpointProfileDto profile, EndpointAttachRequest endpointAttachRequest) { EndpointAttachResponse response = new EndpointAttachResponse(); response.setRequestId(endpointAttachRequest.getRequestId()); response.setResult(SyncStatus.FAILURE); String endpointUserId = profile.getEndpointUserId(); if (isNotEmpty(endpointUserId)) { try { EndpointProfileDto attachedEndpoint = endpointService.attachEndpointToUser( endpointUserId, endpointAttachRequest.getEndpointAccessToken()); response.setResult(SyncStatus.SUCCESS); response.setEndpointKeyHash(Base64Util.encode(attachedEndpoint.getEndpointKeyHash())); } catch (DatabaseProcessingException ex) { LOG.warn("[{}] failed to attach endpoint with access token {} and " + "user {}, exception catched: {}", Base64Util.encode(profile.getEndpointKeyHash()), endpointAttachRequest.getEndpointAccessToken(), profile.getEndpointUserId(), ex); } } else { LOG.warn("[{}] received attach endpoint request, but there is no user to attach.", Base64Util.encode(profile.getEndpointKeyHash())); } return response; }
state.resetEventSeqNumber(); for (EndpointAttachResponse response : attachResponses) { if (response.getResult() != SyncStatus.SUCCESS) { LOG.debug("[{}][{}] Skipped unsuccessful attach response [{}]", endpointKey, actorKey, response.getRequestId()); continue; Base64Util.decode(response.getEndpointKeyHash())), state.getUserId(), endpointKey); context.parent().tell(attachMessage, context.self()); LOG.debug("[{}][{}] Notification to attached endpoint [{}] sent", endpointKey, actorKey, response.getEndpointKeyHash());
: source.getEndpointAttachResponses()) { responses.add(new EndpointAttachResponse( response.getRequestId(), response.getEndpointKeyHash(), convert(response .getResult())));
buf.putShort((short) userSync.getEndpointAttachResponses().size()); for (EndpointAttachResponse response : userSync.getEndpointAttachResponses()) { buf.put(response.getResult() == SyncStatus.SUCCESS ? SUCCESS : FAILURE); if (response.getEndpointKeyHash() != null) { buf.put(USER_SYNC_ENDPOINT_ID_OPTION); } else { buf.put(NOTHING); buf.putShort((short) response.getRequestId()); if (response.getEndpointKeyHash() != null) { put(buf, Base64Util.decode(response.getEndpointKeyHash()));