【问题标题】:Jazz RTC Java API: How to list Components owned by a Project AreaJazz RTC Java API:如何列出项目区域拥有的组件
【发布时间】:2021-05-22 18:51:02
【问题描述】:

我正在为 IBM Rational Team Concert(IBM aka Jazz RTC)工作。

如何列出特定项目区域拥有的所有组件? 需要哪些 API 调用?

我在IProjectArea 实例中找不到任何getter,也找不到具有此类方法的服务或客户端实例。而且我不知道如何为此目的使用IComponentSearchCriteria

【问题讨论】:

    标签: java groovy rational-team-concert


    【解决方案1】:

    项目区域拥有的组件可以使用IComponentSearchCriteria进行查询。但是,API 并不太清楚如何指定拥有的项目区域。

    1. 从包含findComponents 方法的ITeamRepository 中获取IWorkspaceManager
    2. 为您的项目区域获取IProjectAreaHandle。我只有项目区域名称,check this question to learn how to get the IProjectAreaHandle for the project area name.
    3. 创建一个IComponentSearchCriteria 并将filterByOwnerOptional 设置为您的IProjectAreaHandle 实例。
    4. 致电IWorkspaceManager.findComponents(...) 以获取IComponentHandles 的列表。第一个参数是搜索条件。 se第二个参数是最大结果数(我设置为IWorkspaceManager.MAX_QUERY_SIZE,也就是512。第三个参数是进度监视器,可能是null
    5. 如果您需要获取组件名称、描述或其他属性,则需要调用IItemManager.fetchCompleteItems(...) 获取完整的IComponent 实例。

    这是 Groovy 中的一个示例:

    List<IComponentHandle> listComponents(String projectAreaName) {
        final manager = repositoty.getClientLibrary(IWorkspaceManager) as IWorkspaceManager;
        final criteria = IComponentSearchCriteria.FACTORY.newInstance();
        final IProjectArea projectArea = findProjectAreaByName(projectAreaName)
        criteria.filterByOwnerOptional.add(projectArea)
        final List<IComponentHandle> handles =  manager.findComponents(criteria, IWorkspaceManager.MAX_QUERY_SIZE, null)
        final itemManager = repositoty.itemManager()
        return itemManager.fetchCompleteItems(handles, IItemManager.DEFAULT, null) as List<IComponent>
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-18
      • 1970-01-01
      相关资源
      最近更新 更多