Skip to content

Applications Component

Used to sync applications from a source instance to a destination instance of Swimlane.

sync_application

This method syncs a single application from a source instance to a destination instance.

Once an application_id on a source instance is provided we retrieve this application JSON. Next we remove the tracking_field from the application since Swimlane automatically generates a unique value for this field.

We create a map of the old (source) tracking-id to the new (destination) tracking-id. This is used to update tasks that utilize it as an input as well as any reference fields within applications.

If workspaces are defined in the application and do not currently exist will attempt to create or update them using the Workspaces class.

If the source application does not exist on the destination, we will create it with the same IDs for

  1. application
  2. fields
  3. layout
  4. etc.

By doing this, syncing of applications (and their IDs) is much easier.

If the application exists, we proceed to remove specific fields that are not needed.

Next, we check for fields which have been added to the source application but do not exist on the destination instance. If fields are found we add them to the destination object.

Next, we check to see if the destination has fields which are not defined in the source instance. If fields are found, we then remove them from the layout view of the source application. This equates to moving them to the "hidden" field section within the application builder so they can still be retrieved and reorganized as needed.

Finally, we update the application on the destination instance.

After updating the application we then check to ensure that the workflow of that application is up to date and accurate.

The last step after syncing all applications is to check all the applications reference fields for the old (source) tracking-ids and replace them with the new (destination) tracking-ids and update those applications one last time.

Args: application_id (str): A source application ID.

def sync_application(self, application_id: str)

get_reference_app_order

This method creates an order of applications to be added or updated on a destination instance based on most to least reference relationships. For example, a source application that references 5 applications will be before an application which has 3 references to applications.

Returns: dict: An reference application ordered (sorted) application dictionary

def get_reference_app_order(self)

sync

This method will sync all applications on a source instance with a destination instance.

def sync(self)