I am using Active Objects in Jira Plugin Development.
For a JiraWebActionSupport created with the webwork plugin module type it works perfectly fine.
@Named
public class IssueConfigAction extends JiraWebActionSupport
{
private static final Logger log =
LoggerFactory.getLogger(IssueConfigAction.class);
@ComponentImport
private final ActiveObjects ao;
private String issueId;
@Inject
public IssueConfigAction(ActiveObjects ao){
this.ao=ao;
}
@Override
protected String doExecute() throws Exception {
IssueConfig ic = ao.create(IssueConfig.class);
ic.setIssueId(issueId);
ic.save();
return SUCCESS;
}
public String getIssueId() {
return issueId;
}
public void setIssueId(String issueId) {
this.issueId = issueId;
}
}
But how can i use active objects in any other class like abstract issue action?
public class IssueTabAction extends AbstractIssueAction {
@ComponentImport
private final ActiveObjects ao;
@Inject
public IssueTabAction(IssueTabPanelModuleDescriptor descriptor) {
super(descriptor);
}
@Inject
public IssueTabAction(ActiveObjects ao) {
super();
this.ao=ao;
}
@Override
public Date getTimePerformed() {
// TODO Auto-generated method stub
return new Date();
}
@Override
protected void populateVelocityParams(Map params) {
params.put("user", ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().getDisplayName());
params.put("strings", new String[]{"1","2","3","4"});
}
}
I don't know how to inject the constructor correctly? Or is there a better way to do this?