question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting AtlasSession inside custom transformations

See original GitHub issue

I am looking at adding db based lookup for atlas maps. For a given document like purchase orders, customer item id may have to be mapped to the supplier item id when the document is transformed from a customer PO to a supplier PO, The list of items will be huge to allow it all to be loaded into system properties and in a multi tenant system, that is not even possible.

I am looking at extending the default context and session to be able to associate one or more lookup objects with the session along with custom transforms to allow looking up values that are in the inbound document before they are added into the target document. There is no way to associate such an object into a session as of now, I guess and so the extended context and session objects. Even with this, the session is not getting passed into the transform functions so that I can get the requested lookup object to support this functionality. Is there anyway to get the session passed into the transform functions ?

I see an open issue 1269 that talks about injecting session into the field actions. I am looking at something like the one given below:

public class MyPurchaseOrderAction implements AtlasFieldAction
{
    @AtlasActionProcessor
    public static String poLookup(AtlasSession session, PurchaseOrderLookup action, String input)
    {
        // Get lookup object from session, call lookup with input and return the result
        LookupManager lm = (LookupManager)session.get(action.name);
        return lm.lookup(input);
    }
}

Is this the right approach or is there any existing mechanism for doing this ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sanjay-90210commented, Nov 22, 2020

Sorry, I got pulled into unrelated issues. I have filed an issue 2483 for the custom transform display issue. Please take a look.

1reaction
sanjay-90210commented, Nov 5, 2020

I saw the source and target properties in the session. I guess i can set a property without defining it in the map that does not collide with the user defined properties and sneak an object in ? I saw some types in DefaultAtlasPropertyStrategy and thought that it is validated somehow with no option to set the type from the ui and so ignored it.

private List<AtlasPropertyType> propertyOrder = Arrays.asList( AtlasPropertyType.RUNTIME_PROPERTIES, AtlasPropertyType.JAVA_SYSTEM_PROPERTIES, AtlasPropertyType.ENVIRONMENT_VARIABLES, AtlasPropertyType.MAPPING_DEFINED_PROPERTIES);

I will give it a try.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AtlasMap Developer Guide
Running AtlasMap Data Mapper UI within Syndesis ... Create/Get/Update/Remove mapping definition stored in Design Time Service local storage, ...
Read more >
Custom transformations | Confluent Documentation
See How to Use Single Message Transforms in Kafka Connect. This tutorial provides a deep dive into building your own custom transformation.
Read more >
Using Custom Transformations - Esri Community
I am trying to use some custom datum transformations in Pro. ... Is there some way to get Pro to consider custom transformations...
Read more >
Creating a custom transformation - AWS Glue Studio
With the custom transform node selected in the job diagram, choose the Transform tab. In the text entry field under the heading Code...
Read more >
Implementing custom transformations? #3749 - GitHub
I'm interested in using custom transformations for a scenario of "distributed approximate optimization" (name not determined yet).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found