Adobe IO : Launch API : Translator Class

The translator class is not a required class or group of methods for the pylaunch module to work. You may want to rewrite some of the functionalities for your own use. However, as I was developing and using this wrapper, it became obvious that a method which will help me to translate the id of the extension or the rule from each individual property into other property extension id or rule id would be very helpful.

The translator class facilitate the copy paste of element from one property to another. It is useful especially for the Rule Component and Data Element creation where relationships with rule and extension id are required for creation.
I will try to explain how it work in the following paragraph.

The instantiation of the translator class is very basic as you would just need to call for it.

Set Base Rule and Extensions ids

What is really required is the base property extensions and rules. The id of the elements from your “mother” property.
This is an assumption that I have when I created this facilitator, you would have a blueprint that you will use to copy elements from.

The translator class provide 2 methods to add base rule and base extension ids:

  • setBaseExtensions
    Pass all the extensions from the base property to start building the table.
    Arguments:
    • base_property : REQUIRED : list of all extensions retrieve through getExtensions method
    • property_name : REQUIRED : name of your base property.
  • setBaseRules
    Pass all the rules from the base property to start building the table.
    Arguments:
    • base_property : REQUIRED : list of all rules retrieve through getExtensions method
    • property_name : REQUIRED : name of your base property.

Set target Rule and Extensions ids

Once you have loaded the base Extension and Rules ids, the method will start to expand the table into multiple columns for matching. Underlying is the use of pandas dataframe to realize that matching.
You will need to be consistent with the naming of your target in order for the method to work properly.
The methods that allow extension of your table are the following:

  • extendExtensions
    Add the extensions id from a target property.
    Arguments:
    • new_property_extensions: REQUIRED : the extension list from your target property.
    • new_prop_name : REQUIRED : target property name.
  • extendRules
    Add the extensions id from a target property.
    Arguments:
    • new_property_rules: REQUIRED : the rules list from your target property.
    • new_prop_name : REQUIRED : target property name.

Translating elements

Every translator jobs is to translate, then the final method is actually the translate method.

  • translate
    change the id from the base element to the new property.
    Pre checked should be done beforehands (updating Extension & Rules elements)
    Arguments:
    • target_property : REQUIRED : property that is targeted to translate the element to.
    • data_element : OPTIONAL : if the elements passed are data elements.
    • rule_component : OPTIONAL : if the elements passed are rule components

Code Example

I know that this class is not easy to comprehend and I would recommend you to watch the video tutorial if you have any doubt.
You can also use the the contact form or comment the article if you have any question.

I hope this post helps you to better understand the pylaunch Translator class methods.
You may be interested in the articles that explains a bit more about the different components of the pylaunch module.

ArticlesComments
Adobe IO : JWT authenticationHow to create JWT authentication with OpenSSL and python
Adobe IO : Launch API : Introduction to pylaunchWhat you need to know about this module
Adobe IO : Launch API : Core Component The methods directly available from this module.
Adobe IO : Launch API : Property ClassWhat is the Property class and how to use it to manage your Launch properties
Adobe IO : Launch API : Library ClassHow to manage your publishing process through pylaunch, in python
Adobe IO : Launch API : Translator ClassA Facilitator in pylaunch in order to copy paste the element from one property to another.
Adobe IO : Launch API : TutorialVideo tutorial on some methods available from the pylaunch module. Not everything is covered in the video.

Leave a Reply

Your email address will not be published. Required fields are marked *