我一直在尝试弄清楚如何使用 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。我希望它能够在全球范围内和 greenhoppers Story Issue 中发挥作用。任何人都可以帮忙吗?另外,一旦我完成了设置,我想设置默认屏幕。有任何想法吗?