It's all about the answers!

Ask a question

Use API to determine folder associated with a module in Doors Next


Carl Lewis (253) | asked Oct 07, 12:42 p.m.

Hello,

I am creating a module by performing a POST request to the Requirement Creation Factory, as described here:
https://jazz.net/library/article/1197

This works fine, but I noticed that a folder for storing the artifacts of the module gets created at the same time. For example, if I call my module "Test module" then a folder called "Test module artifacts" is created.

I can't see this folder listed in any of the API responses or any of the online schemas. A "nav:parent" node indicates the folder containing the module itself (e.g., usually the project root folder), but I can't see a corresponding XML node indicating the folder for the artifacts.

What I'd like to know is:
1. Is it possible to determine to what folder is associated with a module via any of the APIs?
2. When creating a module, is it possible to modify the POST request to either not create a folder or to specify an existing folder to use?

I did find the following question relating to #1:
https://jazz.net/forum/questions/264160/get-module-content-folder-using-api

Unfortunately, the answer just says it involves a private API call and an assetFolder predicate; tantalising but not enough information for me to implement.

Thanks for your help,
Carl

One answer



permanent link
Ian Barnard (2.1k613) | answered Oct 09, 7:10 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

FYI It's possible to change the default behaviour of creating a content folder by going into the component Gear->Manage Component Properties->Module Options, and select Same folder as the module. Now when you create the module (presumably in a folder) the content folder will be below that folder.


You can use the OSLC Query Capability for folders to find the folder URL.


Comments
Carl Lewis commented Oct 09, 10:44 a.m.

Thanks Ian. While I can use the OSLC Query Capability to traverse the folder hierarchy, it just provides the title of each folder and a URL to query the subfolders. It doesn't provide any field showing associated modules that I can see. The only nodes under the folder are "dcterms:title" and "nav:subfolders". I tried including an "oslc.select=*" in case there were additional fields not included by default, but it had no effect. 

Regarding the "Module Options", this is already set to "Same folder as the module" in my project. This determines the location of the created folder itself, it doesn't allow new modules to place their artifacts in an existing folder. Thanks.


Carl Lewis commented Oct 09, 10:52 a.m.

I also tried performing a GET on the folder itself. This gives more fields but still nothing for the associated module. It has dcterms:title, dcterms:description, nav:parent (parent folder), oslc_config:component, nav:subfolders, and oslc:serviceProvider (i.e., the project services).


Ian Barnard commented Oct 10, 5:10 a.m. | edited Oct 10, 5:10 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Couple of ways to find the folder a module is in:
1. Using OSLC Query on artifacts you can query for modules (oslc.where=
rdf:type=jazz_rm:Module)
) and select the nav:folder property to be returned (oslc.select=nav:folder)  - that's the URL of folder the module is in. You'll also have to define the prefixes in oslc.prefix.
2. Using OSLC Query find modules in a folder (oslc.where=nav:folder=<FOLDERURI> and rdf:type=jazz_rm:Module) - note the < > around the folder URI is (are?) part of the syntax, i.e. required.


Ian Barnard commented Oct 10, 5:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I'm not sure if there are other reasons why core artifacts created in a module are created in a dedicated folder, but it's convenient when e.g. you want to change team ownership of all the artifacts in a module because you don't have to pick and choose from a pile of artifacts you just change ownership on the folder and its contents.


You can always create a core artifact wherever you want it then add it to the module.


Ian Barnard commented Oct 10, 5:16 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Perhaps add to your question why you need to locate the content folder?


Carl Lewis commented Oct 11, 9:38 a.m.

Thanks Ian. Regarding the two OSLC queries you propose, the "nav:folder" field you propose doesn't seem to exist (e.g., it isn't returned if I add it to the "select" query). "nav:parent" works fine (but isn't what I want).


As for why I want to know, I'm implementing a library to create/read/update/delete artifacts and modules. When you want to create a module with artifacts via the API this is done in three steps:
1. Create a module via a POST (this also creates the module content folder).
2. Create the base artifacts via a POST.
3. Update the module structure via a PUT (which creates any new module bindings).

This all works, but because the base artifacts are created in a separate operation to binding them to a module, you need to specify the parent directory in which to create them, or they will go in the root directory. So if you can't identify the content folder, the artifacts won't go there, it'll remain empty. I'd also prefer to give my users the option not to create a content folder at al.

showing 5 of 6 show 1 more comments

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.