Once you have instantiated an OSLC client, you can use the GetRequirement class to request the content of a DOORS Next Requirement:
OslcClient client = OslcClients.jazzForm(new UsernamePasswordCredentials("myUser", "myPassword")).create(); URI requirementUri = URI.create("https://myServer:9443/rm/myRequirement"); DngRequirement requirement = new GetRequirement(client, requirementUri).get(); System.out.println("Title: " + requirement.getTitle()); System.out.println("Identifier: " + requirement.getIdentifier()); System.out.println("Primary Text: " + requirement.getPrimaryText());
The Requirement resource is described by its resource shape. The resource shape provides a collection of properties that define the attributes and links available for the requirement. The resource shape is useful to dynamically discover the content of the requirement.
ResourceShape shape = new GetResourceShape(client, requirement.getInstanceShape()).get(); for (Property property : shape.getProperties()) { System.out.println("Property: " + property.getTitle() + " - " + property.getPropertyDefinition()); Object value = ResourceProperties.getObject(requirement, property); System.out.println("Value: " + value); }
Some properties of the resource shape may reference custom attribute types, defined by the project administrator in DOORS Next. An attribute type may be an enumeration defining literals.
// custom type? URI[] range = property.getRange(); if (range.length == 1 && range[0].toString().contains("/types/")) { // query type and prints the enumeration literals (if any) AttributeType type = new GetAttributeType(client, range[0]).call().getEntity(); for (EnumEntry literal : type.getEnumEntries()) { System.out.println("Literal: " + literal.getTitle()); } }
Creating an OSLC client
Querying OSLC Resources
Using OSLC Configurations
Updating a Requirement