Get IChangeSetHandle from IChangeSet
Hello everyone,
I have the latest workshop setup with EWM-SDK-Server-7.0.2 and try to develop a Java Server Side Plugin.
I'm creating a participant on the "Save Change Set Links and Comments (server)" action.
Everything is running fine but for IChangeSetHandles I get some weird behaviour.
I tried different ways to get the item handle but always get the same error.
Examples:
IChangeSetHandle handle = (IChangeSetHandle) changeSet.getItemHandle();
IChangeSetHandle handle = (IChangeSetHandle) IChangeSet.ITEM_TYPE.createItemHandle(changeSet.getItemId(), changeSet.getStateId());
I would expect those to produce a IChangeSetHandle Object, but what I get is:
java.lang.ClassCastException: com.ibm.team.scm.common.internal.impl.ChangeSetHandleImpl incompatible with com.ibm.team.repository.service.vvc.model.IChangeSetHandle
For other Handles I don't have any problems (IWorkItemHandle, IWorkSpaceHandle...)
Am I doing something wrong with retrieving the handle or is maybe something wrong with my setup?
Thanks in advance.
Accepted answer
You should consider checking your imports. You likely want
com.ibm.team.scm.common.IChangeSet
and
com.ibm.team.scm.common.IChangeSetHandle
Not com.ibm.team.repository.service.vvc.model.IChangeSetHandle
It is good to carefully read the error messages, that is often the first step to a solution. I am aware that sometimes you just don't spot it.
If you set up your development environment with the SDK, you can actually open the classes. Then you can see that information below. If you want to know more about how to get there, let me know.
/