@SuppressWarnings({"unchecked"}) private static <T extends BaseInjection> List<T> readExternal( Element element, Factory<T> factory) { final List<T> injections = new ArrayList<T>(); if (element != null) { final List<Element> list = element.getChildren(ENTRY_NAME); for (Element entry : list) { final T o = factory.create(); o.loadState(entry); injections.add(o); } } return injections; }
public <T extends TaskRepository> void setRepositories(List<T> repositories) { Set<TaskRepository> set = new HashSet<TaskRepository>(myRepositories); set.removeAll(repositories); myBadRepositories.removeAll(set); // remove all changed reps myIssueCache.clear(); myRepositories.clear(); myRepositories.addAll(repositories); reps: for (T repository : repositories) { if (repository.isShared() && repository.getUrl() != null) { List<TaskProjectConfiguration.SharedServer> servers = getProjectConfiguration().servers; TaskRepositoryType type = repository.getRepositoryType(); for (TaskProjectConfiguration.SharedServer server : servers) { if (repository.getUrl().equals(server.url) && type.getName().equals(server.type)) { continue reps; } } TaskProjectConfiguration.SharedServer server = new TaskProjectConfiguration.SharedServer(); server.type = type.getName(); server.url = repository.getUrl(); servers.add(server); } } }