RTC java client user work resource allocation

Read work resource allocation to the user in projectarea and teamarea


// Create this object before accessing the api

IContributorHandle iContributorHandle;
ITeamRepository repo;
ITeamAreaHandle teamAreaHendle;
IProgressMonitor monitor;
IResourcePlanningClient resourcePlanningClient;





IContributor contributor =
        (IContributor) repo.itemManager().fetchCompleteItem(iContributorHandle, IItemManager.DEFAULT, null);
    System.out.println(contributor.getName() + " " + contributor.getUserId());

    IContributorInfo info =
        resourcePlanningClient.getResourcePlanningManager().getContributorInfo(contributor, true, monitor);
    ItemCollection<IWorkResourceDetails> workDetails = info.getWorkDetails(contributor);

    long totalResource = 0;
    for (IWorkResourceDetails iWorkResourceDetails : workDetails) {

      if (iWorkResourceDetails.getOwner().getItemId().getUuidValue()
          .equals(teamAreaHendle.getItemId().getUuidValue())) {
        totalResource = iWorkResourceDetails.getAssignment();
      }
    }
    System.out.println(totalResource + " " + contributor.getName());

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations