configurationDto.setDescription(DEFAULT_STRUCT_DESC); configurationDto.setEndpointGroupId(groupId); configurationDto.setCreatedUsername(savedSchema.getCreatedUsername()); ConfigurationDto savedConfiguration = saveConfiguration(configurationDto); if (savedConfiguration != null) {
@Override public ConfigurationDto editConfiguration(ConfigurationDto configuration) throws KaaAdminServiceException { checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { String username = getCurrentUser().getUsername(); if (isEmpty(configuration.getId())) { configuration.setCreatedUsername(username); checkEndpointGroupId(configuration.getEndpointGroupId()); } else { configuration.setModifiedUsername(username); ConfigurationDto storedConfiguration = controlService.getConfiguration( configuration.getId()); Utils.checkNotNull(storedConfiguration); checkEndpointGroupId(storedConfiguration.getEndpointGroupId()); } return controlService.editConfiguration(configuration); } catch (StaleObjectStateException ex) { LOG.error( "Someone has already updated the configuration. Reload page to be able to edit it. ", ex); throw new KaaAdminServiceException( "Someone has already updated the configuration. Reload page to be able to edit it.", ServiceErrorCode.GENERAL_ERROR); } catch (Exception ex) { throw Utils.handleException(ex); } }
configurationDto.setSchemaVersion(configurationSchemaDto.getVersion()); configurationDto.setCreatedTime(oldConfiguration.getCreatedTime()); configurationDto.setCreatedUsername(oldConfiguration.getCreatedUsername()); LOG.debug("Update existing configuration with id: [{}]", configurationDto.getId()); } else {