-2

I'm trying to teach myself Maximo automation scripting.

I've come across a script in the Maximo help. I want to try to understand how it works.

But first, what programming language is it written in?

service.log("I want to multiply 2 numbers and log the result")
from java.util import HashMap
a=3
b=2
ctx = HashMap()
ctx.put("x",a)
ctx.put("y",b)
service.invokeScript("MULTIPLY",ctx)
service.log("the result is "+str(ctx.get("z")))

Edit:

I've found a similar-looking script that is labelled as being JS (download PDF):

importPackage(java.util)
importPackage(Packages.psdi.server)
var ctx = new HashMap();
ctx.put("url","http://localhost:7001/maximo/oslc/script/countryapi?_lid=wilson&_lpwd=wilson");
service.invokeScript("LIB_HTTPCLIENT",ctx);
var jsonResp = ctx.get("response");
var countries = JSON.parse(jsonResp);

However, it has semicolons at the end of each line, whereas the first script does not.

I don't know if that helps or not.

User1974
  • 276
  • 1
  • 17
  • 63
  • @JackBashford Ok. Sure. You're probably right. The reason I wasn't sure is: In Maximo scripting, I can use java libraries in many languages/scripts (for example, python). So, I see lots of references to `java.util` in python code (and other languages that aren't java). – User1974 Aug 13 '19 at 00:33

1 Answers1

2

From the docs:

The source code must be written in the languages that are supported by the following script engines:

  • Mozilla Rhino, version 1.6 release 2
  • Jython, version 2.5.2

Your first snippet looks like Jython. The second looks like Javascript (Rhino).

shmosel
  • 49,289
  • 6
  • 73
  • 138