@Override public EndpointUserConfigurationDto toDto() { EndpointUserConfigurationDto dto = new EndpointUserConfigurationDto(); dto.setAppToken(appToken); dto.setBody(body); dto.setSchemaVersion(schemaVersion); dto.setUserId(userId); return dto; } }
@Override public EndpointUserConfigurationDto toDto() { EndpointUserConfigurationDto dto = new EndpointUserConfigurationDto(); dto.setAppToken(appToken); dto.setBody(body); dto.setSchemaVersion(schemaVersion); dto.setUserId(userId); return dto; } }
@Override protected void onSave() { entity.setUserId(detailsView.getUserId().getValue()); entity.setSchemaVersion(detailsView.getConfigurationSchemaInfo().getValue().getVersion()); }
@Override public void editUserConfiguration(EndpointUserConfigurationDto configuration) throws ControlServiceException { ApplicationDto appDto = applicationService.findAppByApplicationToken( configuration.getAppToken()); EndpointUserDto userDto = endpointService.findEndpointUserByExternalIdAndTenantId( configuration.getUserId(), appDto.getTenantId()); if (userDto == null) { throw new NotFoundException("Specified user not found!"); } configuration.setUserId(userDto.getId()); configuration = userConfigurationService.saveUserConfiguration(configuration); EndpointObjectHash hash = EndpointObjectHash.fromString(configuration.getBody()); checkNeighbors(); OperationsNodeInfo server = resolve(configuration.getUserId()); if (server != null) { UserConfigurationUpdate msg = new UserConfigurationUpdate(appDto.getTenantId(), configuration.getUserId(), configuration.getAppToken(), configuration.getSchemaVersion(), hash.getDataBuf()); if (LOG.isTraceEnabled()) { LOG.trace("Sending message {} to [{}]", msg, Neighbors.getServerId( server.getConnectionInfo())); } neighbors.sendMessage(server.getConnectionInfo(), OperationsServiceMsg.fromUpdate(msg)); } else { LOG.warn("Can't find server for user [{}]", configuration.getUserId()); } }
protected EndpointUserConfigurationDto generateEndpointUserConfigurationDto(EndpointUserDto endpointUser, ApplicationDto applicationDto, ConfigurationSchemaDto configurationSchema, String body, boolean isNullAppDto) { EndpointUserConfigurationDto configurationDto = new EndpointUserConfigurationDto(); configurationDto.setBody(body); if (endpointUser == null) { endpointUser = generateEndpointUserDto(null); } if (!isNullAppDto) { if (applicationDto == null) { applicationDto = generateApplicationDto(); } configurationDto.setAppToken(applicationDto.getApplicationToken()); } else { return userConfigurationService.saveUserConfiguration(configurationDto); } configurationDto.setUserId(endpointUser.getId()); if (configurationSchema == null) { configurationSchema = generateConfSchemaDto(null, applicationDto.getId(), 1).get(0); } configurationDto.setSchemaVersion(configurationSchema.getVersion()); return userConfigurationService.saveUserConfiguration(configurationDto); }