Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

RM API - create implemented By link

I want to link an dng-artifact to a work item of ewm. 


Based on this I tried to create a new artifact ref for the work item:
targetLink= new RM.ArtifactRef(targetLink)

And then tried to create the link.
RM.Data.createLink(artRefsList[0][0], RM.Constants.IMPLEMENTED_BY, targetLink, function(cb){
          console.log (cb)
        })

artRefsList[0][0] is typeOf object and is used in previous function to get Attributes: RM.Data.getAttributes(
artRefsList[0][0].... and worked fine..

The error I receive by doing this: TypeError: Cannot read properties of undefined (reading 'IMPLEMENTED_BY').

Is there a way to solve this problem?

Is there another way to create a link between an artifact in Doors next in module context to a work item in EWM? I only found an article with no reference of module context: https://jazz.net/library/article/1197

0 votes

Comments

sorry the targeLink looks of cause like this:

let targetLink="https://example/ccm/oslc/workitems/_6Lv7YSJLEe-DJp-ihRXOIg"

I can not answer the first part of the question. I have no experience with that API. As far as I know there are the following other APIs that could create links between work items and requirements:

  1. The EWM Java Client SDK (plain Java Client Libraries) can create such links.
  2. The EWM OSLC API can create such links
All available APIs are listed here: https://jazz.net/wiki/bin/view/Deployment/ELMProductAPILanding

Unfortunately the OSLC Workshop is quite old. 
Here might be a better maintained one: https://oslc.github.io/developing-oslc-applications/ . There are some youtube videos as well.

I published https://rsjazz.wordpress.com/2022/02/02/ewm-work-item-oslc-cm-api/ which covers all EWM rest APIs (OSLC and Reportable Rest) as well as authentication.

It would be a good idea to create the links in the tool and then get the RDF+XML representation for both ends. To look how they are changed.



2 answers

Permanent link
You have the reference wrong - it should be RM.Data.LinkTypes.IMPLEMENTED_BY


This is the reference to the API if you haven't already discovered it:

0 votes


Permanent link

Thank you for your hints.


First I tried to change the RM.Data.createLink as described by Davyd:

 RM.Data.createLink(artRefsList[0][0], RM.Data.LinkTypes.IMPLEMENTED_BY, targetLink, function(cb){
        console.log (cb)
      })
But the result was: 
RM.OperationResult
code: "OPERATION_FAILED"
message: "You cannot create ELM links in this version of the API: [object Object]"

So my next trial was the official OSLC API and how the tool works as mentioned by Ralph. My code does now looks like:
  1. add the link to the EWM-work item
    1. Therefore first get the work item in the global configuration context:
Content-Type: text/plain
Oslc-Core-Version: 2.0
Accept: application/rdf+xml

2. GET from the answer the Etag in the header and the body
3. PUT the changed body by using the Etag as If-match in the header:
Accept: text/xml
Content-Type: application/rdf+xml
Oslc-Core-Version: 2.0
If-Match: c9981361-9bc2-34ec-88e0-d6f04ffb5d7e -- <ETAG from GET-Response before

<rdf:RDF.....--< from answer and added link looking like this:
<oslc_cm:affectsRequirement rdf:resource="https://example/rm/resources/BI_fQcOsOALEe2T6KW9b8u7AA" rdf:ID="oslc_rm_808621"/>
</rdf:Description>
<rdf:Description rdf:about="#oslc_rm_808621">
<dcterms:title>808621: All requirements that are valid for this projcet stream are created or updated in this stream by using change sets. Please do not deliver these change sets to other stream(s).</dcterms:title>
</rdf:Description>

2. add the link to the ERM-artifact:
(strange think by doing this: It works only, if the url looks like this. The characters %2F has to used instead of "/")



   



0 votes

Comments

This is called URL Encoding. You can not have certain characters used in certain areas of an URL.

1 vote

Why do the URL's look like https://example/rm/proxy? This is unusual.

I have got it from the tool handling. But you are right: GEThttps://example/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/39572


works also.

This path /rm/linksCache is not a public OSLC API. You shouldn't use it.


You should not use /rm/proxy either.

The OSLC Way to add a link from a work item to a requirement is to first GET the WI using EWM OSLC API (you already have its EWM URL don't you), update the rdf with the link and PUT the updated rdf to EWM to update the WI.

If you're not sure how to modify the rdf to add a link, look at an example of an existing link on a WI.

What can I do alternatively to  /rm/linksCache?


Only linking in EWM is not enough. I am doing this first at all. The link has additionally to be created to the artifact in ERM himself. If I do not do this, the link is not visible in ERM. We are working with change sets.

You would use the OSLC API. As an example https://rsjazz.wordpress.com/2022/02/02/ewm-work-item-oslc-cm-api/ Unfortunately I have not created an example for creating links. ERM is not storing the links. ERM has also an OSLC API.

showing 5 of 6 show 1 more comments

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,941

Question asked: Jul 15 '24, 9:53 a.m.

Question was seen: 700 times

Last updated: Jul 24 '24, 9:43 a.m.

Confirmation Cancel Confirm