Creation of Child Iterations
I have to extend a child iteration for several timelines. With the help of understanding and using the rtc java client api I was able to get the right parent iteration. Creating a new Iteration in general was also not an issue but now I struggle in adding this iteration as child. Here's the my actual code:
IIteration planIteration = deveLineHelper
.findIteration(owningProcessArea.getProjectArea(),
path, DevelopmentLineHelper.BYLABEL);
IIteration newIter = (IIteration) IIteration.ITEM_TYPE.createItem();
newIter.setName("iterationName");
newIter.setId("iterationID");
newIter.setStartDate(new Date(YYYY, MM, DD, HH, MM, SS));
newIter.setEndDate(new Date(YYYY, MM, DD, HH, MM, SS));
newIter.setParent(planIteration);
planIteration.addChild(newIter);
Set parent went fine so far but when adding the child it always failed with the exception:
Exception in thread "main" com.ibm.team.repository.common.internal.ImmutablePropertyException
at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2172) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374) at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:249) at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:304) at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:303) at com.ibm.team.process.internal.common.impl.IterationImpl.addChild(IterationImpl.java:1432) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:597) at com.sun.proxy.$Proxy25.addChild(Unknown Source)
Could it be that I need a workingCopy? If so how to declare it...?
But as per the Iteration Documentation I have to do the linking from both sides.
Do you have an Idea what went wrong here?
|
Accepted answer
Ralph Schoon (63.5k●3●36●46)
| answered Aug 08 '22, 2:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER For most of the items in the EWM API, you require a workingcopy, if you want to modify and save them. There are various ways how to get working copies, dependent on what you operate on. Here code I have written recently: public void processDevelopmentLine(IDevelopmentLine devLine) { if (devLine == null) { throw new RuntimeException("Timeline must not be null"); } boolean dirty = false; IDevelopmentLine workingCopy = (IDevelopmentLine) devLine.getWorkingCopy(); private ArrayList<iitem> modified = new ArrayList<iitem>(); Max Adler selected this answer as the correct answer
Comments I would suggest you perform Lab1 of https://jazz.net/library/article/1000 to have an environment with the SDK and the Plain Java Client Libraries, where you can search for the SDK source code and look at the unit tests to understand how the API works. |
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.