Getting AtlasSession inside custom transformations
See original GitHub issueI 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:
- Created 3 years ago
- Comments:13 (5 by maintainers)
Top GitHub Comments
Sorry, I got pulled into unrelated issues. I have filed an issue 2483 for the custom transform display issue. Please take a look.
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.