1

我正在编写用于获取给定项目的所有用户故事的 java 代码。

    QueryRequest hrRequest = new QueryRequest("hierarchicalrequirement");
    hrRequest.setFetch(new Fetch("Name","Children","Release"));
    hrRequest.setWorkspace(wsRef);
    hrRequest.setProject(prjRef);

上面的代码将为我提供与迭代相关的所有用户故事(即,如果迭代为空白 - 这将不会获取该用户故事)

但是,我需要获取该项目/子项目下可用的所有用户故事

请帮忙

谢谢VG

4

1 回答 1

0

您可以设置请求的项目范围:

storyRequest.setProject(projectRef);

只要在指定 projectRef 之前:

String projectRef = "/project/2222";

这是一个打印项目中故事数量的代码:

public class aRESTstories {

    public static void main(String[] args) throws URISyntaxException, IOException {

        String host = "https://rally1.rallydev.com";
            String username = "apiuser@company.com";
            String password = "secret";
            String projectRef = "/project/2222";
            String workspaceRef = "/workspace/11111"; 
            String applicationName = "RESTExampleStoriesInProject";


        RallyRestApi restApi = new RallyRestApi(
                new URI(host),
                username,
                password);
        restApi.setApplicationName(applicationName);   


        QueryRequest storyRequest = new QueryRequest("HierarchicalRequirement");
        storyRequest.setLimit(1000);
        storyRequest.setScopedDown(true);
        storyRequest.setScopedUp(false);
        storyRequest.setWorkspace(workspaceRef);
        storyRequest.setProject(projectRef);


        QueryResponse storyQueryResponse = restApi.query(storyRequest);
        System.out.println(storyQueryResponse.getResults().size());
    }
}
于 2013-07-31T22:21:34.403 回答