简体   繁体   English

检索表单以在JIRA Rest Java Client中创建问题

[英]Retrieving form to create issue in JIRA Rest Java Client

I am trying to create a program that would display mandatory fields for a particular issue type for a project. 我正在尝试创建一个程序,该程序将显示项目特定问题类型的必填字段。 So far I am able to display values for projects and issues using the JRJC. 到目前为止,我已经能够使用JRJC显示项目和问题的价值。 However I am not able to figure out how to display a default screen. 但是我不知道如何显示默认屏幕。 Anybody face the same issue ? 有人面临同样的问题吗?

Thanks 谢谢

Thats right - you need to call the createmeta call with the project key, the issue type key and then expand the fields - 没错-您需要使用项目密钥,问题类型密钥调用createmeta调用,然后展开字段-

curl -D- -u fred:fred -X GET -H "Content-Type: application/json" http://kelpie9:8081/rest/api/2/issue/createmeta?projectKeys=QA&issuetypeNames=Bug&expand=projects.issuetypes.fields

This will give you a list of fields and you can check if this field is required or not. 这将为您提供字段列表,您可以检查是否需要此字段。

The JRJC equivalent is the getCreateMetaData call 相当于JRJC的是getCreateMetaData调用

GetCreateIssueMetadataOptions  options = new GetCreateIssueMetadataOptionsBuilder()
        .withExpandedIssueTypesFields()

        .withProjectKeys("CGIM")
        .build();
         List myList=(List) restClient.getIssueClient().getCreateIssueMetadata(options, pm); // getting the issue creation metadata relatively to the project im searching for
        java.util.Iterator<CimProject> it1=myList.iterator();
        while(it1.hasNext())
        {
                CimProject c=it1.next();
                List issueT=(List) c.getIssueTypes(); // getting the list of issue types linked to this project
                java.util.Iterator<CimIssueType> it2=issueT.iterator();
                while (it2.hasNext())
                {
                    CimIssueType issueType=it2.next();
                    System.out.print(issueType.getName());
                    Map<String, CimFieldInfo> fieldList=issueType.getFields(); // getting the list of fields linked to each issue type
                    for(Entry<String, CimFieldInfo> entry : fieldList.entrySet()) {
                        String cle = entry.getKey();
                        CimFieldInfo valeur = entry.getValue();
                        System.out.println(valeur.getName());
                    }
                }


        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM