How to discover workflow transitions by oslc?
Hello,
I like to change a work Items state. According to the documentation at https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20 it is possible to modify it by action.
In the resource Shape I find the possible state Id's but no transition Id's to come from one state in another.
Is there a possiblility to discover the transition Id's? Best would be a view like it is in the Project Area configuration => work Items => workflows Transitions in the web client.
Best regards
I like to change a work Items state. According to the documentation at https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20 it is possible to modify it by action.
In the resource Shape I find the possible state Id's but no transition Id's to come from one state in another.
Is there a possiblility to discover the transition Id's? Best would be a view like it is in the Project Area configuration => work Items => workflows Transitions in the web client.
Best regards
One answer
I think this is a good place to start. The links above are very useful as well.
https://jazz.net/forum/questions/32674/change-workitem-state-via-rest/99991
Comments
Andre Carlos Antunes de Oliveira
Aug 10 '16, 10:23 p.m.Dear Melanie,
I have the same question, and I did not find a solution, but I have tried a workaround.
Perhaps it works to you to.
This workaround uses the process configuration source of the desired project area.
If this project area uses process of other area, I got the process configuration source from that project area.
I retrieve the process-configuration file copying it from the RTC Eclipse Client.
In the RTC Eclipse Client, I open the project area and go to the “Process Configuration Source”, expand all nodes, copy this and paste in notepad, and save it as “[project area name]-process-configuration.xml”
Sorry, but I can’t find a way to retrieve this file using OSLC or a Reportable REST API.
So, into this process configuration file, there are some places to look for.
Using the JUnit Project sample as reference, let’s say that we want to now the workflows transitions for the task workitem type.
In the process configuration source, we look for <workflowDefinition id=”com.ibm.team.workitem.taskWorkflow”>.
There, we will see that task workitem type has a <workflow description> tag, <action> tags and <state> tags (where is possible to see the possible actions this specific state can do).
With this information, we can mount our “state transitions” map.
Well, only with this, there isn’t possible to change the state of a task. We must now the pre-conditions to save this workitem.
We have to find the <behavior> tag, the <operation> tag with id=”com.ibm.team.workitem.operation.workItemSave”, the <property> tag with workItemTypeCategory=”com.ibm.team.workitem.workItemType.task”, and <property> tags.
We need to “translate” the <property id = …>. In the case, the “id” is “com.ibm.team.workitem.attribute.summary”.
I can’t find a place in the process configuration file to get this “translate”. So, I look in the resourceshape of the workitem (in our example, I get https://<servername>:<serverport>/<rtcpath>/oslc/context/<projectareaID>/shapes/workitems/task), and I look for “summary” in title or name. In our example, this is <dcterms:title> tag (using OSLC version 2.0).
Now, we have the required attributes to save a task workitem, the states and the actions to change the state.
So, we can do a ‘PUT’ in then workitem representation, and putting, at the final of the url, the “&_action=<action found in process configuration>” (I use the oslc.properties and oslc.prefix to do a partial update).
There are other details to observe when changing a work item, like If-Match request header, and other things described in https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20 (Work Items Service provider for OSLC 2.0 CM Specification).
Well, I agree that it isn’t a simple, elegant and complete workaround, but it worked to me ...
Finally, I suggest you read these forum threads …
“Is there a way to retrieve via oslc all states urls”
“Change WorkItem State via REST”
… and this wiki pages …
Process Specification Syntax: https://jazz.net/wiki/bin/view/Main/ProcessSpecificationSyntax#ProcessSpecification
Custom Configuration Data Syntax:
https://jazz.net/wiki/bin/view/Main/CustomConfigurationDataSyntax
Custom Precondition Syntax:
https://jazz.net/wiki/bin/view/Main/CustomPreconditionSyntax
And, at last, I really wish that your “four year waiting an answer” ends soon.
Excuse me if my english language skills hinders understanding …
Best regards,
André
1 vote