Updating Resources

You can retrieve and update the content of resources in the repository. When you update resources, access control to those resources remains unchanged between versions. When performing an update, you have the option of incrementing the major version. If you do not choose to increment the major version, the minor version is automatically updated.

When you update a resource, the new version is created based on the specified resource attributes. When you update a resource you specify two important parameters: the target URI and a resource instance containing all the updated metadata. It is important to note that if you are not changing a given attribute (for example, the name), the attribute is still required in the instance you pass in. The relationships that are created when parsing the content are added to the specific version and are not brought forward unless specified.

For example, if you update an XDP file and it contains references to other resources, those additional references will also be recorded. Suppose that form.xdp version 1.0 has two external references: a logo and a style sheet, and you subsequently update form.xdp so that it now has three references: a logo, a style sheet, and a schema file. During the update, the repository will add the third relationship (to the schema file) to its pending relation table. Once the schema file is present in the repository, the relationship will automatically be formed. However, if form.xdp version 2.0 no longer uses the logo, form.xdp version 2.0 will not have a relationship to the logo.

All update operations are atomic and transactional. For example, if two users read the same resource and both decide to update version 1.0 to version 2.0, one of them will succeed and one of them will fail, the integrity of the repository will be maintained, and both will get a message confirming success or failure. If the transaction does not commit, it will roll back in the case of database failure and will time out or roll back depending on the application server.

You can programmatically update resources by using the Repository service Java API or web service API.

Note: For more information about the Repository service, see Services Reference for LiveCycle .

Summary of steps

To update a resource, follow these steps:

  1. Include project files.

  2. Create a Repository service client.

  3. Retrieve the resource to be updated.

  4. Update the resource.

Include project files

Include the necessary files in your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, include the proxy files.

Create the service client

Before you can programmatically read a resource, you must establish a connection and provide credentials. This is accomplished by creating a service client.

Retrieve the resource to be updated

Read the resource. For more information, see Reading Resources .

Update the resource

Set the new information in the resource and invoke the Repository service method to update the resource, specifying the URI, the updated resource, and how the version information should be updated.

Update resources using the Java API

Update a resource by using the Repository service API (Java):

  1. Include project files

    Include client JAR files in your Java project’s class path.

  2. Create the service client

    Create a ResourceRepositoryClient object by using its constructor and passing a ServiceClientFactory object that contains connection properties.

  3. Retrieve the resource to be updated

    Specify the URI of the resource to retrieve and read the resource. In this example, the URI of the resource is "/testFolder/testResource" .

  4. Update the resource

    Update the Resource object’s information. In this example, to update the description, invoke the Resource object’s setDescription method and pass the new description string as a parameter.

    Then invoke the ServiceClientFactory object’s updateResource method, and pass in the following parameters:

    • A java.lang.String object containing the resource’s URI.

    • The Resource object containing the updated resource information.

    • A boolean value indicating whether to update the major or minor version. In this example, a value of true is passed in to indicate that the major version is to be incremented.

Update resources using the web service API

Update a resource by using the Repository API (web service):

  1. Include project files

    • Create a Microsoft .NET client assembly that consumes the Repository WSDL.

    • Reference the Microsoft .NET client assembly.

  2. Create the service client

    Using the Microsoft .NET client assembly, create a RepositoryServiceService object by invoking its default constructor. Set its Credentials property using a System.Net.NetworkCredential object containing the user name and password.

  3. Retrieve the resource to be updated

    Specify the URI of the resource to be retrieved and read the resource. In this example, the URI of the resource is "/testFolder/testResource" . For more information, see Reading Resources .

  4. Update the resource

    Update the Resource object’s information. In this example, to update the description, assign a new value to the Resource object’s description field.

  5. Invoke the RepositoryServiceService object’s updateResource method, and pass in the following parameters:

    • A System.String object containing the resource’s URI.

    • The Resource object containing the updated resource information.

    • A boolean value indicating whether to update the major or minor version. In this example, a value of true is passed in to indicate that the major version is to be incremented.

    • Pass null for the remaining two parameters.

See also

Updating Resources

Quick Start (Base64): Updating a resource using the web service API

Invoking LiveCycle using Base64 encoding

// Ethnio survey code removed