@Override public void removeRepository(final Space space, final String alias) { final ConfigGroup thisRepositoryConfig = findRepositoryConfig(alias, space.getName()); try { configurationService.startBatch(); OrganizationalUnit orgUnit = Optional .ofNullable(organizationalUnitService.getOrganizationalUnit(space.getName())) .orElseThrow(() -> new IllegalArgumentException(String .format("The given space [%s] does not exist.", space.getName()))); doRemoveRepository(orgUnit, alias, thisRepositoryConfig, repo -> repositoryRemovedEvent.fire(new RepositoryRemovedEvent(repo))); } catch (final Exception e) { logger.error("Error during remove repository", e); throw new RuntimeException(e); } finally { configurationService.endBatch(); } }
@Override public void removeRepositories(final Space space, final Set<String> aliases) { try { configurationService.startBatch(); OrganizationalUnit orgUnit = Optional .ofNullable(organizationalUnitService.getOrganizationalUnit(space.getName())) .orElseThrow(() -> new IllegalArgumentException(String.format("The given space [%s] does not exist.", space.getName()))); for (final String alias : aliases) { doRemoveRepository(orgUnit, alias, findRepositoryConfig(alias, space.getName()), repo -> { }); } } catch (final Exception e) { logger.error("Error while removing repositories", e); throw new RuntimeException(e); } finally { configurationService.endBatch(); } }
@SuppressWarnings({"unchecked", "rawtypes"}) @Override public void removeGroup(Repository repository, String group) { final ConfigGroup thisRepositoryConfig = findRepositoryConfig(repository.getAlias()); if (thisRepositoryConfig != null) { final ConfigItem<List> groups = backward.compat(thisRepositoryConfig).getConfigItem("security:groups"); groups.getValue().remove(group); configurationService.updateConfiguration(thisRepositoryConfig); configuredRepositories.update(repositoryFactory.newRepository(thisRepositoryConfig)); } else { throw new IllegalArgumentException("Repository " + repository.getAlias() + " not found"); } }
@SuppressWarnings({"unchecked", "rawtypes"}) @Override public void addGroup(final Repository repository, final String group) { final ConfigGroup thisRepositoryConfig = findRepositoryConfig(repository.getAlias()); if (thisRepositoryConfig != null) { final ConfigItem<List> groups = backward.compat(thisRepositoryConfig).getConfigItem("security:groups"); groups.getValue().add(group); configurationService.updateConfiguration(thisRepositoryConfig); configuredRepositories.update(repositoryFactory.newRepository(thisRepositoryConfig)); } else { throw new IllegalArgumentException("Repository " + repository.getAlias() + " not found"); } }
@Override public Repository updateRepositoryConfiguration(final Repository repository, final RepositoryEnvironmentConfigurations repositoryEnvironmentConfigurations) { final ConfigGroup thisRepositoryConfig = findRepositoryConfig(repository.getAlias());
@SuppressWarnings({"unchecked", "rawtypes"}) @Override public void removeGroup(Repository repository, String group) { final ConfigGroup thisRepositoryConfig = findRepositoryConfig(repository.getAlias(), repository.getSpace().getName()); if (thisRepositoryConfig != null) { final ConfigItem<List> groups = backward.compat(thisRepositoryConfig).getConfigItem("security:groups"); groups.getValue().remove(group); configurationService.updateConfiguration(thisRepositoryConfig); configuredRepositories.update(repository.getSpace(), repositoryFactory.newRepository(thisRepositoryConfig)); } else { throw new IllegalArgumentException("Repository " + repository.getAlias() + " not found"); } }
@SuppressWarnings({"unchecked", "rawtypes"}) @Override public void addGroup(final Repository repository, final String group) { final ConfigGroup thisRepositoryConfig = findRepositoryConfig(repository.getAlias(), repository.getSpace().getName()); if (thisRepositoryConfig != null) { final ConfigItem<List> groups = backward.compat(thisRepositoryConfig).getConfigItem("security:groups"); groups.getValue().add(group); configurationService.updateConfiguration(thisRepositoryConfig); configuredRepositories.update(repository.getSpace(), repositoryFactory.newRepository(thisRepositoryConfig)); } else { throw new IllegalArgumentException("Repository " + repository.getAlias() + " not found"); } }
@Override public void updateContributors(final Repository repository, final List<Contributor> contributors) { final ConfigGroup thisRepositoryConfig = findRepositoryConfig(repository.getAlias(), repository.getSpace().getName()); if (thisRepositoryConfig != null) { final ConfigItem<List<Contributor>> contributorsConfigItem = thisRepositoryConfig.getConfigItem("contributors"); contributorsConfigItem.setValue(contributors); configurationService.updateConfiguration(thisRepositoryConfig); configuredRepositories.update(repository.getSpace(), repositoryFactory.newRepository(thisRepositoryConfig)); } else { throw new IllegalArgumentException("Repository " + repository.getAlias() + " not found"); } }
@Override public void removeRepository(final String alias) { final ConfigGroup thisRepositoryConfig = findRepositoryConfig(alias);