Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Exception while saving Project developmentLine

Hello,
I'm creating a project area and then associating a development line to it.

I create the developmentLine as follow:
IProcessItemService service = (IProcessItemService) repo.getClientLibrary(IProcessItemService.class);


IDevelopmentLine timeLine = service.createDevelopmentLine();
timeLine.setName(timeLineStr);
timeLine.setStartDate(startDate);
timeLine.setEndDate(endDate);
timeLine.setId("foo");

Then I set the timeLine to the project area as follow:
 

timeLine.setProjectArea(projectArea);
projectArea.addDevelopmentLine(timeLine);
projectArea.setProjectDevelopmentLine(timeLine);

When I save the project and the developmentLine with:
getProcessService().saveProcessItems(new IProcessItem[] { projectArea, timeLine });

I'm getting this 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:2049)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:247)
at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:255)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:310)
at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:626)
at com.ibm.team.process.internal.common.impl.ProjectAreaImpl.addDevelopmentLine(ProjectAreaImpl.java:1275)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

What am I doing wrong?
Thnaks

0 votes



2 answers

Permanent link
On Mon, 24 Aug 2009 10:38:03 +0000, eclipsetalk wrote:
I'm getting this exception:
Exception in thread "main"
com.ibm.team.repository.common.internal.ImmutablePropertyException

In order to modify an item in Jazz, you need to get a working copy
IItem#getWorkingCopy() is typed to return IItem, but you can safely cast
the result to whatever item type you had to begin with. For example:

projectArea = (IProjectArea) projectArea.getWorkingCopy();

--
Jared Burns
Jazz Process Team

0 votes


Permanent link
Thanks Jared, it works like a charm now.

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Aug 24 '09, 6:24 a.m.

Question was seen: 5,746 times

Last updated: Aug 24 '09, 6:24 a.m.

Confirmation Cancel Confirm