Redmine Scanner


I have developed a Redmine scanner tool which can scan Redmine for all projects,users and time entries and prepare a report for time entries in a project. This program can run as a cron-job or a scheduled job in Jenkins so that it can every day send e-mails to entire team in a project with the time entries of previous day. This will include the issue id, title, comment entered by user, its current status, completion % etc.

We can use Redmine REST API for this.

To get the list of 100 projects from Redmine. The API can return only a maximum of 100 entries, if you have more projects make further calls with an offset set.

Projects projects=redmineWebResource.path(“projects.xml”).queryParam(“limit”, “100”).get(Projects.class)

Where Projects.java can be defined as

@XmlRootElement
public class Projects {

@XmlElement(name = “project”)
private List redmineProjects;

public List getRedmineProjects() {
return redmineProjects;
}
}

RedmineProject.java

class RedmineProject {

@XmlElement(name = “id”)
private int projectId;

@XmlElement(name = “name”)
private String projectName;

@XmlElement(name = “identifier”)
private String identifier;

@XmlElement(name = “description”)
private String projectDesc;

int getProjectId() {
return projectId;
}

String getProjectName() {
return projectName;
}

String getProjectDesc() {
return projectDesc;
}

String getIdentifier() {
return identifier;
}
}

Similarly Redmine users can be obtained using

Users users=redmineWebResource.path(“users.xml”).queryParam(“limit”, “100”).get(Users.class)

Where Users.java is defined as

@XmlRootElement
public class Users {

@XmlElement(name = “user”)
private List users;

public List getUsers() {
return users;
}

@Override
public String toString() {
return “Users [users=” + users + “]”;
}

}

Now in the main class you can read all the projects, users and time entries for a day. Filter the time entries for a project and filter it again based on individual users. With this we can construct the time entries for a project. Do the same for all projects.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s