Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Time sheet data pull not updating when refreshed.

I have a Plain Java API web based application that displays time sheet information from RTC to the user for the work items they have open or that have closed within the last 7 days.  When the application first comes up, the timesheet information is pulled from the RTC Repository just fine with the code below.  If the user then goes into RTC and updates one of the timesheet elements (lets say to add some hours, and yes they save the hours), and then refreshes the web application, the new hours added do not show up on the display.

In testing, I have gone so far as to close the browser and come back in, and refreshed in every way I can think of, but the data still shows the original pull.  If I stop and restart the web server, then the data is refreshed.  Does anyone know how I can direct the data to refresh?  I have traced the code, and every time the getReferences() method is called, it returns only the first timesheet entry, not the newly added one.

Thanks,

Bill

 public List<RTCTaskEntries> getActiveTimeSheets (RTCClient client, String username, Date startDate) throws Exception {
  // Declaration section for reusable objects/variables
  if (!TeamPlatform.isStarted()) {
   TeamPlatform.startup();
  }
  service = TeamPlatform.getTeamRepositoryService();
  teamRepository = service.getTeamRepository(client.getBaseURL());
  teamRepository.registerLoginHandler(new LoginHandler(client.username, client.password));
  teamRepository.login(monitor);
  itemManager = teamRepository.itemManager();
  processClient = (IProcessClientService) teamRepository.getClientLibrary(IProcessClientService.class);
  uri = URI.create(client.projectName.replaceAll(" ", "%20"));
  projectArea = (IProjectArea) processClient.findProcessArea(uri, null, null);
  queryClient = (IQueryClient) teamRepository.getClientLibrary(IQueryClient.class);
  wicService = (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);
  wcm = wicService.getWorkItemWorkingCopyManager();
  try {
   IWorkItemHandle wiHandle = null;
   IWorkItem wi = null;
   WorkItemWorkingCopy wc = null;
   ITimeSheetEntry tseRec; // Not able to initialize to null due to object type.
   IItemHandle refItem = null;
   // Query where clause parameters
   //Limit Project
   IQueryableAttribute projectAttribute = findAttribute(teamRepository, projectArea, IWorkItem.PROJECT_AREA_PROPERTY, null);
   Expression projectExpression = new AttributeExpression(projectAttribute, AttributeOperation.EQUALS, projectArea);
   //Limit Owner
   IQueryableAttribute ownerAttribute = findAttribute(teamRepository, projectArea, IWorkItem.OWNER_PROPERTY, null);
   Expression ownerExpression = new AttributeExpression(ownerAttribute, AttributeOperation.EQUALS, getOwner(username, teamRepository));
   //Limit to TASKs
   IQueryableAttribute typeAttribute = findAttribute(teamRepository, projectArea, IWorkItem.TYPE_PROPERTY, null);
   Expression typeExpression = new AttributeExpression(typeAttribute, AttributeOperation.EQUALS, "task");
   // Set up the where clause object
   Term term = new Term(Operator.AND);
   term.add(projectExpression);
   term.add(ownerExpression);
   term.add(typeExpression);
   IQueryResult<IResolvedResult<IWorkItem>> results = queryClient.getResolvedExpressionResults(projectArea, term, IWorkItem.FULL_PROFILE);
   while (results.hasNext(monitor)) {
    wi = results.next(monitor).getItem();
    IWorkflowInfo wfi = wicService.findWorkflowInfo(wi, monitor);
    int workFlowState = -1;
    if (wfi != null) {
     workFlowState = wfi.getStateGroup(wi.getState2());
    }
    if (((workFlowState == IWorkflowInfo.OPEN_STATES) || (workFlowState == IWorkflowInfo.IN_PROGRESS_STATES)) ||  // All Open Tasks
     ((workFlowState == IWorkflowInfo.CLOSED_STATES) && (wi.getResolutionDate().after(cutoffForClosedTasks))))  // Closed tasks which were closed 7 days before this period
    {
     // Create and populate a DTO object with work item data needed for display
     wiHandle = (IWorkItemHandle) wi.getItemHandle();
     wcm.connect(wiHandle, IWorkItem.FULL_PROFILE, monitor);
     wc = wicService.getWorkItemWorkingCopyManager().getWorkingCopy(wiHandle);
     IWorkItemReferences itemReference = wc.getReferences();
     List<IReference> times = itemReference.getReferences(WorkItemEndPoints.WORK_TIME);
     for (IReference workTimes : times) {
      if (workTimes.isItemReference()) {
       refItem = ((IItemReference) workTimes).getReferencedItem();
       if (refItem instanceof ITimeSheetEntryHandle) {
        tseRec = (ITimeSheetEntry) itemManager.fetchCompleteItem(refItem, IItemManager.REFRESH, monitor);
        IContributor creator = (IContributor) itemManager.fetchCompleteItem(tseRec.getCreator(), IItemManager.REFRESH, monitor);
        if (wiCreator.equals(creator)) {
         // Create and populate a time sheet DTO for dispaly
        }
       }
      }
     }
    }
   }
  }
  catch (Exception ex) {
   logger.error(ex.getMessage());
   throw ex;
  }
  finally {
   teamRepository.logout();
   wcm = null;
   wicService = null;
   queryClient = null;
   projectArea = null;
   uri = null;
   processClient = null;
   itemManager = null;
   teamRepository = null;
   service = null;
  }
 }

0 votes


Be the first one to answer this question!

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: May 22 '13, 8:19 a.m.

Question was seen: 4,322 times

Last updated: May 22 '13, 8:19 a.m.

Confirmation Cancel Confirm