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); }
/** * 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.setUserSync(other.getUserSync()); request.setUserSync(other.getUserSync()); LOG.debug("[{}] Updated user 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; }