please help! cannot modify - ITimeSheetEntry
![]()
I'm trying to modify ITimeSheetEntry objects in RTC 3.0.1.
code IWorkItemWorkingCopyManager wcm = workItemClient.getWorkItemWorkingCopyManager(); wcm.connect(handle, IWorkItem.FULL_PROFILE, null); WorkItemWorkingCopy wc = wcm.getWorkingCopy(handle); IWorkItemReferences references = wc.getReferences(); List<IReference> listReferences = references.getReferences(WorkItemEndPoints.WORK_TIME); ITimeSheetEntry newEntry = null; for (IReference reference : listReferences) { if (reference.isItemReference()) { IItemHandle iReferenceh = ((IItemReference) reference).getReferencedItem(); if (iReferenceh instanceof ITimeSheetEntryHandle) { ITimeSheetEntry newEntryTemp = (ITimeSheetEntry) itr.itemManager().fetchCompleteItem(iReferenceh, IItemManager.DEFAULT, null); .... ...... if(XXXXSOMEXXXX){ hours = new Double(durationHours); newEntryTemp.setHoursSpent(hours); IItemReference timesheetRef = IReferenceFactory.INSTANCE.createReferenceToItem(newEntryTemp); //copy the references IWorkItemReferences copyReferences = wc.getReferences(); copyReferences.add(WorkItemEndPoints.WORK_TIME, timesheetRef); IDetailedStatus result = wc.save(null); break; } } } } } if (newEntry == null) { System.out.println("NEWWW"); //create a new time sheet entry newEntry = workItemClient.createTimeSheetEntry(iProjectArea.getProjectArea()); int durationHours = Integer.parseInt(duration); newEntry.setHoursSpent(new Double(durationHours)); the error com.ibm.team.repository.common.internal.ImmutablePropertyException at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2060) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:280) at com.ibm.team.workitem.common.internal.model.impl.TimeSheetEntryImpl.setInternalTimeSpent(TimeSheetEntryImpl.java:553) at com.ibm.team.workitem.common.internal.model.impl.TimeSheetEntryImpl.setHoursSpent(TimeSheetEntryImpl.java:961) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) |
Be the first one to answer this question!
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.
Comments
I have not tried that, but I would try to get a workingcopy of the timesheet entry you created. I would also search the SDK for the method you use and have a look near to references in the SDK to see if it is used.
Ok I will try, thanks for your support