Does anyone know of any good resources for groovy development specific to Orchestrator? I have found that what runs in Groovy console does not run in Orchestrator, and I am hoping there are examples specific to E1.
I don't know of a specific resource for Groovy that is specific to Orchestrator. There are some examples in Oracle support. Generally, I try to search for very specific examples such as how to parse or write a csv file or how to iterate through an array. Usually specific examples can be applied from Groovy sites and tutorials. @DaveWagoner is a strong proponent of ChatGPT and asking it to generate scripts which he then incorporates into Orchestrator.
There's a few things I've discovered along the way:
No matter what:
You need to translate whatever you find to work within the framework provided by Oracle for Orchestrator. orchAttr, etc.
Treat inputs as strings, and outputs as strings. Worry about type within your script, but outside of it, it's the wild west.
Your groovy install comes with a few javalibs preinstalled by default. Your CNC may have added others for convenience. You may run into the need to find and install additional java libraries so that more advanced things will work, such as encoding JWT's, or even more basic things such as specific date manipulations.
Pre-ChatGPT, timescale hours/days/weeks depending on complexity:
Figure out what you want to do, have a general idea of the library you want to use (such as JsonSlurper), and then google it
Chances are that'll take you to stackoverflow or similar site with a code snippet for you to try
Read the stack script, understand (there is a chance that someone pasted bad/dangerous code)
copy and paste it into your orch framework, fuss with a few things to make it fit, and test.
You probably run into an error, figure it out, rinse and repeat the previous steps, until you have a working script
Post-chatGPT, timescale minutes/hours depending on complexity:
Use chatGPT4- worth the $, will pay for itself with your first major use in time saved
Have example input ready to go. Use plain english to describe to chatGPT what you want it to do with your input, and groovy
ChatGPT will generate an answer for you, with code comments and explainations.
Read it and understand (this is important, there is a chance that GPT will generate bad/dangerous code)
Copy and paste into your orch framework, and fuss with a few things to make it fit, and test
It might error- loop back with ChatGPT telling it the error, and it will explain the error and generate a new script for you. IN my experience, if your error is due to missing libraries that ChatGPT assumed were present, it will write workarounds that work with more basic environments.
Groovy (and my understanding jython) is easy to read, top to bottom-- there aren't weird codewords or symbols for the most part, so the learning comes if you are a bit reflective as you work towards a specific goal. Groovy's been around a long time so there is a large body of work out there for you to discover if you go that route. ChatGPT speeds up the search by an order of magnitude.