|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.redmine.ta.RedmineManager
public class RedmineManager
Entry point for the API: use this class to communicate with Redmine servers.
| Nested Class Summary | |
|---|---|
static class |
RedmineManager.INCLUDE
|
| Constructor Summary | |
|---|---|
RedmineManager(String uri)
|
|
RedmineManager(String host,
String apiAccessKey)
Creates an instance of RedmineManager class. |
|
RedmineManager(String uri,
String login,
String password)
|
|
| Method Summary | |
|---|---|
IssueCategory |
createCategory(IssueCategory category)
creates a new IssueCategory for the Project contained. |
Issue |
createIssue(String projectKey,
Issue issue)
Sample usage: |
Project |
createProject(Project project)
Sample usage: |
IssueRelation |
createRelation(Integer issueId,
Integer issueToId,
String type)
|
TimeEntry |
createTimeEntry(TimeEntry obj)
|
User |
createUser(User user)
|
Version |
createVersion(Version version)
creates a new Version for the Project contained. |
void |
deleteCategory(IssueCategory category)
deletes an IssueCategory. |
void |
deleteIssue(Integer id)
|
void |
deleteIssueRelations(Issue redmineIssue)
Delete all issue's relations |
void |
deleteIssueRelationsByIssueId(Integer id)
Delete relations for the given issue ID. |
void |
deleteProject(String projectKey)
|
void |
deleteRelation(Integer id)
Delete Issue Relation with the given ID. |
void |
deleteTimeEntry(Integer id)
|
void |
deleteUser(Integer userId)
|
void |
deleteVersion(Version version)
deletes a new Version from the Project contained. |
byte[] |
downloadAttachmentContent(Attachment issueAttachment)
Downloads the content of an Attachment from the Redmine server. |
Attachment |
getAttachmentById(int attachmentID)
Delivers an Attachment by its ID. |
List<IssueCategory> |
getCategories(int projectID)
delivers a list of IssueCategorys of a Project |
User |
getCurrentUser()
|
Issue |
getIssueById(Integer id,
RedmineManager.INCLUDE... include)
|
List<Issue> |
getIssues(Map<String,String> pParameters)
Generic method to search for issues. |
List<Issue> |
getIssues(String projectKey,
Integer queryId,
RedmineManager.INCLUDE... include)
|
List<Issue> |
getIssuesBySummary(String projectKey,
String summaryField)
There could be several issues with the same summary, so the method returns List. |
List<News> |
getNews(String projectKey)
|
int |
getObjectsPerPage()
This number of objects (tasks, projects, users) will be requested from Redmine server in 1 request. |
Project |
getProjectByKey(String projectKey)
|
List<Project> |
getProjects()
Load the list of projects available to the user, which is represented by the API access key. |
List<SavedQuery> |
getSavedQueries()
Get all "saved queries" available to the current user. |
List<SavedQuery> |
getSavedQueries(String projectKey)
Get "saved queries" for the given project available to the current user. |
List<IssueStatus> |
getStatuses()
Delivers a list of existing IssueStatuses. |
List<TimeEntry> |
getTimeEntries()
|
List<TimeEntry> |
getTimeEntriesForIssue(Integer issueId)
|
TimeEntry |
getTimeEntry(Integer id)
|
List<Tracker> |
getTrackers()
|
User |
getUserById(Integer userId)
|
List<User> |
getUsers()
Load the list of users on the server. |
Version |
getVersionById(int versionId)
|
List<Version> |
getVersions(int projectID)
delivers a list of Versions of a Project |
void |
setLogin(String login)
|
void |
setObjectsPerPage(int pageSize)
This number of objects (tasks, projects, users) will be requested from Redmine server in 1 request. |
void |
setPassword(String password)
|
void |
update(Identifiable obj)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RedmineManager(String uri)
public RedmineManager(String uri,
String login,
String password)
public RedmineManager(String host,
String apiAccessKey)
host - complete Redmine server web URI, including protocol and port number. Example: http://demo.redmine.org:8080apiAccessKey - Redmine API access key. It is shown on "My Account" / "API access key" webpage
(check http://redmine_server_url/my/account URL).
This parameter is optional (can be set to NULL) for Redmine projects, which are "public".| Method Detail |
|---|
public Issue createIssue(String projectKey,
Issue issue)
throws RedmineException
Issue issueToCreate = new Issue(); issueToCreate.setSubject("This is the summary line 123"); Issue newIssue = mgr.createIssue(PROJECT_KEY, issueToCreate);
projectKey - The project "identifier". This is a string key like "project-ABC", NOT a database numeric ID.issue - the Issue object to create on the server.
RedmineAuthenticationException - invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
NotFoundException - the project with the given projectKey is not found
RedmineException
public List<Project> getProjects()
throws RedmineException
RedmineAuthenticationException - invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
RedmineException
public List<Issue> getIssuesBySummary(String projectKey,
String summaryField)
throws RedmineException
RedmineAuthenticationException - invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
NotFoundException
RedmineException
public List<Issue> getIssues(Map<String,String> pParameters)
throws RedmineException
pParameters - the http parameters key/value pairs to append to the rest api request
RedmineAuthenticationException - invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
NotFoundException
RedmineException
public Issue getIssueById(Integer id,
RedmineManager.INCLUDE... include)
throws RedmineException
id - the Redmine issue IDinclude - list of "includes". e.g. "relations", "journals", ...
RedmineAuthenticationException - invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
NotFoundException - the issue with the given id is not found on the server
RedmineException
public Project getProjectByKey(String projectKey)
throws RedmineException
projectKey - string key like "project-ABC", NOT a database numeric ID
RedmineAuthenticationException - invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
NotFoundException - the project with the given key is not found
RedmineException
public void deleteProject(String projectKey)
throws RedmineException
projectKey - string key like "project-ABC", NOT a database numeric ID
RedmineAuthenticationException - invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
NotFoundException - if the project with the given key is not found
RedmineException
public void deleteIssue(Integer id)
throws RedmineException
RedmineException
public List<Issue> getIssues(String projectKey,
Integer queryId,
RedmineManager.INCLUDE... include)
throws RedmineException
projectKey - ignored if NULLqueryId - id of the saved query in Redmine. the query must be accessible to the user
represented by the API access key (if the Redmine project requires authorization).
This parameter is optional, NULL can be provided to get all available issues.
RedmineAuthenticationException - invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
RedmineExceptionIssue
public void update(Identifiable obj)
throws RedmineException
RedmineException
public Project createProject(Project project)
throws RedmineException
Project project = new Project();
Long timeStamp = Calendar.getInstance().getTimeInMillis();
String key = "projkey" + timeStamp;
String name = "project number " + timeStamp;
String description = "some description for the project";
project.setIdentifier(key);
project.setName(name);
project.setDescription(description);
Project createdProject = mgr.createProject(project);
project - project to create on the server
RedmineAuthenticationException - invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
RedmineExceptionpublic int getObjectsPerPage()
public void setObjectsPerPage(int pageSize)
public List<User> getUsers()
throws RedmineException
This operation requires "Redmine Administrator" permission.
RedmineAuthenticationException - invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
NotFoundException
RedmineException
public User getUserById(Integer userId)
throws RedmineException
RedmineException
public User getCurrentUser()
throws RedmineException
RedmineException
public User createUser(User user)
throws RedmineException
RedmineException
public void deleteUser(Integer userId)
throws RedmineException
userId - user identifier (numeric ID)
RedmineAuthenticationException - invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.
NotFoundException - if the user with the given id is not found
RedmineException
public List<TimeEntry> getTimeEntries()
throws RedmineException
RedmineException
public TimeEntry getTimeEntry(Integer id)
throws RedmineException
id - the database Id of the TimeEntry record
RedmineException
public List<TimeEntry> getTimeEntriesForIssue(Integer issueId)
throws RedmineException
RedmineException
public TimeEntry createTimeEntry(TimeEntry obj)
throws RedmineException
RedmineException
public void deleteTimeEntry(Integer id)
throws RedmineException
RedmineException
public List<SavedQuery> getSavedQueries(String projectKey)
throws RedmineException
This REST API feature was added in Redmine 1.3.0. See http://www.redmine.org/issues/5737
RedmineException
public List<SavedQuery> getSavedQueries()
throws RedmineException
This REST API feature was added in Redmine 1.3.0. See http://www.redmine.org/issues/5737
RedmineException
public IssueRelation createRelation(Integer issueId,
Integer issueToId,
String type)
throws RedmineException
RedmineException
public void deleteRelation(Integer id)
throws RedmineException
RedmineException
public void deleteIssueRelations(Issue redmineIssue)
throws RedmineException
RedmineException
public void deleteIssueRelationsByIssueId(Integer id)
throws RedmineException
id - issue ID
RedmineException
public List<IssueStatus> getStatuses()
throws RedmineException
IssueStatuses.
IssueStatuses.
RedmineAuthenticationException - thrown in case something went wrong while trying to login
RedmineException - thrown in case something went wrong in Redmine
NotFoundException - thrown in case an object can not be found
public Version createVersion(Version version)
throws RedmineException
Version for the Project contained. Project for the Version must
not be null!
version - the Version. Must contain a Project.
Version created by Redmine
IllegalArgumentException - thrown in case the version does not contain a project.
RedmineAuthenticationException - thrown in case something went wrong while trying to login
RedmineException - thrown in case something went wrong in Redmine
NotFoundException - thrown in case an object can not be found
public void deleteVersion(Version version)
throws RedmineException
Version from the Project contained.
version - the Version.
RedmineAuthenticationException - thrown in case something went wrong while trying to login
RedmineException - thrown in case something went wrong in Redmine
NotFoundException - thrown in case an object can not be found
public List<Version> getVersions(int projectID)
throws RedmineException
Versions of a Project
projectID - the ID of the Project
Versions of the Project
RedmineAuthenticationException - thrown in case something went wrong while trying to login
RedmineException - thrown in case something went wrong in Redmine
NotFoundException - thrown in case an object can not be found
public Version getVersionById(int versionId)
throws RedmineException
RedmineException
public List<IssueCategory> getCategories(int projectID)
throws RedmineException
IssueCategorys of a Project
projectID - the ID of the Project
IssueCategorys of the Project
RedmineAuthenticationException - thrown in case something went wrong while trying to login
RedmineException - thrown in case something went wrong in Redmine
NotFoundException - thrown in case an object can not be found
public IssueCategory createCategory(IssueCategory category)
throws RedmineException
IssueCategory for the Project contained. Project for the IssueCategory must
not be null!
category - the IssueCategory. Must contain a Project.
IssueCategory created by Redmine
IllegalArgumentException - thrown in case the category does not contain a project.
RedmineAuthenticationException - thrown in case something went wrong while trying to login
RedmineException - thrown in case something went wrong in Redmine
NotFoundException - thrown in case an object can not be found
public void deleteCategory(IssueCategory category)
throws RedmineException
IssueCategory.
category - the IssueCategory.
RedmineAuthenticationException - thrown in case something went wrong while trying to login
RedmineException - thrown in case something went wrong in Redmine
NotFoundException - thrown in case an object can not be found
public List<Tracker> getTrackers()
throws RedmineException
Trackers available
RedmineAuthenticationException - thrown in case something went wrong while trying to login
RedmineException - thrown in case something went wrong in Redmine
NotFoundException - thrown in case an object can not be found
public Attachment getAttachmentById(int attachmentID)
throws RedmineException
Attachment by its ID.
attachmentID - the ID
Attachment
RedmineAuthenticationException - thrown in case something went wrong while trying to login
RedmineException - thrown in case something went wrong in Redmine
NotFoundException - thrown in case an object can not be found
public byte[] downloadAttachmentContent(Attachment issueAttachment)
throws RedmineCommunicationException
Attachment from the Redmine server.
issueAttachment - the Attachment
RedmineCommunicationException - thrown in case the download failspublic void setLogin(String login)
public void setPassword(String password)
public List<News> getNews(String projectKey)
throws RedmineException
projectKey - ignored if NULL
RedmineExceptionNews
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||