Skip to content

Conversation

@wherestheguac
Copy link

I took a stab at adding support for Database Result classes in CallableLogger. I added parameters to take in single result objects as well as a list, and added a parameter to pass through the type of result. I didn't bother adding support to pass through a recordId since that can already be accomplished through the 'recordId' parameter.

I ended up adding two generic implementations of LogEntryEventBuilder.setDatabaseResult to allow the log builder to take in a generic list of type Object, or a single Object instance. I went with this vs trying to route the result(s) through the overloaded methods because there isn't really a way to cast in Apex using the System.Type that I'm aware of, and LogEntryEventBuilder.setDatabaseDetails is already abstracted to take in a List<Object> parameter anyway. It's not exposed through the Logger class so I figured it would be fine.

Currently the 'resultType' parameter would not be required, since there is a call: resultType.getName(); in LogEntryEventBuilder.setDatabaseDetails that I switched to resultType?.getName(); to handle the case where the 'resultType' parameter is not passed to CallableLogger.

I also added methods to LoggerMockDataCreator to create lists of mocked Database Result objects and updated Logger_Tests to use those methods as well.

I didn't update the Nebula Logger Demo Omniscript since the other record parameters weren't in there either.

Tests were passing when I ran through the github build actions locally but I'll update the branch if anything fails.

Let me know if there is anything else that needs to be taken into consideration here.

@wherestheguac
Copy link
Author

Related issue: #903

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant