开发者

Updating Jira Plugin from Version 3 to Version 4, Replacing SearchParameter

i am pretty new to Jira Development so please be patient I should upgrade a Plugin that worked with Jira Version 3 to work with Jira Version 4

Most of the thins went pretty well, but now i am kind of stuck The SearchParameter and the ProjectParameter Class are not available in the new Version and i dont exacly know how to replace them. its really just this few lines of code, where its needed

these Classes are outdated: SearchParameter and ProjectParameter

i looked in the jira doc buts its seems pretty complicated, you would do me a great favor if you could help me

SearchRequest sr = srs.getFilter(ctx, filterId);
...
SearchParameter param = sr.getParam(new ProjectParameter().getName());   
... 
List columns = columnLayout
                   .getVisibleColumnLayoutItems(user, 
                                param.getValues(), Collections.EMPTY_LIST);

It would even Help if y开发者_如何转开发ou could explain what the seccond Line intends Thanks in advance


I can't help you rewrite the plugin entirely, but I can try help you decipher what those quoted lines of code mean:

SearchRequest sr = srs.getFilter(ctx, filterId);

This line loads a saved SearchRequest with the corresponding filterId.

SearchParameter param = sr.getParam(new ProjectParameter().getName());

This line gets the Project search parameter that was saved in the SearchRequest. As you may know, SearchRequests (or saved filters if you prefer) all you to save a search from JIRA with parameters defined. One possible parameter to define is a ProjectParameter. So if your search is "all issues in project X", then you would have a SearchParameter in your SearchRequest which is a ProjectParameter that knows to search for project X.

List columns = columnLayout
                   .getVisibleColumnLayoutItems(user, 
                            param.getValues(), Collections.EMPTY_LIST);

This line retrieves the ColumnLayoutItems which are visible to the specified user, for the specified projects of the SearchRequest (by extracting the value from the ProjectParameter of the SearchRequest as retrieved in line 2).

It's a bit unclear what this code is attempting to do without more context, but that's what those lines are doing anyway. You might find the API documentation useful:

  • http://docs.atlassian.com/jira/3.13/
  • http://docs.atlassian.com/jira/3.13/com/atlassian/jira/issue/fields/layout/column/ColumnLayout.html
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜