Updating a Requirement

Once you have instantiated an OSLC client, you can use the UpdateRequirement class to update the content of a DOORS Next Generation Requirement.

The first step is to access the existing content of a DOORS Next Generation Requirement. At this stage it is critical to keep track of the ETag part of the response. This ETag is to reference in the update request, so that DOORS Next Generation can ensure the requirement was not modified by another user meanwhile.

	OslcClient client = OslcClients.jazzForm(new UsernamePasswordCredentials("myUser", "myPassword")).create();
	
	// get the existing requirement
	URI requirementUri = URI.create("https://myServer:9443/rm/myRequirement");
	ResourceResponse<DngRequirement> response = new GetRequirement(client, requirementUri).call();
	DngRequirement requirement = response.getEntity();
	String eTag = response.getETag();
	
	// change the title of the requirement
	requirement.setTitle(requirement.getTitle() + " (updated)");
	
	// send the update to the server
	new UpdateRequirement(client, requirementUri, eTag, requirement).call();

Related concepts
Requirement

Related tasks
Creating an OSLC client
Using OSLC Configurations

Related reference
API Reference