コード例 #1
0
 private List<String> getRepositoryAliases(final Collection<Repository> repositories) {
   final List<String> repositoryList = new ArrayList<String>();
   for (Repository repo : repositories) {
     repositoryList.add(repo.getAlias());
   }
   return repositoryList;
 }
コード例 #2
0
  @SuppressWarnings({"unchecked", "rawtypes"})
  @Override
  public void removeRepository(
      final OrganizationalUnit organizationalUnit, final Repository repository) {
    final ConfigGroup thisGroupConfig = findGroupConfig(organizationalUnit.getName());

    if (thisGroupConfig != null) {
      final ConfigItem<List> repositories = thisGroupConfig.getConfigItem("repositories");
      repositories.getValue().remove(repository.getAlias());

      configurationService.updateConfiguration(thisGroupConfig);

      final OrganizationalUnit updatedOrganizationalUnit =
          organizationalUnitFactory.newOrganizationalUnit(thisGroupConfig);
      registeredOrganizationalUnits.put(
          updatedOrganizationalUnit.getName(), updatedOrganizationalUnit);
    } else {
      throw new IllegalArgumentException(
          "OrganizationalUnit " + organizationalUnit.getName() + " not found");
    }
  }