Once you have instantiated an OSLC client, you can use the UpdateCollection class to add (or remove) a requirement in a DOORS Next Generation Collection.
The first step is to access the existing content of a DOORS Next Generation Collection. 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 collection was not modified by another user meanwhile.
OslcClient client = OslcClients.jazzForm(new UsernamePasswordCredentials("myUser", "myPassword")).create(); // get the existing requirement URI collectionUri = URI.create("https://myServer:9443/rm/myCollection"); ResourceResponse<DngCollection> response = new GetCollection(client, collectionUri).call(); DngCollection collection = response.getEntity(); String eTag = response.getETag(); // add a reference to an existing requirement Collection<URI> requirements = Arrays.asList(collection.getUses()); requirements.add(URI.create("https://myServer:9443/rm/myRequirement")); collection.setUses(requirements.toArray(new URI[requirements.size()])); // send the update to the server new UpdateCollection(client, collectionUri, eTag, collection).call();
Creating an OSLC client
Using OSLC Configurations