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

Retrieve links from files under scm via API

 Hi,


is there a way to retrieve the metadata, in particular the links from a file in scm pointing to QM testcases, using the plain Java or OSLC API?

Thank you!

0 votes


Accepted answer

Permanent link
Julian,

The following service call on the IScmService which can be invoked from plain java will give you all the links associated with one or more SCM files:

    /**
     * Get related artifacts for the specified versionable states.
     *
     * @param itemStateHandles
     *      Versionable item handles including the state. Must not be {@code null} and
     *      all elements must not be {@code null} and have a state ID.
     * @param gcURL
     *      The URL of the global configuration in which the results should be resolved.
     *      if this field is {@code null}, this method will only return outgoing links
     *      and the related artifact URIs may not point to a concrete resource.
     * @param options
     *      Options; See {@link #LINK_FETCH_OPTIONS} for all options.
     * @param monitor
     *      Progress monitor.
     * @return
     *      An array with an element for each handle in {@code itemStateHandles}. The value of each element
     *      contains all of the related artifacts for the corresponding state handle.
     * @throws TeamRepositoryException
     *      If the operation fails.
     * @since 0.11.0.4 (RTC 6.0.4)
     */
    public RelatedArtifactsDTO[] getRelatedArtifacts(IVersionableHandle[] itemStateHandles,
            String gcURL, String[] options,
            IRepositoryProgressMonitorHandle monitor)
            throws TeamRepositoryException;

If you have any further questions, let me know.
Michael
Julian Hemm selected this answer as the correct answer

0 votes

Comments

Thank you Michael, that works pretty well.

I did not find an option to add a new RelatedArtifact using the ScmService, which would be my next use-case.
I would appreciate if you could give some hint on this as well.
Thanks a lot! 

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,937
× 7,495
× 1,325
× 1,202
× 92

Question asked: Nov 05 '20, 5:30 a.m.

Question was seen: 994 times

Last updated: Nov 23 '20, 8:57 a.m.

Confirmation Cancel Confirm