private void parseProfileClientSync(ClientSync sync, ByteBuffer buf, int options, int payloadLength) { int payloadLimitPosition = buf.position() + payloadLength; ProfileClientSync profileSync = new ProfileClientSync(); profileSync.setProfileBody(getNewByteBuffer(buf, buf.getInt())); while (buf.position() < payloadLimitPosition) { byte fieldId = buf.get(); // reading unused reserved field buf.get(); switch (fieldId) { case PUBLIC_KEY_FIELD_ID: profileSync.setEndpointPublicKey(getNewByteBuffer(buf, getIntFromUnsignedShort(buf))); break; case ACCESS_TOKEN_FIELD_ID: profileSync.setEndpointAccessToken(getUtf8String(buf)); break; default: break; } } sync.setProfileSync(profileSync); }
/** * 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); } }
diff.setProfileSync(other.getProfileSync()); request.setProfileSync(other.getProfileSync()); LOG.debug("[{}] Updated profile request", channelUuid);
/** * Converts Avro {@link SyncRequest} to {@link ClientSync}. * * @param source the avro structure * @return the client sync */ public static ClientSync convert(SyncRequest source) { ClientSync dest = new ClientSync(); dest.setRequestId(source.getRequestId()); dest.setClientSyncMetaData(convert(source.getSyncRequestMetaData())); dest.setBootstrapSync(convert(source.getBootstrapSyncRequest())); dest.setProfileSync(convert(source.getProfileSyncRequest())); dest.setConfigurationSync(convert(source.getConfigurationSyncRequest())); dest.setNotificationSync(convert(source.getNotificationSyncRequest())); dest.setEventSync(convert(source.getEventSyncRequest())); dest.setUserSync(convert(source.getUserSyncRequest())); dest.setLogSync(convert(source.getLogSyncRequest())); return dest; }