Destination State Consistency - Api Client Java Batch

Good morning everyone.
I'm looking for a clean way to check if the action assigned to a WorkItem is among the valid ones on the client side.
Now on the server side I have the method that does it, through IWorkflowInfo, I can retrieve the permitted states and I do a simple consistency check between what is set and those permitted.
I tried to replicate the same feature on the client side too, but I can't, when I go to do:
IWorkflowInfo workflowInfo = (IWorkflowInfo) teamRepository.getClientLibrary(IWorkflowInfo.class); this object is null, even if it doesn't report any errors in compilation, I don't think I'm missing libraries or anything else, it's more likely that there is no such functionality on the client side. Having said that, is there a way to get the permitted actions / states, from a starting state? Of course on the client side? I tried to search on Jazz and on google, but maybe I'm using the wrong words, unfortunately I didn't find what I'm looking for. Thanks to everyone in advance.
Accepted answer

com.ibm.team.workitem.common.workflow.IWorkflowInfo is part of the common API which typically exists on the client and on the server. You can get the workflow info using IWorkItemCommon.findWorkflowInfo(). E.g. IWorkflowInfo wfInfo = getWorkItemCommon().findWorkflowInfo(workItem, getMonitor());
The work item commandLine has example code. Also examples: https://rsjazz.wordpress.com/?s=IWorkflowInfo&submit=Search and https://rsjazz.wordpress.com/2012/11/27/resolve-parent-if-all-children-are-resolved-participant/ shows how to iterate the states.
The work item commandLine has example code. Also examples: https://rsjazz.wordpress.com/?s=IWorkflowInfo&submit=Search and https://rsjazz.wordpress.com/2012/11/27/resolve-parent-if-all-children-are-resolved-participant/ shows how to iterate the states.
2 other answers

Thanks for the quick reply, but how do I instantiate the Common? I would have also found this:
workItemClient.findWorkflowInfo(iWorkitem, null);
Of course the workItemClient is a correctly instantiated object that you also use in the links you suggested, but it takes a long time to instantiate, maybe with common, it takes less.
Thank you very much.
Comments

IWorkitemCommon = (IWorkItemCommon) teamRepository.getClientLibrary(IWorkItemCommon.class);
1 vote

IWorkitemClient is only available in the client API. If there is common API it is usually better to use the common API.
Authentication and startup of the TeamPlatform takes around 7 seconds. If the services are instantiated on the server, getting such a service is very quick.