当前位置: 首页>>代码示例>>Java>>正文


Java RedmineException类代码示例

本文整理汇总了Java中com.taskadapter.redmineapi.RedmineException的典型用法代码示例。如果您正苦于以下问题:Java RedmineException类的具体用法?Java RedmineException怎么用?Java RedmineException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RedmineException类属于com.taskadapter.redmineapi包,在下文中一共展示了RedmineException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createNewIssue

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
private void createNewIssue(ILoggingEvent event, String hash) throws RedmineException {
    Issue issue = IssueFactory.create(projectId, title + " - " + dateFormat.format(new Date(event.getTimeStamp())));

    String description = transformDescription(event);

    if (gitSupport) {
        String gitNavigation = showGitNavigation(event);

        issue.setDescription(gitNavigation + description);
    } else {
        issue.setDescription(description);
    }

    issue = issueManager.createIssue(issue);

    maps.put(hash, issue.getId());
}
 
开发者ID:kewang,项目名称:logback-redmine-appender,代码行数:18,代码来源:RedmineAppender.java

示例2: getChildEntries

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
/**
 * Delivers a list of a child entries.
 * 
 * @param classs
 *            target class.
 */
public <T> List<T> getChildEntries(Class<?> parentClass, String parentKey, Class<T> classs) throws RedmineException {
	final EntityConfig<T> config = getConfig(classs);
	final URI uri = getURIConfigurator().getChildObjectsURI(parentClass,
			parentKey, classs, new BasicNameValuePair("limit", String.valueOf(objectsPerPage)));

	HttpGet http = new HttpGet(uri);
	String response = send(http);
	final JSONObject responseObject;
	try {
		responseObject = RedmineJSONParser.getResponse(response);
		return JsonInput.getListNotNull(responseObject, config.multiObjectName, config.parser);
	} catch (JSONException e) {
		throw new RedmineFormatException("Bad categories response " + response, e);
	}
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:22,代码来源:Transport.java

示例3: addUserToGroup

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
public void addUserToGroup(int userId, int groupId) throws RedmineException {
	logger.debug("adding user " + userId + " to group " + groupId + "...");
	URI uri = getURIConfigurator().getChildObjectsURI(Group.class, Integer.toString(groupId), User.class);
	HttpPost httpPost = new HttpPost(uri);
	final StringWriter writer = new StringWriter();
	final JSONWriter jsonWriter = new JSONWriter(writer);
	try {
		jsonWriter.object().key("user_id").value(userId).endObject();
	} catch (JSONException e) {
		throw new RedmineInternalError("Unexpected exception", e);
	}
	String body = writer.toString();
	setEntity(httpPost, body);
	String response = send(httpPost);
	logger.debug(response);
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:17,代码来源:Transport.java

示例4: addWatcherToIssue

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
public void addWatcherToIssue(int watcherId, int issueId) throws RedmineException {
	logger.debug("adding watcher " + watcherId + " to issue " + issueId + "...");
	URI uri = getURIConfigurator().getChildObjectsURI(Issue.class, Integer.toString(issueId), Watcher.class);
	HttpPost httpPost = new HttpPost(uri);
	final StringWriter writer = new StringWriter();
	final JSONWriter jsonWriter = new JSONWriter(writer);
	try {
		jsonWriter.object().key("user_id").value(watcherId).endObject();
	} catch (JSONException e) {
		throw new RedmineInternalError("Unexpected exception", e);
	}
	String body = writer.toString();
	setEntity(httpPost, body);
	String response = send(httpPost);
	logger.debug(response);
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:17,代码来源:Transport.java

示例5: processContent

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
@Override
public Void processContent(BasicHttpResponse content)
		throws RedmineException {
	final byte[] buffer = new byte[4096 * 4];
	int readed;
	try {
		final InputStream input = content.getStream();
		try {
			while ((readed = input.read(buffer)) > 0)
				outStream.write(buffer, 0, readed);
		} finally {
			input.close();
		}
	} catch (IOException e) {
		throw new RedmineCommunicationException(e);
	}
	return null;
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:19,代码来源:CopyBytesHandler.java

示例6: validateConnection

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
@Override
public void validateConnection(TaskRepository repository) throws RedmineException
{	
	RedmineClient client = createClientFromTaskRepository(repository, new CachedRepositoryConfiguration());
	
	try
	{
		client.validateConnection();
	}
	catch (RedmineException e)
	{
		throw e;
	}
	finally
	{
		client.shutdown();
	}
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:19,代码来源:RedmineClientManager.java

示例7: getConfigurationFileForUrl

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
private File getConfigurationFileForUrl(String repositoryUrl) throws RedmineException
{
	String encodedFilename = null; 
	
	try
	{
		encodedFilename = URLEncoder.encode(repositoryUrl,"UTF-8");
	}
	catch (UnsupportedEncodingException e)
	{
		throw new RedmineException("Failed to encode repository url as filename",e);
	}
	
	File destinationFile = stateLocationPath.append(encodedFilename).toFile();
	return destinationFile;
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:17,代码来源:RedmineClientManager.java

示例8: getIssuesByProject

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
@Override
	public Iterable<Issue> getIssuesByProject(Project project) throws RedmineException
	{
		List<Issue> issues = manager.getIssueManager().getIssues(project.getIdentifier(),null,Include.journals);
		
//		List<Issue> issuesWithJournals = new ArrayList<Issue>();
//		
//		for(Issue i : issues)
//		{
//			Issue issueWithJournals = manager.getIssueManager().getIssueById(i.getId(), Include.journals);
//			issuesWithJournals.add(issueWithJournals);
//		}
//		
//		return issuesWithJournals;
		
		return issues;
	}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:18,代码来源:RedmineClient.java

示例9: loadConfiguration

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
public void loadConfiguration() throws RedmineException
{
	User u = manager.getUserManager().getCurrentUser();
	
	configuration.setCurrentUser(u);
	
	if(configuration.isEmpty())
	{
		for(Membership m : u.getMemberships())
		{
			Project p = manager.getProjectManager().getProjectById(m.getProject().getId());
			
			configuration.addProject(p);
			
			List<Version> versions = manager.getProjectManager().getVersions(m.getProject().getId());
			
			configuration.addVersionsToProject(p, versions);
		}
		
		configuration.addStatuses(manager.getIssueManager().getStatuses());
		configuration.addTrackers(manager.getIssueManager().getTrackers());
		configuration.addUsers(manager.getUserManager().getUsers());		
	}
	
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:26,代码来源:RedmineClient.java

示例10: getTaskData

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
@Override
public TaskData getTaskData(TaskRepository repository, String taskIdOrKey, IProgressMonitor monitor)
		throws CoreException
{

	try
	{
		IRedmineClient client = getClientManager().getClient(repository);
		
		Issue issue = client.getIssueById(Integer.parseInt(taskIdOrKey));
		
		
		return taskDataHandler.createTaskDataFromIssue(repository, issue, client.getCachedRepositoryConfiguration());
		
	}
	catch (RedmineException e)
	{
		throw new CoreException(new RepositoryStatus(Status.ERROR, RedmineCorePlugin.PLUGIN_ID, RepositoryStatus.ERROR_NETWORK, "Error performing query.",e));
	}
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:21,代码来源:RedmineRepositoryConnector.java

示例11: validateRepository

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
@Override
public RepositoryInfo validateRepository(TaskRepository repository, IProgressMonitor monitor) throws CoreException
{
	RepositoryInfo info = new RepositoryInfo(new RepositoryVersion("1"));		
	
	try
	{
		clientManager.validateConnection(repository);
	}
	catch (RedmineException e)
	{
		throw new CoreException(new Status(IStatus.ERROR, RedmineCorePlugin.PLUGIN_ID, "Error connecting to repository",e));
	}
	
	return info;
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:17,代码来源:RedmineRepositoryConnector.java

示例12: getContent

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
@Override
public InputStream getContent(TaskRepository repository, ITask task, TaskAttribute attachmentAttribute,
		IProgressMonitor monitor) throws CoreException
{
	TaskAttachmentMapper mapper = TaskAttachmentMapper.createFrom(attachmentAttribute);
			
	try
	{
		IRedmineClient client = redmineRepositoryConnector.getClientManager().getClient(repository);
		Attachment attachment = client.getAttachmentById(Integer.parseInt(mapper.getAttachmentId()));
		return client.downloadAttachment(attachment);
	}
	catch (RedmineException e)
	{
		throw new CoreException(new RepositoryStatus(Status.ERROR, RedmineCorePlugin.PLUGIN_ID, RepositoryStatus.ERROR_NETWORK, "Error downloading attachment.",e));
	}		
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:18,代码来源:RedmineTaskAttachmentHandler.java

示例13: getClosingMessage

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
private String getClosingMessage() {
    Validate.notNull(redmineGovernorConfiguration, "Redmine Governor configuration must be set.");

    String username = null;
    try {
        final User apiKeyUser = redmineManager.getUserManager().getCurrentUser();
        username = apiKeyUser.getLogin();
    } catch (RedmineException e) {
        logger.log(Level.WARNING, "Could not get redmine user.", e);
    }

    if (username == null || username.isEmpty()) {
        username = "unknown";
    }

    return String.format(redmineGovernorConfiguration.getClosingMessage(), username);
}
 
开发者ID:arquillian,项目名称:arquillian-governor,代码行数:18,代码来源:RedmineGovernorClient.java

示例14: getOpeningMessage

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
private String getOpeningMessage() {
    Validate.notNull(redmineGovernorConfiguration, "Redmine Governor configuration must be set.");

    String username = null;
    try {
        final User apiKeyUser = redmineManager.getUserManager().getCurrentUser();
        username = apiKeyUser.getLogin();
    } catch (RedmineException e) {
        logger.log(Level.WARNING, "Could not get redmine user.", e);
    }

    if (username == null || username.isEmpty()) {
        username = "unknown";
    }

    return String.format(redmineGovernorConfiguration.getOpeningMessage(), username);
}
 
开发者ID:arquillian,项目名称:arquillian-governor,代码行数:18,代码来源:RedmineGovernorClient.java

示例15: addComment

import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
/**
 * @see com.googlesource.gerrit.plugins.hooks.its.ItsFacade#addComment(java.lang.String,
 *      java.lang.String)
 */
@Override
public void addComment(final String issueId, final String comment)
    throws IOException {

  if (comment == null || comment.trim().isEmpty()) {
    return;
  }

  execute(new Callable<String>() {
    @Override
    public String call() throws Exception {
      Issue issue = new Issue();
      issue.setId(convertIssueId(issueId));
      issue.setNotes(comment);

      try {
        redmineManager.update(issue);
      } catch (RedmineException e) {
        LOGGER.error("Error in add comment: {}", e.getMessage(), e);
        throw new IOException(e.getMessage(), e);
      }
      return issueId;
    }
  });
}
 
开发者ID:cyrilix,项目名称:its-redmine,代码行数:30,代码来源:RedmineItsFacade.java


注:本文中的com.taskadapter.redmineapi.RedmineException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。