cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to fetch suspect relationship flags via CLI (Java)

jdicks
1-Newbie

How to fetch suspect relationship flags via CLI (Java)

Hello!

we have questions regarding item information fetched via the Java CLI API.

Basically we're doing the following: Firstly we're initializing a Java POJO structure based on the results of im_issues commands for each item type and its fields we are interested in. (e.g. for Features, Requirements & Tests) In a second step we are initializing the relationships between the fetched items by reading values out of their relationship fields. (e.g. "Feature Includes Req", "Validated By").

As a next step we also want to provide the suspect information for relationships between e.g. Feature -> Requirement within our simple POJO structure. I already had a look into the documents but couldn't find a proper solution to fetch 'relationship flags'. To avoid performance issues i would prefer using the im_issues command and keep the count of executed commands low. is it possible to do it with the im_issues command? What is the best way to fetch suspect information for concrete traces between items (not source traces)?

Thanks in advance, best regards

johannes

3 REPLIES 3
mrump
14-Alexandrite
(To:jdicks)

Hi Johannes,

I'm afraid you are heading into the wrong direction.

the "im issues" command is "limited" to give you a result-set of items and their "1.level" fields, so basically it's the RUN QUERY operation from the gui.

Using a shell and type you "im issues" command with the additional option "---xmlapi" will show you the exact XML object tree you receive.

Using the JAVA API in you POJO it's exactly the same (only that you receive a Objects instead of XML).

As said before the "im issues" command is limited; you should only use it to fetch the IDs you need.

If you need more detailed information on a specific item, you will need "im viewissue <ID>". If you try this command on a Shell (with --xmlapi) you will see that here is plenty more data available for the item in question. Especially the relationship fields include the "relationshipFlags" attribute and that is where you'll find a SUSPECT link.

HTH Matthias

KaelLizak
14-Alexandrite
(To:mrump)

Hello Johannes,

Matthias is correct: im issues in this context is basically running a query, which will only give you the information you seek at the level the query is running. Unlike an SQL query, you cannot perform the SQL equivalent of joins to walk down items to collect information on related items.

Typically, to do what you are describing, Integrity Support would recommend running a muti-level report generated for the particular walk you are attempting, and you could do that with the im runreport command. The sample ALM report recipe which would apply here is Content Structure Traces - Tree View, but there are some others that might be more useful to you if your focus is specifically on suspect relationships.

Generally, report recipes output in html, but it is certainly possible to generate xml reports, and there are xml report recipe samples in the ALM bundle as well.

I hope that helps.

Regards,

Kael


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager

Hi Johannes,

I appreciate that you are trying to use the "im issues" command as this will be the best-performing when you can use it. It sounds like you are aware of the SQL analogy that "im issues" is similar to SELECT (specified fields) FROM... whereas "im viewissue" is more like SELECT(*).

Which version of Integrity are you using? In recent versions suspect information is available via the "im issues" command in the Java API. You can use the --xmlapi option as Matthias suggested to see the output.

For example, running "im issues --xmlapi --fields=References" on my server yields a line containing:

<Item id="25" context="24" relationshipFlags="xyz" target.modelType="im.Issue" modelType="im.Issue.Relationship.Out" displayId="25xyz">

that includes the relationshipFlags attribute.

Cheers,

Marcus

Top Tags