This is just based on the tutorial: "https://developer.atlassian.com/server/jira/platform/adding-content-to-the-jira-view-issue-page/"
package com.ebo.jira.webpanel;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.plugin.webfragment.contextproviders.AbstractJiraContextProvider;
import com.atlassian.jira.plugin.webfragment.model.JiraHelper;
import com.atlassian.jira.user.ApplicationUser;
import java.sql.Timestamp;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
import static java.time.temporal.ChronoUnit.DAYS;
//nottice that it now extends the abstract class AbstractjiracontextProvider and implenments the class getcontextmap method
public class webpanel extends AbstractJiraContextProvider{
@Override
public Map<String, Object> getContextMap(ApplicationUser applicationUser, JiraHelper jiraHelper)
{
//The getContextMap method that we implemented needs to return a Map object with a key and value that represents
// the number of days between the due date and the current date,
// so that it can be used by other parts of the module.
Map<String,Object> contextMap = new HashMap<>();
Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
Timestamp dueDate = currentIssue.getDueDate();
if(dueDate != null) {
LocalDate currentTimeInDays = null;
LocalDate dueDateTimeInDays = null;
currentTimeInDays = LocalDate.now();
dueDateTimeInDays = dueDate.toLocalDateTime().toLocalDate();
long daysAwayFromDueDateCalc = DAYS.between(currentTimeInDays, dueDateTimeInDays);
contextMap.put("daysAwayFromDueDate", daysAwayFromDueDateCalc);
}
return contextMap;
}
}
So now i get the following errors:
1/ Error:(21, 8) java: cannot access com.atlassian.plugin.web.ContextProvider
class file for com.atlassian.plugin.web.ContextProvider not found
2/Error:(23, 3) java: method does not override or implement a method from a supertype
I know that the tutorial is outdated, but don't think that this part of it is outdated.
Thanks in advance!
Have anyone solved this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.