public class ProjectManager
extends java.lang.Object
Obtain it via RedmineManager:
RedmineManager redmineManager = RedmineManagerFactory.createWithUserAuth(redmineURI, login, password); ProjectManager projectManager = redmineManager.getProjectManager();
Sample usage:
projectManager.getProjectById(123); projects = projectManager.getProjects(); // create project Project project = ProjectFactory.create(); project.setName("MyProject"); project.setDescription("description"); project.setHomepage("www.mypage.com"); createdProject = projectManager.createProject(project);
RedmineManager.getIssueManager()
Modifier and Type | Method and Description |
---|---|
Project |
createProject(Project project)
Sample usage:
|
Version |
createVersion(Version version)
|
void |
deleteProject(java.lang.String projectKey) |
void |
deleteVersion(Version version)
|
java.util.List<News> |
getNews(java.lang.String projectKey) |
Project |
getProjectById(int id) |
Project |
getProjectByKey(java.lang.String projectKey) |
java.util.List<Project> |
getProjects()
Load the list of projects available to the user, which is represented by the API access key.
|
Version |
getVersionById(int versionId) |
java.util.List<Version> |
getVersions(int projectID)
|
void |
update(Project object) |
void |
update(Version object) |
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 serverRedmineAuthenticationException
- invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.RedmineException
public java.util.List<Project> getProjects() throws RedmineException
Redmine ignores "get trackers info" parameter for "get projects" request. see bug http://www.redmine.org/issues/8545 The field is already accessible for a specific project for a long time (GET /projects/:id) but in the projects list (GET /projects) it's only on the svn trunk for now (Sep 8, 2014). It will be included in Redmine 2.6.0 which isn't out yet.
RedmineAuthenticationException
- invalid or no API access key is used with the server, which
requires authorization. Check the constructor arguments.RedmineException
public Project getProjectByKey(java.lang.String projectKey) throws RedmineException
projectKey
- string key like "project-ABC", NOT a database numeric IDRedmineAuthenticationException
- 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 foundRedmineException
public Project getProjectById(int id) throws RedmineException
id
- project database Id, like 123. this is not a string "key" like "myproject".RedmineAuthenticationException
- invalid or no API access key is used with the server, which
requires authorization.NotFoundException
- the project with the given id is not foundRedmineException
public void deleteProject(java.lang.String projectKey) throws RedmineException
projectKey
- string key like "project-ABC", NOT a database numeric IDRedmineAuthenticationException
- 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 foundRedmineException
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 Redminejava.lang.IllegalArgumentException
- thrown in case the version does not contain a project.RedmineAuthenticationException
- thrown in case something went wrong while trying to loginRedmineException
- thrown in case something went wrong in RedmineNotFoundException
- thrown in case an object can not be foundpublic void deleteVersion(Version version) throws RedmineException
version
- the Version
.RedmineAuthenticationException
- thrown in case something went wrong while trying to loginRedmineException
- thrown in case something went wrong in RedmineNotFoundException
- thrown in case an object can not be foundpublic java.util.List<Version> getVersions(int projectID) throws RedmineException
projectID
- the ID of the Project
Version
s of the Project
RedmineAuthenticationException
- thrown in case something went wrong while trying to loginRedmineException
- thrown in case something went wrong in RedmineNotFoundException
- thrown in case an object can not be foundpublic Version getVersionById(int versionId) throws RedmineException
RedmineException
public void update(Project object) throws RedmineException
RedmineException
public void update(Version object) throws RedmineException
RedmineException
public java.util.List<News> getNews(java.lang.String projectKey) throws RedmineException
projectKey
- ignored if NULLRedmineException
News