本文整理汇总了Java中com.taskadapter.redmineapi.RedmineException类的典型用法代码示例。如果您正苦于以下问题:Java RedmineException类的具体用法?Java RedmineException怎么用?Java RedmineException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RedmineException类属于com.taskadapter.redmineapi包,在下文中一共展示了RedmineException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: doPerformAction
import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
private void doPerformAction(final String issueKey, final String actionName)
throws IOException, RedmineException {
Integer statusId = getStatusId(actionName);
if (statusId != null) {
LOGGER.debug("Executing action " + actionName + " on issue " + issueKey);
Issue issue = new Issue();
issue.setId(valueOf(issueKey));
issue.setStatusId(statusId);
redmineManager.update(issue);
} else {
LOGGER.error("Action " + actionName
+ " not found within available actions");
throw new InvalidTransitionException("Action " + actionName
+ " not executable on issue " + issueKey);
}
}
开发者ID:cyrilix,项目名称:its-redmine,代码行数:19,代码来源:RedmineItsFacade.java
示例17: findNameFor
import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see hudson.tasks.UserNameResolver#findNameFor(hudson.model.User)
*/
@Override
public String findNameFor(hudson.model.User u) {
LOGGER.info("Search username for {}", u);
RedmineManager redmineManager = getRedmineManager();
if (redmineManager == null) {
return null;
}
String userId = u.getId();
try {
return redmineManager.getUserByLogin(userId).getFullName();
} catch (RedmineException e) {
LOGGER.info("User {} not found: {}", userId, e.getMessage());
return null;
}
}
开发者ID:cyrilix,项目名称:jenkins-redmine-realm,代码行数:23,代码来源:RedmineUserNameResolver.java
示例18: findMailAddressFor
import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see hudson.tasks.MailAddressResolver#findMailAddressFor(hudson.model.User)
*/
@Override
public String findMailAddressFor(hudson.model.User u) {
RedmineManager redmineManager = getRedmineManager();
if (redmineManager == null) {
return null;
}
try {
return redmineManager.getUserByLogin(u.getId()).getMail();
} catch (RedmineException e) {
LOGGER.error("Email not found for {}", u);
return null;
}
}
开发者ID:cyrilix,项目名称:jenkins-redmine-realm,代码行数:21,代码来源:RedmineMailAddressResolver.java
示例19: getVersions
import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
protected List<Version> getVersions(boolean requireReleased) {
try {
List<com.taskadapter.redmineapi.bean.Version> versions = project.getRedmineManager()
.getVersions(Integer.valueOf(project.getProjectId()));
List<Version> result = new ArrayList<Version>(versions.size());
for (com.taskadapter.redmineapi.bean.Version version : versions) {
Version convert = convert(version);
if ( convert.isReleased()==requireReleased ) {
result.add(convert);
}
}
return result;
} catch (RedmineException e) {
throw new RuntimeException(e);
}
}
开发者ID:francm,项目名称:maven-issuetracking-plugin,代码行数:17,代码来源:RedmineVersionManager.java
示例20: releaseVersion
import com.taskadapter.redmineapi.RedmineException; //导入依赖的package包/类
@Override
public void releaseVersion(String versionValue) {
try {
List<com.taskadapter.redmineapi.bean.Version> versions = project.getRedmineManager()
.getVersions(Integer.valueOf(project.getProjectId()));
for (com.taskadapter.redmineapi.bean.Version version : versions) {
if ( versionValue.equals(version.getName()) ) {
version.setDueDate(new Date());
version.setDueDate(null);
version.setStatus("closed");
project.getRedmineManager().update(version);
return;
}
}
} catch (RedmineException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("Version not found");
}
开发者ID:francm,项目名称:maven-issuetracking-plugin,代码行数:20,代码来源:RedmineVersionManager.java
注:本文中的com.taskadapter.redmineapi.RedmineException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论