Querying for change/modification events to work items
Hi,
I was wondering if there is a way to query for all modifications to work items, such as the addition of a new comment or the change of the status in a particular week. The idea is to find all events that were displayed in the event log section of the team concert view in a particular week. The best would be if that includes the build notifications and the modifications to work items (and possibly the changes to change sets). I couldn't find out if that information is stored anywhere explicitly in the repository and how I could query for it. What I tried so far is using the ChangeEventQueryModel to query for changes to a period of time using the code pasted below using RTC 1.0.1. However, this does not seem to give me the proper results as there are a lot less results as expected, and I am not quite sure what I am doing wrong. Are the change events actually stored properly and I can query for them no matter how far back in time I query? I assume that I could go through all work items, get all states and see when the modification date of the state is, but that seems fairly slow and I then would also have to find a way to find the build notifications, so I was hoping to be able to use the change event query. (I also tried the code below using an IDataQuery instead of an IItemQuery, but it still doesn't seem to be correct, especially if I go back further in time.) I would be very grateful for suggestions. Calendar instance= Calendar.getInstance(); instance.set(2009, 5, 7,0,0); Timestamp after= new Timestamp(instance.getTimeInMillis()); instance.set(2009, 5, 11,0,0); Timestamp before= new Timestamp(instance.getTimeInMillis()); ChangeEventQueryModel changeModel= ChangeEventQueryModel.ROOT; IItemQuery changeQuery= IItemQuery.FACTORY.newInstance(changeModel); changeQuery.setResultLimit(100); IPredicate predicate2= changeModel.eventTime()._gtOrEq(changeQuery.newDateTimeArg()); predicate2= predicate2._and(changeModel.eventTime()._lt(changeQuery.newDateTimeArg())); changeQuery.filter(predicate2); changeQuery.orderByDsc(changeModel.eventTime()); List<Object> params= new ArrayList<Object>(5); ItemQueryIterator<IChangeEventHandle> query3= null; params.add(after); params.add(before); query3= new ItemQueryIterator<IChangeEventHandle>(getAuditableCommon(), changeQuery, params.toArray(), 1000); try { while (query3.hasNext(null)) { IChangeEventHandle next= (IChangeEventHandle) query3.next(null); IItem fetchCompleteItem= fRepository.itemManager().fetchCompleteItem(next, IItemManager.DEFAULT, new NullProgressMonitor()); System.out.println("Item: "+fetchCompleteItem); } } catch (TeamRepositoryException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } |
5 answers
Geoffrey Clemm (30.1k●3●30●35)
| answered Nov 17 '09, 11:53 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I'll let the work item team comment in detail, but note that some of
what you are looking for are not changes to the state of the work item, but rather changes to objects that are related to the work item. In particular, a change set is not part of the work item (it is a separate object), and therefore a modification to a change set would not result in a modification to a work item that refers to it. Similarly, the creation of a reference from a build to a work item does not change the work item (and therefore results in no new entries in the change history of the work item). There is a work item requesting that the addition and removal of a link to a work item appear in the change history of that work item, but I believe that is not currently the case. Cheers, Geoff fritz wrote: Hi, |
You have to keep in mind that change events are removed from the
database in a certain period (I think the default is 3 weeks) and as such you will not be able to go back in time much. This is configurable in the Admin properties though as far as I remember. Otherwise, querying on change-events should bring you there, because feeds use the same (generating news entries from change events). Hi, -- Benjamin Pasero Work Item & UI Commons Team |
Hi Geoff and Ben,
thanks a lot for your quick responses and the good clarifications. It helps a lot to know that the change-events are not stored long-term, as that means that I can stop following that path. What I am trying to do is to recreate the events that occurred in a particular week but more than 3 weeks ago. From what I understand of your comments, it seems that I will have to go through change sets, work items and builds separately and query what happened to them in the week I am looking for to reconstruct if there was a change event in the event log of the team viewer and what the change consisted of. For change sets this is fine as I can query for the day of modification and then do a structural diff on the before and after version. For work items it seems that I will have to go through all of them and then for each work item find all of its states and see if any of those states has a modified date that falls within that week and then somehow reconstruct what was changed and probably something similar for builds, but I haven't looked into the latter. Does that sound reasonable to you or is there a better way of doing it? Thanks again, Thomas I haven't looked into build reports yet, but probably one of the |
fritz wrote:
Hi Geoff and Ben, Yes we do that for the work item history (the history tab on a work item). We resolve all previous states and compute a diff to show the full history (cant use changeevents because of the timeout). See com.ibm.team.workitem.ide.ui.internal.editor.presentations.HistoryPart and how it computes the history.
-- Benjamin Pasero Work Item & UI Commons Team |
|
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.