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
Ralph Schoon (63.5k●3●36●46)
| answered Oct 15 '21, 7:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Oct 15 '21, 7:42 a.m. 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.
/
Fabian Best selected this answer as the correct answer
Comments
Fabian Best
commented Oct 15 '21, 7:48 a.m.
I had "com.ibm.team.repository.service.vvc.model.IChangeSetHandle" in the imports.
Replacing that with "com.ibm.team.scm.common.IChangeSetHandle" worked for me.
Thanks a lot!
|
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.