Creating a Requirement

Once you have instantiated an OSLC client, you can use the CreateRequirement class to create a new requirement in DOORS Next Generation.

The requirement is to be created in a DOORS Next Generation folder. If the created requirement is to be used only a a specific module, you are recommended to use the Module.getAssetFolder() method to determine the default folder in which to create such artifact. The InsertRequirement class can be used to create add a newly created requirement into a module.

	OslcClient client = OslcClients.jazzForm(new UsernamePasswordCredentials("myUser", "myPassword")).create();
	
	CreationFactory creationFactory = ...; // creation factory for requirements, as defined by a service provider
	
	requirement.setTitle("My Requirement ");
	requirement.setPrimaryText("<div xmlns=\"http://www.w3.org/1999/xhtml\">This is the text of requirement</b></div>");
	requirement.setParentFolder(folderUri);
	requirement.setInstanceShape(creationFactory.getResourceShapes()[0]);
	
	ResourceResponse<Void> response = new CreateRequirement(client, creationFactory.getCreation(), requirement).call();
	System.out.println("URI of the requirement: " + response.getHeaders().getFirst("Location"));

Related concepts
Requirement

Related tasks
Creating an OSLC client
Using OSLC Configurations
Inserting a Requirement in a Module

Related reference
API Reference