public boolean apply(RepositoryHandle repoHandle) { return p.apply(repoHandle.getName()); }
private String buildExcerpt(final FileRevision firstRevision, final List<FileRevision> revisionList) { final StringBuffer excerpt = new StringBuffer(); excerpt.append(firstRevision.getComment()).append("\n"); int count = 0; for (final FileRevision fileRevision : revisionList) { count++; excerpt.append(fileRevision.getPath()).append("\n"); if (count > MAX_FILES) { excerpt.append("..."); break; } } return excerpt.toString(); }
public boolean currentUserCanView(RepositoryHandle repository) { Principal user = getCurrentUser(); return userManager.hasPermissionToAccess(user, repository) || (isAnon(user) && AppConfig.getsConfig().isCruAnonAccessAllowed() && repository.getCfg().isAnonAccessAllowed()); }
public ChangeSet getCommitChangeSet(final CommitEvent commitEvent) { try { Disposer.pushThreadInstance(); final String repositoryName = commitEvent.getRepositoryName(); final String changeSetId = commitEvent.getChangeSetId(); final RepositoryManager repositoryManager = AppConfig.getsConfig().getRepositoryManager(); final RepositoryHandle repositoryHandle = repositoryManager.getRepository(repositoryName); final RepositoryEngine repositoryEngine = repositoryHandle.acquireEngine(); final RevisionCache revisionCache = repositoryEngine.getRevisionCache(); return revisionCache.getChangeSet(changeSetId); } catch (final DbException e) { log.error("Error getting changeset", e); } catch (final StateException e) { log.error("Error getting changeset", e); } finally { Disposer.popThreadInstance(); } return null; } }
private RepositoryEngine getRepositoryEngine(final String repositoryName, final List<Message> errors, final String username) { try { final RepositoryHandle handle = AppConfig.getsConfig().getRepositoryManager().getRepository(repositoryName); if (handle == null) { errors.add(new DefaultMessage("studio.search.errors.no.repository.found", repositoryName)); return null; } if (!hasPermissionToView(username, handle)) { return null; } return handle.acquireEngine(); } catch (final RepositoryHandle.StateException e) { errors.add(new DefaultMessage("studio.search.errors.opening.repository", repositoryName)); return null; } }
public void deleteRepository(final String repName) throws FisheyeAccessorException { AppConfig.getsConfig().getRepositoryManager().getRepository(repName).stop(); final int id = getRepositoryId(repName); try { AppConfig.getsConfig().getConfig().removeRepository(id); AppConfig.getsConfig().saveConfig(); AppConfig.getsConfig().getRepositoryManager().reloadList(); } catch (final IndexOutOfBoundsException e) { throw new FisheyeAccessorException( "Error retrieving repository '" + repName + "' for id '" + id + "'. Unable to delete.", e); } catch (final IOException e) { throw new FisheyeAccessorException( "Error saving fisheye config when deleting repository '" + repName + "'."); } catch (final ConfigException e) { throw new FisheyeAccessorException( "Error reloading fisheye config when deleting repository '" + repName + "'."); } }
public URI getRepositoryUri(final URI baseUri, final RepositoryHandle repository) { final String repositoryName = repository.getName(); return UriBuilder .fromUri(baseUri) .path("changelog") .path(repositoryName) .build(); }
private String getPathToCurrentRepo(String repositoryKey, List<RepositoryHandle> repositoryHandles) { String pathToCurrentRepo = null; for(RepositoryHandle handle : repositoryHandles) { if(handle.getName().equals(repositoryKey)) { final SvnRepType repType = handle.getCfg().getRepositoryTypeConfig().getSvn(); final String repositoryPath = repType.getPath(); if(!StringUtils.isBlank(repositoryPath)) { pathToCurrentRepo = repositoryPath + "/"; } else { pathToCurrentRepo = ""; } break; } } if(pathToCurrentRepo == null) { log.warn("Could not find a path for repository " + repositoryKey); pathToCurrentRepo = repositoryKey + "/"; } return pathToCurrentRepo; }
public void updateRepositories(Set<String> repositoriesToUpdate) { try { for (String name : repositoriesToUpdate) { RepositoryType repositoryType = getRepositoryType(name); // set up linkers setupLinkers(name, repositoryType); // some extra magic for linkers to work final RepositoryHandle repositoryHandle = AppConfig.getsConfig().getRepositoryManager().getRepository(name); repositoryHandle.getCfg().setupLinker(); } // save the config AppConfig.getsConfig().saveConfig(); // refresh config final RepositoryManager rm = AppConfig.getsConfig().getRepositoryManager(); rm.reloadList(); } catch (IOException e) { throw new RuntimeException(e); } catch (ConfigException e) { throw new RuntimeException(e); } } /**
private String buildExcerpt(final FileRevision firstRevision, final List<FileRevision> revisionList) { final StringBuffer excerpt = new StringBuffer(); excerpt.append(firstRevision.getComment()).append("\n"); int count = 0; for (final FileRevision fileRevision : revisionList) { count++; excerpt.append(fileRevision.getPath()).append("\n"); if (count > MAX_FILES) { excerpt.append("..."); break; } } return excerpt.toString(); }
public ChangeSet getCommitChangeSet(final CommitEvent commitEvent) { try { Disposer.pushThreadInstance(); final String repositoryName = commitEvent.getRepositoryName(); final String changeSetId = commitEvent.getChangeSetId(); final RepositoryManager repositoryManager = AppConfig.getsConfig().getRepositoryManager(); final RepositoryHandle repositoryHandle = repositoryManager.getRepository(repositoryName); final RepositoryEngine repositoryEngine = repositoryHandle.acquireEngine(); final RevisionCache revisionCache = repositoryEngine.getRevisionCache(); return revisionCache.getChangeSet(changeSetId); } catch (final DbException e) { log.error("Error getting changeset", e); } catch (final StateException e) { log.error("Error getting changeset", e); } finally { Disposer.popThreadInstance(); } return null; } }
private RepositoryEngine getRepositoryEngine(final String repositoryName, final List<Message> errors, final String username) { try { final RepositoryHandle handle = AppConfig.getsConfig().getRepositoryManager().getRepository(repositoryName); if (handle == null) { errors.add(new DefaultMessage("studio.search.errors.no.repository.found", repositoryName)); return null; } if (!hasPermissionToView(username, handle)) { return null; } return handle.acquireEngine(); } catch (final RepositoryHandle.StateException e) { errors.add(new DefaultMessage("studio.search.errors.opening.repository", repositoryName)); return null; } }
public Iterable<FileRevisionData> get() { return filter(transform(changeSet.getRevisionsIterable(), toRevisionData(repositoryHandle.getName())), nonZeroModifiedLines); } });
private ActivityObject buildActivityObject(URI baseUri, RepositoryHandle repositoryHandle) { URI repositoryUri = uriProvider.getRepositoryUri(baseUri, repositoryHandle); return new ActivityObject(ActivityObject.params() .id(new StreamsUriBuilder().setUrl(repositoryUri.toASCIIString()).getUri().toASCIIString()) .activityObjectType(repository()) .title(option(repositoryHandle.getCfg().getRepositoryTypeConfig().getDescription())) .alternateLinkUri(repositoryUri)); } }
public URI getChangelogUri(final URI baseUri, final FileRevisionData revision, final RepositoryHandle repository) { final String repositoryName = repository.getName(); final String revisionPath = revision.getPath(); final String csId = revision.getCsid(); return UriBuilder .fromUri(baseUri) .path("browse") .path(repositoryName) .path(revisionPath) .queryParam("r", csId) .build(); }
public Collection<String> getRepositoryNames() { // Get FishEye projects final Collection<String> results = new ArrayList<String>(); final List<RepositoryHandle> handles = AppConfig.getsConfig().getRepositoryManager().getHandles(); for (final RepositoryHandle handle : handles) { results.add(handle.getName()); } return results; }
private Set<String> getLocalProjectKeys() { final Set<String> repoData = new HashSet<String>(); for (final RepositoryHandle h : AppConfig.getsConfig().getRepositoryManager().getHandles()) { repoData.add(h.getName()); } return repoData; }
public Set<String> getLocalProjectKeys() { Set<String> repoData = new HashSet<String>(); for (RepositoryHandle h : AppConfig.getsConfig().getRepositoryManager().getHandles()) { repoData.add(h.getName()); } return repoData; }
private Set<String> getLocalProjectKeys() { final Set<String> repoData = new HashSet<String>(); for (final RepositoryHandle h : AppConfig.getsConfig().getRepositoryManager().getHandles()) { repoData.add(h.getName()); } return repoData; }