我一直试图弄清楚如何使用Atlassian SDK在我的Jira插件中创建自定义字段,但我遇到了一些问题,同时想知道文档和文档。目前,我可以使用以下代码创建自定义字段:
CustomField fieldType = customFieldManager.getCustomFieldObjectByName("Type of Work");
CustomFieldSearcher fieldTypeSearcher = customFieldManager.getCustomFieldSearcher("com.atlassian.jira.plugin.system.customfieldtypes:select");
if(fieldType == null) {
List<String> issueTypes = new ArrayList<String>();
issueTypes.add("Story");
List<String> contextTypes = new ArrayList<String>();
//contextTypes.add(GlobalIssueContext.GLOBAL_CONTEXT_STR);
contextTypes.add("Global");
/*Collection<IssueType> list = constantsManager.getAllIssueTypeObjects();
for(IssueType issueType : list) {
if(issueType.getName().equals("Story")) {
issueTypes.add(issueType);
}
}*/
/*if(issueTypes.size() == 0)
throw new Exception("Greenhopper must be installed!");*/
CustomFieldType selectFieldType = customFieldManager.getCustomFieldType("com.atlassian.jira.plugin.system.customfieldtypes:select");
try {
CustomField typeOfWorkField = customFieldManager.createCustomField("Type of Work", "Used to track a stories type of work", selectFieldType, fieldTypeSearcher, contextTypes, issueTypes);
//typeOfWorkField.
} catch (GenericEntityException e) {
writeMe += e.toString();
}
}
我的问题在于设置customFields上下文和issueTypes。我希望它能够在全球环境和绿色家园故事中发挥作用。任何人都可以帮忙吗?此外,一旦我得到了这个设置,我想设置默认屏幕。有什么想法吗?