Adding Attachments to a Project Area with Plain Java API
![]()
Hi,
we are using the plain java api libraries to modify project configurations.
Everything works fine but we have some struggle with adding attachments to out project area.
So far we had a few approaches but with none of them we could succeed.
1. The approach of Ralph Schoon (https://jazz.net/forum/questions/172606/how-to-add-process-attachement-in-a-project-area-via-the-rtc-plain-java-api) was not applicable because we do not have UUIDs which we can use
2. When creating an IProcessAttachment "processItemService.createProcessAttachment()" via the IProcessItemService we were not able to store the attachment because either the attachment had no back pointer to the process container or the process attachment did not exist for the process container, depending on which we tried to store first (ProcessArea or the ProcessAttachment). We used the following source code:
IProcessItemService processItemService = (IProcessItemService) connection.getTeamRepository().getClientLibrary(IProcessItemService.class);IProcessAttachment processAttachment = processItemService.createProcessAttachment();IProcessAttachment mutableProcessAttachment = (IProcessAttachment) processAttachment.getWorkingCopy();IContent content = connection.getTeamRepository().contentManager().storeContent( IContent.CONTENT_TYPE_UNKNOWN, (new FileInputStream(attachment)).toString(), progressMonitor);mutableProcessAttachment.setContent(content);mutableProcessAttachment.setPath(path.toString());mutableProcessAttachment.setProcessContainer(pch);mutableProcessArea.addAttachment(mutableProcessAttachment);processItemService.save(mutableProcessArea, progressMonitor);processItemService.save(mutableProcessAttachment, progressMonitor);
Can anyone guide us to a working approach? Or give a hint why ours did not work?
Thanks in advance
|
One answer
![]() Thanks thanks thanks I was going crazy and I was so close, I was missing saving the same IProcessAttachment for that didn't work.
Thank you so much.
|
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.
Comments
Have you setup the SDK and searched for examples in it? Unfortunaltely I have no running code. I think however you want to upload first e.g.