I’m trying to create a servlet which outputs all the non-working days of a board in an ajile project.
This includes the user added non-working days: e.g. courntry specific holidays.
The JIRA software version I’m using is 8.14.1.
I’m thinking that I can use the classes WorkingDaysManager or WorkingDaysService to create a WorkingDaysConfig Object, and go from there to get the non-working days information that I need.
The problem is that I can’t find a way to get an instance of WorkingDaysManager or WorkingDaysService.
I’ve included the following maven package in my pom.xml file.
<dependency>
<groupId>com.atlassian.jira.plugins</groupId>
<artifactId>jira-greenhopper-plugin</artifactId>
<version>6.7.7</version>
<scope>provided</scope>
</dependency>
From there, I tried using the @ComponentImport spring annotation to include the components, but when I access the servlet page I get a 404 error and no error messages are output in the JIRA consol.
Here is the java file with the @ComponentImport.
package com.example;
import java.io.PrintWriter;
import java.io.IOException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.greenhopper.service.rapid.view.workingdays.WorkingDaysService;
public class NonWorkingDaysServlet extends HttpServlet {
@ComponentImport
private final WorkingDaysService workingDaysService;
public NonWorkingDaysServlet(WorkingDaysService workingDaysService) {
this.workingDaysService = workingDaysService;
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
PrintWriter printWriter = null;
// Set output type
response.setContentType("text/html");
printWriter = response.getWriter();
try {
printWriter.println("Success");
} catch (Exception e) {
// Do nothing
}
}
}
Is there a way to get an instance of either of these classes in a plugin?
And if there is no way of doing that, is there another way to retreive non-working days in a plugin?