/** * Create read-only URL used for repository remote configs * * @param repository * @param host * @return URL */ public static String createRemoteReadOnlyUrl( IRepositoryIdProvider repository, String host) { return "git://" + host + "/" + repository.generateId() + SUFFIX_GIT; //$NON-NLS-1$ //$NON-NLS-2$ }
/** * Create SSH URL used for repository remote configs * * @param repository * @param host * @return URL */ public static String createRemoteSshUrl(IRepositoryIdProvider repository, String host) { return "git@" + host + ":" + repository.generateId() + SUFFIX_GIT; //$NON-NLS-1$ //$NON-NLS-2$ }
/** * Create HTTPS URL used for repository remote configs * * @param repository * @param host * @param user * @return URL */ public static String createRemoteHttpsUrl(IRepositoryIdProvider repository, String host, String user) { return "https://" + user + "@" + host + "/" + repository.generateId() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SUFFIX_GIT; }
public List<Contributor> getContributors(final IRepositoryIdProvider repo) { List<Contributor> contributors = null; try { contributors = service.getContributors(repo, false); } catch (IOException e) { log.error("Error fetching contributors for repository: {}", repo.generateId(), e); } catch (NullPointerException e) { log.error("NullPointerException fecthing contributors for repository: {}", repo.generateId(), e); } return contributors; }
public List<User> getWatchers(final IRepositoryIdProvider repo) { List<User> watchers = null; try { watchers = service.getWatchers(repo); } catch (IOException e) { log.error("IOException in getting watchers for repository: {}", repo.generateId(), e); } catch (NullPointerException npe) { log.error("NullPointerException in getting watchers for repository: {}", repo.generateId(), npe); } return watchers; }
protected List<Comment> getComments(final IRepositoryIdProvider repo, final int issueId) { List<Comment> comments = null; try { comments = service.getComments(repo, issueId); } catch (IOException e) { log.error("Exception fetching comments for issue/pullrequest {}:{}", new Object[]{repo.generateId(), issueId, e}); } return comments; }
/** * Get id for repository * * @param provider * @return non-null id */ protected String getId(IRepositoryIdProvider provider) { if (provider == null) throw new IllegalArgumentException( "Repository provider cannot be null"); //$NON-NLS-1$ final String id = provider.generateId(); if (id == null) throw new IllegalArgumentException("Repository id cannot be null"); //$NON-NLS-1$ if (id.length() == 0) throw new IllegalArgumentException("Repository id cannot be empty"); //$NON-NLS-1$ return id; }
public List<User> getCollaborators(final IRepositoryIdProvider repo) { List<User> collaborators = null; try { collaborators = service.getCollaborators(repo); } catch (IOException e) { log.error("IOException in getting watchers for repository: {}", repo.generateId(), e); } return collaborators; } }
public Collection<PullRequest> getClosedPullRequests(final IRepositoryIdProvider repository) { Collection<PullRequest> pullrequests = null; try { pullrequests = service.getPullRequests(repository, IssueService.STATE_CLOSED); } catch (IOException e) { log.error("IOException in getOpenPullRequests {} {}", new Object[]{repository.generateId(), e}); } return pullrequests; }
public List<Repository> getForks(final IRepositoryIdProvider repo) { List<Repository> forks = null; try { forks = service.getForks(repo); } catch (IOException e) { log.error("Error fetching forks for repository: {}", repo.generateId(), e); } return forks; } }
public List<CommitComment> getComments(final IRepositoryIdProvider repository, final int pullrequestId) { List<CommitComment> comments = null; try { comments = service.getComments(repository, pullrequestId); } catch (IOException e) { log.error("IO Exception fetching comments {}:{}", new Object[]{repository.generateId(), pullrequestId, e}); } return comments; }
public Repository getRepository(final IRepositoryIdProvider repo) { Repository repository = null; try { repository = service.getRepository(repo); } catch (IOException e) { log.error("IO exception fetching Repository: {}", repo.generateId(), e); } return repository; }
public Map<String, Long> getLanguages(final IRepositoryIdProvider repo) { Map<String, Long> languages = null; try { languages = service.getLanguages(repo); } catch (IOException e) { log.error("Error fetching languages for repository: {}", repo.generateId(), e); } return languages; }
public Collection<PullRequest> getOpenPullRequests(final IRepositoryIdProvider repository) { Collection<PullRequest> pullrequests = null; try { pullrequests = service.getPullRequests(repository, IssueService.STATE_OPEN); } catch (IOException e) { log.error("IOException in getOpenPullRequests {} {}", new Object[]{repository.generateId(), e}); } return pullrequests; }
public PullRequest getPullRequest(final IRepositoryIdProvider repository, final int pullrequestId) { PullRequest pullrequest = null; try { pullrequest = service.getPullRequest(repository, pullrequestId); } catch (IOException e) { log.error("IO Exception fetching PullRequest {}:{}", new Object[]{repository.generateId(), pullrequestId, e}); } return pullrequest; }
public Vertex getOrCreateRepository(final IRepositoryIdProvider repo) { return getOrCreateVertexHelper(IdCols.REPOSITORY, repo.generateId(), VertexType.REPOSITORY, repoidx); }
public Collection<IssueEvent> getIssueEvents(final IRepositoryIdProvider repo, final Issue issue) { Collection<IssueEvent> events = null; try { events = service.getIssueEvents(repo, issue); } catch (IOException e) { log.error("Exception fetching events for issue {}:{}", new Object[]{repo.generateId(), issue.getNumber(), e}); } return events; } }
/** * Get a map of date when events were added to each issue * * In the case that sys_events_added is not set null is inserted into the map. * * @param reponame the name of the repository to mine * @return a Map that maps issue_ids to the date that the events were downloaded */ public Map<Integer, Date> getIssueEventsAddedAt(final IRepositoryIdProvider repo) { final Vertex node = getOrCreateRepository(repo.generateId()); final HashMap<Integer, Date> map = new HashMap<Integer, Date>(); GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>(); pipe.start(node).out(EdgeType.ISSUE.toString()); addValuesFromIterable(pipe, map, PropertyName.NUMBER, PropertyName.SYS_EVENTS_ADDED); return map; }