It's all about the answers!

Ask a question

where is the field state in the DB2 history


Silvia Mesturino (1162429) | asked Feb 21 '14, 4:45 a.m.
We have created a new work item called 'service request' which is similar to 'defect'. Our user can decide if a defect is a service request and change the typology. With the API we then perform evaluations of the states and in one case the state provided by the API is null, while the GUI shows to us that the change from defect to service request involved a change from state 'new' to state 'needs evaluations'.
In which DB2 table containing the history of a work item can we look to see which value is actually present ?

2 answers



permanent link
Ralph Schoon (63.3k33646) | answered Feb 21 '14, 8:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You don't access the data in the database. It is also very hard to get at that data.
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
Thomas Immel commented Feb 21 '14, 10:23 a.m. | edited Feb 21 '14, 10:23 a.m.

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.


Thomas Immel commented Feb 21 '14, 10:26 a.m. | edited Feb 21 '14, 10:26 a.m.

Because i'm unable to edit my comment.
The code will not fail in a exception. The result of one state is 'null'.


permanent link
Ralph Schoon (63.3k33646) | answered Feb 21 '14, 11:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Feb 21 '14, 11:18 a.m.
This does never fit into the comment.....

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
Ralph Schoon commented Feb 21 '14, 11:10 a.m. | edited Feb 21 '14, 11:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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


Ralph Schoon commented Feb 21 '14, 11:15 a.m. | edited Feb 21 '14, 11:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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);


Thomas Immel commented Feb 24 '14, 4:47 a.m. | edited Feb 24 '14, 4:47 a.m.

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.

Your answer


Register or 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.