how to solve ImmutablePropertyException exception on setting setCurrentIteration
Hello team
I am using the below code to set the currentiteration for the timeine :
IDevelopmentLineHandle[] developmentLineHandle = prjArea
.getDevelopmentLines();
developmentLine = fAuditableClient.resolveAuditable(developmentLineHandle1,
ItemProfile.DEVELOPMENT_LINE_DEFAULT, monitor);
for (IIterationHandle subiterationsHandle : subiterations) {
IIteration subiteration = fAuditableClient.resolveAuditable(
subiterationsHandle, ItemProfile.ITERATION_DEFAULT, monitor); }
developmentLine.setCurrentIteration(subiterationsHandle);
i get the below error:
Exception in thread "main" com.ibm.team.repository.common.internal.ImmutablePropertyException
at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2143)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
at com.ibm.team.process.internal.common.impl.DevelopmentLineImpl.setInternalCurrentIteration(DevelopmentLineImpl.java:766)
at com.ibm.team.process.internal.common.impl.DevelopmentLineImpl.setCurrentIteration(DevelopmentLineImpl.java:1286)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:597)
at com.sun.proxy.$Proxy18.setCurrentIteration(Unknown Source)
Let me know hat is causing the problem here ????
Thank you
Accepted answer
Please carefully read Understanding and Using the RTC Java Client API especially the part about working copy. You can not just modify stuff, you usually need a modifiable item (working copy).
IProcessItemService service = getProcessItemService(); line = (IDevelopmentLine) service.getMutableCopy(line); line.setCurrentIteration(current); service.save(line, null);
Comments
Thank You for the reply :)
It worked
The point of my reply was what to do and how to get at this information. It took me longer to type the response than to search for the API. If you want to continue with this kind of work, you should learn how to find API examples in the SDK.