cannot get ApplicationLinks to work.....

I have been working on this for days now.....

 

I need a plugin in JIRA that can query Bitbucket. The result of the queries need to be presented on a panel on the right side. So started with the tutorial DueDateIndicator to get control of the UI.

Next (and this is my headache) I want to get a reference to the applinks, But it fails, never enabling the plugin

 

import com.atlassian.applinks.api.ApplicationLinkResponseHandler;
import com.atlassian.applinks.api.application.stash.StashApplicationType;
import com.atlassian.applinks.api.ApplicationLink;
import com.atlassian.applinks.api.ApplicationLinkService;
import com.atlassian.crowd.embedded.api.User;
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;
public class DueDateIndicator extends AbstractJiraContextProvider
{
    private static final int MILLIS_IN_DAY = 24 * 60 * 60 * 1000;
    private final ApplicationLinkService applicationLinkService;
    public DueDateIndicator (ApplicationLinkService applicationLinkService)
    {
        this.applicationLinkService = applicationLinkService;
    }
    
    @Override
    public Map getContextMap(User user, JiraHelper jiraHelper) {
        ApplicationLink application_link = this.applicationLinkService.getPrimaryApplicationLink(com.atlassian.applinks.api.application.stash.StashApplicationType.class);
        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;
    }
}

 

This should not be the hard part right?

 

1 answer

This widget could not be displayed.

My fallback is to just use perl scripting outside of JAVA....   I would really hate going into this direction

 

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

130 views 1 3
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