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

How Do I Save Non-WorkItems via Server-Side Java API?

I am working on developing a custom operation behavior follow-up action (Java server-side API).

I have successfully saved work items in the past by using the IWorkItemServer class. I now need to be able to save something that isn't a work item (specifically, an instance of a ITimeSheetEntry).

I thought to try and do this using the IRepositoryItemService. There is a "saveItem" function that looked promising. However, this function threw an exception with the message "Access violation in component item service."

Reading here on the forums, I found a statement by a Jazz developer that may explain this:

Save operations must be routed through the owning component's API, in this case through the work item API.

The Jazz developer was answering a question for someone on how to save Work items, so the answer doesn't really help me in my case (since I already know how to save work items) except to suggest that I can't do what I want to do via the IRepositoryItemService.

If each "component" has its own service, then I guess I just need to know what service to use for the ITimeSheetEntry item.

0 votes



One answer

Permanent link
I don't know if there is a related call in the server API. In the client API, what the adding dependent items does is in the code and looks as follows:

	SaveParameterDTO saveParameter= createSaveParameter(workingCopy);
	saveParameter.getAttachments().addAll(attachments);
	saveParameters.add(saveParameter);
				
	for (IAuditable auditable : workingCopy.getDependentItems().getAll()) {
		IAuditable copy= (IAuditable) EMFHelper.copy(auditable);
		SaveParameterDTO dependentParameter= Utils.createSaveParameter(copy, null, null, Collections.emptySet());
		dependentParameters.add(dependentParameter);
	}

It basically creates special save parameters.

0 votes

Comments

Thanks for the suggestion, but I've tried that as well. Evidently, the timesheet entry doesn't get saved because it is a "working copy" and simply adding it to the work item's references doesn't flag it to be saved. When I navigate to the work item after the follow-up action triggers, I can get a clue when I click on the Time Tracking tab. A null pointer exception is displayed. I'm assuming this is happening because there is a link to a timesheet entry, but the timesheet entry doesn't exist (since it was not saved).

I suspect I need a way to explicitly tell RTC that the working copy timesheet entry is a dependent item of the work item. That's what I've seen in some examples of client-side code. However, I can't seem to find an equivalent server-side function for that. I haven't seen this "Utils" code before so maybe I can search for a server-side equivalent for that. Thanks for weighing in.

Sorry, I couldn't find an obvious solution.

 I think you would use IAuditableCommon.saveProcessItem() cause it hangs off the process area

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
× 411
× 234

Question asked: Apr 06 '15, 1:34 p.m.

Question was seen: 4,955 times

Last updated: Apr 07 '15, 9:14 a.m.

Confirmation Cancel Confirm