Maximo

 View Only
Expand all | Collapse all

Java class that uses an automation script function?

  • 1.  Java class that uses an automation script function?

    Posted Sat September 11, 2021 08:22 PM
    Edited by User1971 Tue September 14, 2021 12:00 AM
    MAM 7.6.1.2:

    It's my understanding that automation scripts can use Java classes/methods to get information.
    • Example: mbo.getString("ASSET.GEOMETRYTYPE")

    An uneducated/hypothetical question:

    I'm guessing that there are parts of Maximo where we can only use Java classes, not automation scripts.
    As a workaround, are there any Java classes that can utilize an automation script function?
    • Fake example: JavaReturnValFromAutoScript( AutoScriptFunction("ASSETNUM"))

    I imagine that might be a bit backwards. And I don't have any concrete examples of where that would be needed. I just wondered if that sort of thing could be done as a last resort in niche scenarios.
    It came to mind when thinking about this post: Use automation script function( ) in relationship where clause





  • 2.  RE: Java class that uses an automation script function?

    Posted Sat September 11, 2021 08:59 PM
    Edited by User1971 Sun September 12, 2021 02:24 AM
    From a colleague:

    "The short answer is yes. Automation Scripts can be invoked by Java and that's really the whole point of the ScriptEngine Java object, and more specifically, Jython and Nashorn. You can create a new instance of javax.script.ScriptEngine and then call the eval method, passing in a context that the script can use and also return values back to the calling Java program."