API methods for remote artifacts in Rhapsody Model Manager

The Rhapsody® API includes a number of methods for working with models that have been enabled for Rhapsody Model Manager.

Check whether a model element is a remote artifact

int isRemote()

Method in IRPModelElement, returns 1 if the element is a remote artifact, 0 if not.

Create links to remote artifacts

void createOSLCLink(java.lang.String type, java.lang.String purl)

Method in IRPModelElement, creates an OSLC link between the element and the element that is represented by the specified URL.

Links to ETM test cases and EWM work items are created on the relevant remote server and therefore require a login before new links can be created. In such cases, you can call the method IRPPackage.loginToRemoteArtifactServer before calling the method createOSLCLink. If the login method was not called, Rhapsody will open the login window as part of the link creation process.

Parameters:

  • type - one of the OSLC link types that can be created. Must be one of the typed defined in IRPModelElement.OSLCLink.Types. Note that the Derives From link type can only be used when creating a link to a requirement from DOORS Next.
  • purl - the URL for the target element

Delete links to remote artifacts

void deleteOSLCLink(java.lang.String type, java.lang.String purl)

Method in IRPModelElement, deletes the specified OSLC link from the model.

Parameters:

  • type - the link type of the OSLC link that is to be deleted. Must be one of the typed defined in IRPModelElement.OSLCLink.Types. You can also use * to represent all of the types.
  • purl - the URL for the link's target element. You can use * as the value of this parameter in order to delete all links of the specified type.

Get an element's links to remote artifacts

IRPCollection getOSLCLinks()

Method in IRPModelElement, returns a collection of all the element's OSLC links. Each item in the collection is a string that uses the format: Type=<<link type>>(newline)URL=<<linked item URL>>.

Get elements that have a specific link

IRPCollection findElementsWithOSLCLink(java.lang.String type,java.lang.String purl)

Method in IRPProject, returns a collection of all the model elements that have an OSLC link of the specified type to the specified target element.

Parameters:

  • type - the link type of the OSLC link. Must be one of the typed defined in IRPModelElement.OSLCLink.Types. You can also use * to represent all of the types.
  • purl - the URL for the link's target element. You can use * to find all the model elements that have any link of the specified type.

Get the Remote Artifact packages

IRPCollection getRemoteResourcePackages()

Method in IRPProject, returns the packages of remote artifacts.

The collection returned consists or IRPPackage objects. You can then cycle through the individual packages to access the individual remote artifacts.

Get the Rhapsody Model Manager URL for a model element

java.lang.String getRmmUrl()

Method in IRPModelElement, returns the Rhapsody Model Manager URL of the model element.

Make an existing project a Rhapsody Model Manager project

void enableRhapsodyModelManager()

Method in IRPProject - makes the active project a Rhapsody Model Manager project. This method corresponds to the Enable Rhapsody Model Manager option in the pop-up menu for projects in Rhapsody.

Log-in to remote artifact server

void loginToRemoteArtifactServer()

Method in IRPPackage - for remote artifact packages, logs in to the server that contains the artifacts in the package. The behavior is the same as that of the Login to Server... option in the popup menu for remote artifact packages: If you have logged-in to the server during the current Rhapsody session, the saved credentials are used to log in. If you have not logged-in to the server during the current session, the standard login window is displayed. Links to ETM test cases and EWM work items are created on the relevant remote server and therefore require a login before new links can be created. In such cases, you can call the method loginToRemoteArtifactServer before calling the method IRPModelElement.createOSLCLink. If the login method was not called, Rhapsody will open the login window as part of the link creation process.

Set the link type

void setLinkType(java.lang.String linkType)

Method in IRPDependency, sets the type of the link.

Parameter: the type of link. The value should be one of the values defined in IRPModelElement.OSLCLink.Types.

Specify the global configuration to use for a project

int setGlobalConfiguration(java.lang.String GCUri, java.lang.String name)

Method in IRPProject, returns 1 if the global configuration information was set correctly, 0 otherwise.

Parameters:

  • GCUri - the URI of the global configuration that should be used
  • name - the name of the global configuration that should be used

Feedback