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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

608 views 3 11
Read article

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