Main Content

commit

Send local changes to OSLC service provider

Since R2021a

    Description

    status = commit(resource,myClient) sends the local changes for the resource object resource to the Open Services for Lifecycle Collaboration (OSLC) service provider associated with myClient and returns the commit success status.

    example

    Examples

    collapse all

    This example shows how to submit a query request for requirement resources with a configured OSLC client, edit an existing requirement resource, and commit the changes to the service provider.

    After you have created and configured the OSLC client myClient as described in Create and Configure an OSLC Client for the Requirements Management Domain, create a query capability for the requirement resource type.

    myQueryCapability = getQueryService(myClient,'Requirement');

    Submit a query request to the service provider for the available requirement resources.

    reqs = queryRequirements(myQueryCapability)
    reqs = 
    
      1×30 Requirement array with properties:
    
        ResourceUrl
        Dirty
        IsFetched
        Title
        Identifier

    Assign a requirement resource to the variable myReq. Retrieve the full resource data from the service provider for the requirement resource. Examine the Title property.

    myReq = reqs(1);
    status = fetch(myReq,myClient)
    status = 
    
      StatusCode enumeration
    
        OK
    title = myReq.Title
    title =
    
        'Requirement 1'
    

    Edit the requirement title and commit the change to the service provider.

    myReq.Title = 'My New Requirement Title';
    status = commit(myReq,myClient)
    status = 
    
      StatusCode enumeration
    
        OK

    Open the requirement resource in the system browser by using the show function.

    show(myReq)

    Input Arguments

    collapse all

    OSLC client, specified as an oslc.Client object.

    Output Arguments

    collapse all

    Commit success status, returned as a matlab.net.http.StatusCode object.

    Tips

    • When you use commit, there are two common causes of error:

      1. You do not have the required permissions from the system administrator to commit.

      2. The RDF/XML data for a locally cached resource object is either missing elements required by the service provider or is otherwise incorrectly configured.

      The returned error message contains information about why the commit operation failed. If the error is due to incorrectly configured RDF/XML data, use getRDF to see if the locally cached resource object contains the elements and attributes that are required by the service provider.

    Version History

    Introduced in R2021a