where is the field state in the DB2 history
In which DB2 table containing the history of a work item can we look to see which value is actually present ?
2 answers
I would suggest to look into the API calls and try to find out why it is null. I am unsure why that should happen.
Comments
Here is the code how we fetch the state:
List<IAuditableHandle> list = mRepository.itemManager().fetchAllStateHandles(workItem, mMonitor);
List<IWorkItem> items = mRepository.itemManager().fetchPartialStates(list,
Arrays.asList(IWorkItem.STATE_PROPERTY, IWorkItem.MODIFIED_PROPERTY), mMonitor);
for(IWorkItem w: items){
result.put(w.modified(), mWorkFlowInfo.getStateName(w.getState2()));
}
This code works fine for about 8000 defects, but fail for a single defect.
Because i'm unable to edit my comment.
The code will not fail in a exception. The result of one state is 'null'.
I am not sure what you try to achieve here. The code above does not fetch the current workflow state of the work item.
fetchAllStateHandles
Retrieves the full history of the given auditable item. The auditable item states retrieved as part of the resulting history object are complete states. The operation fails if the client is not logged in to the repository.The item states in the result are considered immutable. The client must not attempt to modify any of these item states.
fetchPartialStates
Retrieves the specified state of the item with the specified item types and item ids and state ids; the resulting items may be partial, but will have at least the given list of properties. All items must be of the same type, but the list may include multiple states of the same item.
Items returned by this method will have their origin set to the repository associated with this manager.
So what you are doing is, you get the historical states of a work item and then for each historical state, you get the workflow state that the work item had.
Is that what you try to achieve here? Or do you want to get the current workflow state of the work item?
I assume if you go through the history of a work item, there could be one with no state, or a null state. Not sure.
Comments
State in the context above has two different meanings
1. The state (version) of the work item 1st version created and saved, 2nd version created and saved etc.....
2. The workflow state
With your code, you won't see the workflow states as they are in the UI. The UI shows only the current state of the work item (and the current workflow state).
https://rsjazz.wordpress.com/2012/11/26/manipulating-work-item-states/ shows code around this.
Code to find the current workflow state of the current/latest state of a work item would look like
int id = new Integer(idString).intValue();
IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.SMALL_PROFILE, monitor);
Yes, we want to see the history and all changes of the state for a single workItem.
The output is used for detailed reporting.
As i already mentioned this works fine for about 8000 workItems. But for one workItem, we see in the API call that some values are null.
Nevertheless the Webclient show always a valid value (in this case a String from the enumeration) for these timestamps.
We think this null values result from a DB2 problem and we want to fix this state on database level.
We know the workitem and the timestamp. We don't know the correct table to look for.