Getting package import error while creating due-date-indicator plugin?

parvati r I'm New Here Oct 23, 2017

Hi Guys,

I am attempting to build a due-date-indicator plugin. I have imported my code into the eclipse. I am getting errors in the package import statement in the .java file. In the .java file I am getting error in the "package com.atlassian.jira.user;" statement. In the eclipse it is showing error hint as "The declared package "com.atlassian.jira.user" does not match the expected package "com.example.plugins.tutorial". By keeping this error in the file I run my code using atlas command. I got the error in the Jira view issue page "Error rendering 'com.example.plugins.tutorial.duedate:due-date-indicator'. Please contact your JIRA administrators". How to resolve this error?

My .java file:

package com.example.plugins.tutorial;
package com.atlassian.jira.user;
import com.atlassian.jira.user.ApplicationUser;

import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.plugin.webfragment.contextproviders.AbstractJiraContextProvider;
import com.atlassian.jira.plugin.webfragment.model.JiraHelper;

import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
import java.io.*;
import java.lang.*;
public class DueDateIndicator extends AbstractJiraContextProvider
{
private static final int MILLIS_IN_DAY = 24 * 60 * 60 * 1000;

@Override
public Map getContextMap(ApplicationUser applicationUser, JiraHelper jiraHelper) {
Map contextMap = new HashMap();
Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
Timestamp dueDate = currentIssue.getDueDate();
if (dueDate != null)
{
int currentTimeInDays = (int) (System.currentTimeMillis() / MILLIS_IN_DAY);
int dueDateTimeInDays = (int) (dueDate.getTime() / MILLIS_IN_DAY);

int daysAwayFromDueDateCalc = dueDateTimeInDays - currentTimeInDays + 1;
contextMap.put("daysAwayFromDueDate", daysAwayFromDueDateCalc);
}
return contextMap;
}

//@Override
//public Map getContextMap(ApplicationUser arg0, JiraHelper arg1) {
//TODO Auto-generated method stub
// return null;
//}



}

Thanks in advance




0 answers

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,942 views 12 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot