I am working on creating a custom issue type in my plugin unable to get it work even after following the tutorials.
Here is the code
package mycomp;
import mycomp.MyPluginComponent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.atlassian.jira.config.IssueTypeManager;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.config.properties.ApplicationProperties;
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import javax.inject.Inject;
import javax.inject.Named;
@Scanned
public class MyPluginComponentImpl implements MyPluginComponent{
private static final Logger log = LoggerFactory.getLogger(MyPluginComponentImpl.class);
@ComponentImport
private final ApplicationProperties applicationProperties;
@ComponentImport
private final IssueTypeManager itm;
@Inject
public MyPluginComponentImpl(ApplicationProperties applicationProperties, IssueTypeManager itm) {
this.applicationProperties = applicationProperties;
this.itm = itm;
createIssueType();
}
public String getName() {
return "testcomp";
}
public void createIssueType(){
itm.createIssueType("testcomp","Test",0l);
}
}
What is the error?
run atlas-debug. Set breakpoint to createIssueType() and have a look. But I think the right was is to implement the InitializingBean interface and create the issue type in the afterPropertiesSet method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried this code, still not clear what to implement in destroy()
still no luck......
package mycomp;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import com.atlassian.jira.extension.JiraStartedEvent;
import com.atlassian.event.api.EventListener;
import com.atlassian.event.api.EventPublisher;
import com.atlassian.jira.event.issue.IssueEvent;
import com.atlassian.jira.event.type.EventType;
import com.atlassian.jira.issue.Issue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.atlassian.jira.config.IssueTypeManager;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.config.properties.ApplicationProperties;
public class IssueCreatedResolvedListener implements InitializingBean, DisposableBean{
private static final Logger log = LoggerFactory.getLogger(IssueCreatedResolvedListener.class);
private final IssueTypeManager issueTypeManager ;
private final ApplicationProperties applicationProperties ;
public IssueCreatedResolvedListener(ApplicationProperties applicationProperties, IssueTypeManager issueTypeManager) {
this.applicationProperties = applicationProperties;
this.issueTypeManager = issueTypeManager;
}
@Override
public void afterPropertiesSet() throws Exception {
issueTypeManager.createIssueType("issueType", "issueType", "https://jira.atlassian.com/images/atlassian-jira-logo-large.png");
}
@Override
public void destroy() throws Exception {
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are not sure, then do not implement anything.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately I do not have time right now. You should learn how to debug your code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.