Skip to main content

Combining multiple operations

For most of the write operations covered in the sections above, there is also an approach you can use to combine multiple operations together.

Optimizes changes to a single asset

This is useful when you have many changes to make to an asset. Rather than making a separate API call for each change, with this approach you can make a single API call and include all the information within it.

For example, to create a term complete with a description, parent category, announcement, certificate, several owners, and several linked assets:

Combine multiple operations
GlossaryTerm term = GlossaryTerm
.creator("Example Term", // (1)
"b4113341-251b-4adc-81fb-2420501c30e6")
.description("This is only an example.") // (2)
.category(GlossaryCategory.refByGuid( // (3)
"1b736a83-207b-4269-ab92-44d77e1aca28",
Reference.SaveSemantic.APPEND // (4)
))
.announcementType(AtlanAnnouncementType.INFORMATION) // (5)
.announcementTitle("New!") // (6)
.announcementMessage("This term is newly created.") // (7)
.certificateStatus(CertificateStatus.VERIFIED) // (8)
.certificateStatusMessage("For good measure!") // (9)
.ownerUser("jdoe") // (10)
.ownerUser("jsmith") // (11)
.build(); // (12)
AssetMutationResponse response = term.save(client); // (13)
assert response.getCreatedAssets().size() == 1 // (14)
assert response.getUpdatedAssets().size() == 1 // (15)
  1. Use the creator() method to initialize the object with all necessary attributes for creating it. For a term, this is a name and the GUID of the glossary in which to create the term. (The final null is for a qualifiedName of the glossary, which could be used instead of the GUID.)
  2. Set a description for the term.
  3. Add a category for the term. (This category must already exist, or be created before this operation.)
  4. (Optional) You can specify whether this category should be APPENDed to any categories the term is already organized within, or REMOVEd from the existing set of categories. If this argument is left out, the entire set of categories the term is linked to will be REPLACEd.
  5. Set the announcement that should be added (in this example, we're using INFORMATION).
  6. Add a title for the announcement.
  7. Add a message for the announcement.
  8. Set the certificate for the term (in this example, we're using VERIFIED).
  9. Add a message for the certificate.
  10. Add an owner.
  11. Add another owner. Note that we can just continue chaining single owners, we don't need to create our own list first.
  12. Call the build() method to build the enriched object.
  13. Call the save() method to actually create the term with all of these initial details. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  14. The response will include that single term that was created.
  15. The response will also include any related objects (the category) that were updated by this term being related to them.
Was this page helpful?