It's all about the answers!

Ask a question

Export process template from project area via API: Why do file name suffixes in change between subsequent exports?

Richard Pohl (2134) | asked Feb 09 '16, 6:35 a.m.
edited Feb 09 '16, 6:38 a.m.

First, I have to mention that I use a custom tool for export/importing process templates via RTC Plain Java Client API).

What I target at with this question is understanding the process of how and when the (inner zip file in the template's export zip file) is generated during export via API. Just to give you an overview – the following workflow steps lead me to my question:

  1. Create a new project area (PA) from a template on RTC.
  2. Export the template from this PA with the mentioned tool. This includes downloading and extracting the template ZIP file and moving/renaming some files in the attachments.
  3. Update a project area on RTC with content from the template on the local file system using the tool from step 2. No changes in the exported template between step 2 and step 3.
  4. Export the template from RTC again as in step 2.
After this, I use a merge tool (in my case BeyondCompare 3) to merge the directory created in step 4 into the directory created in step 2. This works perfectly with one exception. The file shows a difference. When I look into it, it contains for example the following files:

left side:

right side:

All files on the left side have the same suffix in their file name (printed in bold in the above example). The same for the right side. But the suffixes are different between left and right. Where do the suffixes come from? Why do they differ?

It would help me a lot if someone could tell me what the suffix of the files in the means (e.g. "_zn7qQMTvEeW-ibGVJnpTpA.zh_TW._zn7qT8TvEeW-ibGVJnpTpA"). To me it looks like a UUID. Why does it change between subsequent exports? Is it because I update the PA content with my tool or is it just generated during the export of the template. Is there a way to avoid this behavior (e.g. to make this suffix constant between subsequent exports)?

Side note: The API calls used to export the template from a PA in my tool:
IProcessDefinition definition =((ProcessClientService) this.service).createProcessDefinitionFromProjectArea(projectAreaHandle,this.rtcProjectAreaName, this.rtcProjectAreaName.toLowerCase(), "", this.monitor);
IContent content =((IProcessInternalClientService) this.teamRepo.getClientLibrary(IProcessInternalClientService.class)).createProcessDefinitionExportZip(definition.getItemId().getUuidValue(), new SubProgressMonitor(subProgressMonitor, 200));
I would really appreciate any hint on this topic.

Best regards,

Accepted answer

permanent link
Richard Pohl (2134) | answered Feb 10 '16, 11:25 a.m.
I played around a little with the source code of the tool.

The following changes seem to produce the behaviour I actually require.
definition = findExistingProcessDefinition();
if (definition == null) {
definition = ((ProcessClientService) this.service).createProcessDefinitionFromProjectArea(projectAreaHandle,this.rtcProjectAreaName, this.rtcProjectAreaName.toLowerCase(), "", this.monitor);
/* ... (export as shown above) */
// REMOVED deleteCreatedProcessDefinition(definition);
Is this a safe solution? Does it have any side effects? I mean are there cases where some external instance deletes the process definition and it will be created again?

The reason why I am asking is that I suspect that the person who originally wrote the code had some reason for doing it the way it is.
Ralph Schoon selected this answer as the correct answer

Ralph Schoon commented Feb 10 '16, 12:09 p.m.

If you use the API, there is always a risk that you do something wrong. As long as you don't store the process definition as a template, you should be fine, I guess. A reason why the UUID was used, was maybe to prevent issues with storing it.

One other answer

permanent link
Ralph Schoon (63.2k33646) | answered Feb 10 '16, 4:03 a.m.
You create a process definition from a process area. Each time you do this, the process definition is a new item that potentially needs to be stored in the process template section. So, I would assume that the value you see is the unique UUID created for this process template.

Richard Pohl commented Feb 10 '16, 11:08 a.m.

Thank you for your reply. I checked it and you are right. The suffix is the UUID of the process definition. Do you see any option to prevent it from being generated into the file names? Or is it possible to reuse the process definition among several exports?

Your answer

Register or 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.