예제 #1
0
  public static IWorkItem getWorkItem(UUID itemId) throws TeamRepositoryException {
    if (TeamPlatform.isStarted()
        && TeamPlatform.getTeamRepositoryService().getTeamRepositories().length > 0) {
      for (ITeamRepository repo : TeamPlatform.getTeamRepositoryService().getTeamRepositories()) {
        IWorkItemHandle wih = (IWorkItemHandle) IWorkItem.ITEM_TYPE.createItemHandle(itemId, null);

        if (wih == null) return null;

        IAuditableClient ac = (IAuditableClient) repo.getClientLibrary(IAuditableClient.class);
        IWorkItem wi = (IWorkItem) ac.resolveAuditable(wih, IWorkItem.SMALL_PROFILE, null);
        if (wi != null) {
          return wi;
        }
      }
    }
    return null;
  }
예제 #2
0
  public static IWorkItem getCurrentWorkItem() throws TeamRepositoryException {
    if (TeamPlatform.isStarted()
        && TeamPlatform.getTeamRepositoryService().getTeamRepositories().length > 0) {
      IWorkItemHandle wih = ClientModel.getWorkItemActivationManager().getActiveWorkItem();

      if (wih == null) return null;

      for (ITeamRepository repo : TeamPlatform.getTeamRepositoryService().getTeamRepositories()) {
        IAuditableClient ac = (IAuditableClient) repo.getClientLibrary(IAuditableClient.class);
        IWorkItem wi = (IWorkItem) ac.resolveAuditable(wih, IWorkItem.SMALL_PROFILE, null);
        if (wi != null) {
          return wi;
        }
      }
    }
    return null;
  }
예제 #3
0
  public static URI getCurrentWorkItemURI() throws TeamRepositoryException {
    if (TeamPlatform.isStarted()
        && TeamPlatform.getTeamRepositoryService().getTeamRepositories().length > 0) {
      IWorkItemHandle wih = ClientModel.getWorkItemActivationManager().getActiveWorkItem();

      if (wih == null) return null;

      for (ITeamRepository repo : TeamPlatform.getTeamRepositoryService().getTeamRepositories()) {
        IAuditableClient ac = (IAuditableClient) repo.getClientLibrary(IAuditableClient.class);
        IWorkItem wi = (IWorkItem) ac.resolveAuditable(wih, IWorkItem.SMALL_PROFILE, null);
        if (wi != null) {
          return URI.create(
              repo.getRepositoryURI()
                  + "resource/itemName/com.ibm.team.workitem.WorkItem/"
                  + wi.getId());
        }
      }
    }
    return null;
  }
예제 #4
0
  public static URI getWorkItemURI(UUID itemId) throws TeamRepositoryException {
    if (TeamPlatform.isStarted()
        && TeamPlatform.getTeamRepositoryService().getTeamRepositories().length > 0) {
      for (ITeamRepository repo : TeamPlatform.getTeamRepositoryService().getTeamRepositories()) {
        IWorkItemHandle wih = (IWorkItemHandle) IWorkItem.ITEM_TYPE.createItemHandle(itemId, null);
        IAuditableClient ac = (IAuditableClient) repo.getClientLibrary(IAuditableClient.class);
        try {
          IWorkItem wi = (IWorkItem) ac.resolveAuditable(wih, IWorkItem.SMALL_PROFILE, null);
          if (wi != null) {
            return URI.create(
                repo.getRepositoryURI()
                    + "resource/itemName/com.ibm.team.workitem.WorkItem/"
                    + wi.getId());
          }
        } catch (ItemNotFoundException e) {

        }
      }
    }
    return null;
  }