how to Update project area with process template content through RTC API
![]()
Hi All,
I wanted to know how to Update project area with process template content. I tried with process sharing concepts, its works fine. But i want to try with RTC API. Below is the code i tried for attaching the attachment of process template to the project area: RtcTemplateFileStructure rtcTemplateFileStructure = new RtcTemplateFileStructure(assembleTemplateDownloadPath); File attachment = new File(rtcTemplateFileStructure.readAttachmentsList() + System.getProperty("")); System.out.println("attachment :" + attachment); IProcessAttachmentHandle handle = (IProcessAttachmentHandle) IProcessAttachment.ITEM_TYPE.createItemHandle(UUID.valueOf(itemId), null); attachment.add(handle); But Its not working. |
Accepted answer
![]()
Ralph Schoon (61.8k●3●36●43)
| answered Sep 04 '15, 3:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I created an example some time ago. Please note, you can corrupt your process configuration....
In the main: Mapand /** * @param teamRepository * @param content * @param monitor * @return * @throws TeamRepositoryException */ private static IContent createContentFromString( ITeamRepository teamRepository, String content, IProgressMonitor monitor) throws TeamRepositoryException { return teamRepository.contentManager().storeContent( IContent.CONTENT_TYPE_XML, content, monitor); } /** * @param repo * @param content * @param monitor * @return * @throws TeamRepositoryException * @throws UnsupportedEncodingException */ private static String createStringFromContent(ITeamRepository repo, IContent content, IProgressMonitor monitor) throws TeamRepositoryException, UnsupportedEncodingException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); repo.contentManager().retrieveContent(content, stream, monitor); return new String(stream.toByteArray(), content.getCharacterEncoding()); } // save the process source for the project /** * @param ip * @param ic * @param icm * @param name * @param monitor */ private static void saveXMLSource(IProjectArea ip, IContent ic, IContentManager icm, String name, IProgressMonitor monitor) { // make an output stream for the content manager OutputStream os = new ByteArrayOutputStream(); // get the content of the content object. try { icm.retrieveContent(ic, os, null); // write xml content to file // project name + data name FileOutputStream fo = new FileOutputStream(ip.getName() + name + "." + "xml"); // write fo.write(os.toString().getBytes(), 0, os.toString().length()); // close fo.close(); } catch (Exception e) { e.printStackTrace(); } } ast java selected this answer as the correct answer
|
One other answer
![]()
Ralph Schoon (61.8k●3●36●43)
| answered Sep 04 '15, 2:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please see https://www.google.com/search?q=process+sharing+api+site:jazz.net and look into the first few results.
Comments Please also note that, once a process template has been applied when creating a project area, the only ways to modify the process is in the process configuration (or in a shared process configuration). The template only plays a role in the beginning.
Hi Ralph,
![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
In that case see https://www.google.com/search?q=process+configuration+source+site:jazz.net
I was able to figure the code from the posts I found.
1
Hi Ralph,
Process specification references iteration 'Release 1.0', which does not exist.
showing 5 of 6
show 1 more comments
|
Comments
Note that updating the process sharing pointer of a project area and updating the process template of a project area are two very different actions. In particular, the first is possible, and the second is not.