本文整理汇总了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());
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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());
}
}
示例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));
}
}
示例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;
}
示例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));
}
}
示例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);
}
示例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);
}
示例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;
}
});
}