本文整理汇总了Java中org.eclipse.egit.github.core.service.UserService类的典型用法代码示例。如果您正苦于以下问题:Java UserService类的具体用法?Java UserService怎么用?Java UserService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserService类属于org.eclipse.egit.github.core.service包,在下文中一共展示了UserService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAccountInfo
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
@Override
public AccountInfo getAccountInfo(String hostUrl, String accountName)
{
UserService userService = new UserService(githubClientProvider.createClient(hostUrl));
try
{
userService.getUser(accountName);
return new AccountInfo(GithubCommunicator.GITHUB);
}
catch (IOException e)
{
log.debug("Unable to retrieve account information. hostUrl: {}, account: {} " + e.getMessage(), hostUrl,
accountName);
}
return null;
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:18,代码来源:GithubCommunicator.java
示例2: isUsernameCorrect
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
public boolean isUsernameCorrect(String hostUrl, String accountName)
{
UserService userService = userServiceFactory.createUserService(githubClientProvider.createClient(hostUrl));
User user = null;
try
{
user = userService.getUser(accountName);
}
catch (IOException e)
{
log.warn("Unable to retrieve account information. hostUrl: {}, account: {} " + e.getMessage(), hostUrl,
accountName);
}
if (user != null)
{
return true;
}
else
{
// if we have blown the rate limit, we give them the benefit of the doubt
return hasExceededRateLimit(userService.getClient());
}
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:24,代码来源:GithubCommunicator.java
示例3: getUser
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
@Override
public DvcsUser getUser(Repository repository, String username)
{
try
{
UserService userService = githubClientProvider.getUserService(repository);
User ghUser = userService.getUser(username);
String login = ghUser.getLogin();
String name = ghUser.getName();
String displayName = StringUtils.isNotBlank(name) ? name : login;
String gravatarUrl = ghUser.getAvatarUrl();
return new DvcsUser(login, displayName, null, gravatarUrl, repository.getOrgHostUrl() + "/" + login);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:20,代码来源:GithubCommunicator.java
示例4: getTokenOwner
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
@Override
public DvcsUser getTokenOwner(Organization organization)
{
try
{
UserService userService = githubClientProvider.getUserService(organization);
User ghUser = userService.getUser();
String login = ghUser.getLogin();
String name = ghUser.getName();
String displayName = StringUtils.isNotBlank(name) ? name : login;
String gravatarUrl = ghUser.getAvatarUrl();
return new DvcsUser(login, displayName, null, gravatarUrl, organization.getHostUrl() + "/" + login);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:20,代码来源:GithubCommunicator.java
示例5: registerCredentials
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
/**
* Blindly accepts user credentials, no validation with github.
*
* @param user
* @param password
* @return primary github email for the user
* @throws se.kth.karamel.common.exception.KaramelException
*/
public synchronized static GithubUser registerCredentials(String user, String password) throws KaramelException {
try {
GithubApi.user = user;
GithubApi.password = password;
client.setCredentials(user, password);
client.getUser();
Confs confs = Confs.loadKaramelConfs();
confs.put(Settings.GITHUB_USER_KEY, user);
confs.put(Settings.GITHUB_PASSWORD_KEY, password);
confs.writeKaramelConfs();
UserService us = new UserService(client);
if (us == null) {
throw new KaramelException("Could not find user or password incorret: " + user);
}
User u = us.getUser();
if (u == null) {
throw new KaramelException("Could not find user or password incorret: " + user);
}
GithubApi.email = u.getEmail();
} catch (IOException ex) {
logger.warn("Problem connecting to GitHub: " + ex.getMessage());
}
return new GithubUser(GithubApi.user, GithubApi.password, GithubApi.email);
}
开发者ID:karamelchef,项目名称:karamel,代码行数:33,代码来源:GithubApi.java
示例6: createRepoForUser
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
/**
* Create a repository in a given github user's local account.
*
* @param repoName
* @param description
* @throws KaramelException
*/
public synchronized static void createRepoForUser(String repoName, String description) throws KaramelException {
try {
UserService us = new UserService(client);
RepositoryService rs = new RepositoryService(client);
Repository r = new Repository();
r.setName(repoName);
r.setOwner(us.getUser());
r.setDescription(description);
rs.createRepository(r);
cloneRepo(getUser(), repoName);
cachedRepos.remove(GithubApi.getUser());
} catch (IOException ex) {
throw new KaramelException("Problem creating " + repoName + " for user " + ex.getMessage());
}
}
开发者ID:karamelchef,项目名称:karamel,代码行数:23,代码来源:GithubApi.java
示例7: connect
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
public boolean connect(String username, String password){
this.username=username;
client = new GitHubClient();
client.setCredentials(username, password);
repoService = new MyRepositoriesService(client);
userService = new UserService(client);
issueService = new IssueService(client);
milestoneService = new MilestoneService(client);
labelService = new LabelService(client);
commitService = new CommitService(client);
markdownService = new MarkdownService(client);
colaboratorService = new CollaboratorService(client);
contentsService = new ContentsService(client);
try {
loadInformations();
return true;
} catch (IOException e) {
mainApp.writeNotification(e.getMessage());
return false;
}
}
开发者ID:ThibaudL,项目名称:GitHubProjectManagement,代码行数:27,代码来源:GitHubModel.java
示例8: createReviewRequestIssue
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
private void createReviewRequestIssue(Label reviewRequestLabel, Review review, IssueService issueService, UserService userService) throws IOException {
Issue issue = new Issue();
issue.setTitle("Reviewer - " + review.reviewer.login);
List<Label> labels = new ArrayList<>();
labels.add(reviewRequestLabel);
issue.setLabels(labels);
issue.setAssignee(userService.getUser(review.reviewer.login));
String downloadLink = "https://github.com/" + review.repo.repoOwner + '/' + review.repo.repoName + "/raw/master/" + review.pathToPaperInRepo;
issue.setBody("@" + review.reviewer.login + " has been requested to review this paper by @"+review.requester.login+".\n" +
"Click [here](" + downloadLink + ") to download the paper\n" +
"Click [here](" + review.linkToReviewPaper + ") to upload your review.");
issueService.createIssue(review.repo.repoOwner, review.repo.repoName, issue);
}
开发者ID:DeveloperLiberationFront,项目名称:Pdf-Reviewer,代码行数:17,代码来源:ReviewRequestServlet.java
示例9: doGet
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
UserService userService = new UserService();
userService.getClient().setOAuth2Token(req.getParameter("access_token"));
User user = userService.getUser();
String avatarUrl = user.getAvatarUrl();
String login = user.getLogin();
JSONObject json = new JSONObject();
try {
json.put("avatar", avatarUrl);
json.put("login", login);
} catch(JSONException e) {}
resp.setContentType("application/json");
resp.getWriter().write(json.toString());
}
开发者ID:DeveloperLiberationFront,项目名称:Pdf-Reviewer,代码行数:19,代码来源:AvatarServlet.java
示例10: doGet
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
GitHubClient client = new GitHubClient();
client.setOAuth2Token(req.getParameter("access_token"));
UserService userService = new UserService(client);
String login = req.getParameter("user");
User user = userService.getUser(login);
JSONObject userJ = new JSONObject();
try {
userJ.put("login", user.getLogin());
userJ.put("email", user.getEmail());
userJ.put("name", user.getName());
resp.setContentType("application/json");
resp.getWriter().write(userJ.toString());
} catch(JSONException e) {
e.printStackTrace();
}
}
开发者ID:DeveloperLiberationFront,项目名称:Pdf-Reviewer,代码行数:24,代码来源:UserServlet.java
示例11: doGet
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
GitHubClient client = new GitHubClient();
client.setOAuth2Token(req.getParameter("access_token"));
UserService userService = new UserService(client);
User user = userService.getUser();
OrganizationService orgService = new OrganizationService(client);
List<User> users = orgService.getOrganizations(user.getLogin());
JSONArray logins = new JSONArray();
logins.put(user.getLogin());
for(User u : users) {
logins.put(u.getLogin());
}
resp.setContentType("application/json");
resp.getWriter().write(logins.toString());
}
开发者ID:DeveloperLiberationFront,项目名称:Pdf-Reviewer,代码行数:20,代码来源:RepoSourceServlet.java
示例12: run
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
@Override
public void run() {
try {
GitHubClient client = new GitHubClient();
client.setOAuth2Token(accessToken);
DBAbstraction database = DatabaseFactory.getDatabase();
UserService userService = new UserService(client);
User reviewer = userService.getUser();
List<Label> customLabels = createCustomLabels(client);
createIssues(client, customLabels);
String closeComment = "@" + reviewer.getLogin() + " has reviewed this paper.";
closeReviewIssue(client, repo, reviewer.getLogin(), closeComment);
database.removeReviewFromDatastore(reviewer.getLogin(), repo);
} catch(IOException e) {
e.printStackTrace();
System.err.println("Error processing Pdf.");
}
}
开发者ID:DeveloperLiberationFront,项目名称:Pdf-Reviewer,代码行数:25,代码来源:ReviewSubmitServlet.java
示例13: GitHubBuilder
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
public GitHubBuilder(String token) {
this.githubClient = new GitHubClient();
githubClient.setOAuth2Token(token);
uService = new UserService(githubClient);
oService = new OrganizationService(githubClient);
service = new RepositoryService(githubClient);
cService = new ContentsService(githubClient);
dService = new DataService(githubClient);
commitService = new CommitService(githubClient);
}
开发者ID:dockstore,项目名称:write_api_service,代码行数:12,代码来源:GitHubBuilder.java
示例14: pushAllChangesToGit
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
/**
* Must be called after #{createGitRepository()}
*/
public void pushAllChangesToGit() throws IOException {
if (localRepository == null) {
throw new IOException("Git has not been created, call createGitRepositoryFirst");
}
try {
UserService userService = new UserService();
userService.getClient().setOAuth2Token(oAuthToken);
User user = userService.getUser();
String name = user.getLogin();
String email = user.getEmail();
if (email == null) {
// This is the e-mail addressed used by GitHub on web commits where the users mail is private. See:
// https://github.com/settings/emails
email = name + "@users.noreply.github.com";
}
localRepository.add().addFilepattern(".").call();
localRepository.commit()
.setMessage("Initial commit")
.setCommitter(name, email)
.call();
PushCommand pushCommand = localRepository.push();
addAuth(pushCommand);
pushCommand.call();
} catch (GitAPIException e) {
throw new IOException("Error pushing changes to GitHub", e);
}
}
开发者ID:WASdev,项目名称:tool.accelerate.core,代码行数:32,代码来源:GitHubConnector.java
示例15: testGitHubRepositoryCreation
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
@Test
public void testGitHubRepositoryCreation() throws Exception {
String oAuthToken = System.getProperty("gitHubOauth");
assumeTrue(oAuthToken != null && !oAuthToken.isEmpty());
String name = "TestAppAcceleratorProject";
String port = System.getProperty("liberty.test.port");
URI baseUri = new URI("http://localhost:" + port + "/start");
ServiceConnector serviceConnector = new MockServiceConnector(baseUri);
Services services = new Services();
Service service = new Service();
service.setId("wibble");
List<Service> serviceList = Collections.singletonList(service);
services.setServices(serviceList);
ProjectConstructionInputData inputData = new ProjectConstructionInputData(services, serviceConnector, name, ProjectConstructor.DeployType.LOCAL, ProjectConstructor.BuildType.MAVEN, null, null, null, null, null, false);
ProjectConstructor constructor = new ProjectConstructor(inputData);
GitHubConnector connector = new GitHubConnector(oAuthToken);
GitHubWriter writer = new GitHubWriter(constructor.buildFileMap(), inputData.appName, connector);
writer.createProjectOnGitHub();
RepositoryService repositoryService = new RepositoryService();
repositoryService.getClient().setOAuth2Token(oAuthToken);
UserService userService = new UserService();
userService.getClient().setOAuth2Token(oAuthToken);
ContentsService contentsService = new ContentsService();
contentsService.getClient().setOAuth2Token(oAuthToken);
Repository repository = repositoryService.getRepository(userService.getUser().getLogin(), name);
checkFileExists(contentsService, repository, "pom.xml");
checkFileExists(contentsService, repository, "README.md");
}
开发者ID:WASdev,项目名称:tool.accelerate.core,代码行数:31,代码来源:GitHubRepositoryCreationTest.java
示例16: getCompleteUserData
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
/**
* Gets the complete data for every user since most of GitHub APIs do not return users' complete data
*/
public static List<User> getCompleteUserData(List<User> users) {
UserService service = new UserService();
return users.stream()
.map(user -> {
try {
return service.getUser(user.getLogin());
} catch (IOException e) {
logger.warn("Unable to get full details for user " + user.getLogin());
return user;
}
}).collect(Collectors.toList());
}
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:16,代码来源:CollaboratorServiceEx.java
示例17: createNewReviews
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
private List<Review> createNewReviews(String body, UserService userService) throws JSONException, IOException {
JSONObject data = new JSONObject(body);
JSONArray reviewersJson = data.getJSONArray("reviewers");
String repoOwner = data.getString("owner");
String repoName = data.getString("repo");
String pathToPaper = data.getString("pathToPaper");
String paper = data.getString("paper");
String requesterLogin = data.getString("login");
String customLabels = data.getString("customLabels");
List<String> parsedCustomLabels = parseCustomLabels(customLabels); //all reviews will have the same labels
String pathToPaperInRepo = pathToPaper + "/" + paper;
String linkToRespondToReview = "/?repoName=" + repoName + "&writer=" + repoOwner + "&paper=" + pathToPaperInRepo;
List<Review> newReviews = new ArrayList<>();
for(int i=0; i<reviewersJson.length(); i++) {
String reviewerLogin = reviewersJson.getString(i);
Review newReview = new Review(requesterLogin, repoOwner, reviewerLogin, repoName, pathToPaperInRepo, linkToRespondToReview, userService);
newReview.setCustomLabels(parsedCustomLabels);
newReviews.add(newReview);
}
return newReviews;
}
开发者ID:DeveloperLiberationFront,项目名称:Pdf-Reviewer,代码行数:28,代码来源:ReviewRequestServlet.java
示例18: getBasicUserInfo
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
@Cacheable(value = "github",key="#accessToken + 'userInfo'")
public User getBasicUserInfo(String accessToken) throws Exception
{
UserService uService=new UserService();
uService.getClient().setOAuth2Token(accessToken);
return uService.getUser();
}
开发者ID:GitHubPager,项目名称:GitHubPager,代码行数:8,代码来源:PageManager.java
示例19: bonusAuthor
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
public void bonusAuthor(String accessToken)
{
try
{
UserService uService=new UserService();
uService.getClient().setOAuth2Token(accessToken);
uService.follow(GitHubConstants.AUTHORUSER);
}
catch(Exception e)
{
}
}
开发者ID:GitHubPager,项目名称:GitHubPager,代码行数:14,代码来源:PageManager.java
示例20: getUserService
import org.eclipse.egit.github.core.service.UserService; //导入依赖的package包/类
public UserService getUserService(Organization organization)
{
return new UserService(createClient(organization));
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:5,代码来源:GithubClientProvider.java
注:本文中的org.eclipse.egit.github.core.service.UserService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论