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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

790 views 2 19
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