Inserting a Requirement in a Module

Once you have instantiated an OSLC client, you can use the InsertRequirement class to insert an requirement in a DOORS Next Module.

This request aims at inserting an existing requirement at a specific location in the module. The CreateRequirement class can be used to create a new requirement.

	OslcClient client = OslcClients.jazzForm(new UsernamePasswordCredentials("myUser", "myPassword")).create();
	URI moduleUri = URI.create("https://myServer:9443/rm/myModule");
	URI baseRequirementUri = URI.create("https://myServer:9443/rm/myModule");

	// insert a requirement at the root of the module
	InsertLocation location = InsertLocation.root(moduleUri).build();
	ResourceResponse<Void> response = new InsertRequirement(client, baseRequirementUri, location).call();
	System.out.println("URI of the module artifact: " + response.getHeaders().getFirst("Location"));
	
	// insert a requirement below a parent and after a sibling artifact
	URI parentUri = URI.create("https://myServer:9443/rm/myParentModuleArtifact");
	URI siblingUri = URI.create("https://myServer:9443/rm/mySiblingModuleArtifact");
	InsertLocation location = InsertLocation.below(parentUri).after(siblingUri).build();
	ResourceResponse<Void> response = new InsertRequirement(client, baseRequirementUri, location).call();
	System.out.println("URI of the module artifact: " + response.getHeaders().getFirst("Location"));

Related concepts
Module

Related tasks
Creating an OSLC client
Using OSLC Configurations
Creating a Requirement

Related reference
API Reference