private void parseLogClientSync(ClientSync sync, ByteBuffer buf, int options, int payloadLength) { LogClientSync logSync = new LogClientSync(); logSync.setRequestId(getIntFromUnsignedShort(buf)); int size = getIntFromUnsignedShort(buf); List<LogEntry> logs = new ArrayList<>(size); for (int i = 0; i < size; i++) { logs.add(new LogEntry(getNewByteBuffer(buf, buf.getInt()))); } logSync.setLogEntries(logs); sync.setLogSync(logSync); }
private static LogClientSync convert(LogSyncRequest source) { if (source == null) { return null; } LogClientSync sync = new LogClientSync(); sync.setRequestId(source.getRequestId()); if (source.getLogEntries() != null) { List<LogEntry> logs = new ArrayList<LogEntry>(source.getLogEntries().size()); for (org.kaaproject.kaa.common.endpoint.gen.LogEntry log : source.getLogEntries()) { logs.add(new LogEntry(log.getData())); } sync.setLogEntries(logs); } return sync; }
/** * 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); } }