javarational-team-concertibm-jazz

How to get deleted workitems using RTC Java API


I want to get list of workitems that are deleted from a project.

How might I accomplish this using the RTC Java API?


Solution

  • Deleting is one this, as this thread suggests:

        IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.SMALL_PROFILE, monitor);
        IDetailedStatus status = workItemClient.deleteWorkItem(workItem, monitor);
        
        if (!status.isOK()) {
                throw new TeamRepositoryException("Error deleting work item",
                        status.getException());
        }
    
        System.out.println("Deleted work item: " + idString + ".");
    

    But listing the work items deleted is, I don't know if there is a Java API which access to the delete_items table.
    See comment 11 of Task 140053:

    There is a record in deleted_items table about all items that are deleted along with the timestamp of when they were deleted.

    Task 149432 mentions:

    Surface a delete work item action in the Eclipse UI

    So there is a visible record. Enhancement 151766 mentions that "Java ETL should handle deleted Work Items", so there might be an API as well.

    Note that it would only get your the ID of the deleted work item and the date of the deletion, not the work item itself.
    As mentioned in this thread:

    When you delete a work item, it will be lost permanently.

    Sometimes, people create a kind of "Trash Can Project Area", so deleted work items are moved to, instead to be really deleted.


    As the OP Neha S mentions in the comments, if the following code returns NULL, it can indicate a deletion:

    IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.FULL_PROFILE, monitor);