Upload some javascript on the project area with api java or rest
Hi everyone I'm back here, I've been around forums and internet in general for days but I'm not finding ideas for what I need.
Accepted answer
I always found on this forum, a user who created them completely from 0 and encountered problems, but taking advantage of what he had posted here:
Here is the source if it can be useful to someone else:
FileOutputStream file = om.saveJSSource(projectAreaParent, a, icm, ipA.getName(), monitor); InputStream inputstream = new FileInputStream("Path"+ ipA.getName()); IContent contenuto = icm.storeContent("application/octet-stream", IContent.ENCODING_UTF_8, LineDelimiter.LINE_DELIMITER_NONE, inputstream, null, monitor); ipA = (IProcessAttachment) processItemService.getMutableCopy(ipA); ipA.setContent(contenuto); processItemService.save(ipA, monitor); projectAreaParent.addAttachment(ipA); processItemService.save(projectAreaParent, monitor);As you can see I execute the outputStream only because to do the tests I made the modification manually.
2 other answers
The upload is stored in the database:
Comments
Yes I had read something about ITeamRepository.contentManager() and I had also read that it was not supported and that the modification is not always effective anyway, because it leads to further modifications often. I have to study what you are talking about well, but do you have any examples? I could not find much unfortunately. Anyway thanks, I will update the post if I find something.
I provided what I have in my comment to here: https://jazz.net/forum/questions/276558/copy-ccm-process-template-changes-to-all-project
As for the "download" of the files I found the solution. The problem, however, now I have it for loading it, if I look for a method to load something I understand that you have to use the "storeContent" method, only this has various signatures, some of which are "deprecated" and others not deprecated there is not a shred of description on what it wants, for example there is one that wants String, String and more, the others have come to replace them, but the two strings I have no idea what they can represent, I don't know if you have any ideas or other .... I still continue to try to understand to find a solution.
[code]
IProcessAttachmentHandle[] listJs = projectAreaParent.getAttachments();
IProcessAttachment ipA = (IProcessAttachment)teamRepository.itemManager().fetchCompleteItem(ipAh, IItemManager.DEFAULT, null);
[/code]