Updating content in WSRR

You update WSRR content by using the update method.

The following example demonstrates retrieving a WSDLDocument, adding user-defined properties, and a user-defined relationship, and then updating it:

try {
    // set the bsrURI to the value of a stored WSDLDocument
    // and retrieve the WSDLDocument
    String wsdlBsrUri = "wsdlBsrUri";
    WSDLDocument documentStored = (WSDLDocument) client.retrieve(wsdlBsrURI);
    
    // add user-defined properties
    BSRSDOHelper.INSTANCE.addProperty(documentStored, "prop1", "value1");
    BSRSDOHelper.INSTANCE.addProperty(documentStored, "prop2", "value2");

    // set the conceptBsrUri to the value of a concept (GenericObject) that
    // you want to relate the wsdl document to, and retrieve the concept
    String conceptBsrUri = "conceptBsrUri";
    GenericObject businessConcept = (GenericObject) client.retrieve(conceptBsrUri);

    // add a user-defined relationship, from the wsdl document to the concept
    BSRSDOHelper.INSTANCE.addRelationship(documentStored,
                                        "requiredConcept", businessConcept);
    // update the wsdl document
    client.update(documentStored);

} catch (ServiceRegistryException e) {
    // handle exception
}
Note: You cannot add a relationship from an object to a second object unless that second object has already been persisted in the registry. Furthermore, if, in the above example, the concept is modified in any way, then calling update on the WSDL document will not result in the concept modifications also being persisted; you must separately update the concept object.

The following subtopic describes how to update a GenericObject collection: