Skip to main content

Restoring assets

Restoring an asset from an archived (soft-deleted) state back to active uses a similar pattern to the deletion operations.

By qualifiedName

To restore an asset by its qualifiedName:

Restore an asset by its qualifiedName
boolean restored = GlossaryTerm
.restore(client, "gsNccqJraDZqM6WyGP3ea@FzCMyPR2LxkPFgr8eNGrq"); // (1)
  1. If an asset with the provided qualifiedName exists and is now active, the operation will return true. If no archived (soft-deleted) version of the asset could be found the operation will return false. Because this operation will restore the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

In bulk

To restore a number of assets at the same time, for example after retrieving them via a search:

Restore assets in bulk
List<Asset> toRestore = client.assets.select(true) // (1)
.archived()
.stream() // (2)
.limit(50) // (3)
.collect(Collectors.toList()); // (4)
AssetMutationResponse response = client.assets.restore(toRestore); // (4)
response.getUpdatedAssets(); // (5)
  1. You would want more to your search criteria than this, but the true sent to the select(true) will make sure archived (soft-deleted) assets are returned, while the .archived() will make sure only archived assets are returned.

  2. Run the search to retrieve such results, and page through them automatically.

  3. Limit the results to some maximum number, as you will need to limit how many you try to restore at the same time to avoid timeouts or other issues.

  4. You can collect up the assets to be restored into a list from the stream.

  5. You can then simply pass the results of the search across to the restore operation to re-activate all of them en masse.

    The restore will only be run on that limited set of results

In this example, the restore is only running on the first set of 50 results. To restore all assets that match the search criteria, don't forget to loop over this logic or create your own batching mechanism to process all pages! ::: 5. You can retrieve the details of the specific assets that were restored from the bulk restore response.

Was this page helpful?