Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

cannot access com.atlassian.plugin.web.ContextProvider

jacob delddd
Contributor
July 3, 2018

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!

1 answer

0 votes
Milnow5555
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 27, 2018

Have anyone solved this?

jacob delddd
Contributor
August 1, 2018

Had to skip it

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events