usingahashmapinavalueobject
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| usingahashmapinavalueobject [2026/01/25 20:04] – wikiadmin | usingahashmapinavalueobject [2026/01/25 21:07] (current) – [Setting up the ValueObject "MAP" Property] wikiadmin | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| Some beans have mapTriggers (i.e., TriggeredHistorical) which requires a ValueObject input with a MAP property). There is a TriggeredHistorical example here: [[usingdatabaseserverbeansinscripting|Scripting for Database Servers (in MIStudio and TransSECS)]] which needs a LinkedHashMap. | Some beans have mapTriggers (i.e., TriggeredHistorical) which requires a ValueObject input with a MAP property). There is a TriggeredHistorical example here: [[usingdatabaseserverbeansinscripting|Scripting for Database Servers (in MIStudio and TransSECS)]] which needs a LinkedHashMap. | ||
| - | ===== Setting up the ValueObject " | + | ==== Setting up the ValueObject " |
| ValueObjects can have user defined " | ValueObjects can have user defined " | ||
| Line 15: | Line 15: | ||
| </ | </ | ||
| - | For each ValueObject type you will also need to declare these definitions (for this example we will use a LongValueObject and a StringValueObject) | + | For this example we will create one ValueObject (a LongValueObject) and add a HashMap to it which will contain the values we want to pass to our script. |
| + | <code javascript> | ||
| + | LongValueObject = Java.type(" | ||
| + | </ | ||
| + | <code javascript> | ||
| + | //fill a HashMap with our key,value pairs | ||
| + | map = new HashMap(); | ||
| + | map.put(" | ||
| + | map.put(" | ||
| + | map.put(" | ||
| + | //add the " | ||
| + | |||
| + | vo = new LongValueObject(100); | ||
| + | |||
| + | vo.setProperty(" | ||
| + | |||
| + | //send it to the script | ||
| + | |||
| + | / | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== Using the MAP property in your Script ==== | ||
| + | |||
| + | An example of a script which extracts the MAP property and gets the various values based on the key | ||
| + | |||
| + | <code javascript> | ||
| + | |||
| + | if (incomingValue.getQuality()==0) { | ||
| + | |||
| + | // | ||
| + | |||
| + | vo = incomingValue; | ||
| + | map = incomingValue.getProperty(" | ||
| + | |||
| + | //you can test what class map is as a sanity check | ||
| + | print(" | ||
| + | |||
| + | value1 = map.get(" | ||
| + | value2 = map.get(" | ||
| + | color = map.get(" | ||
| + | //test color, get the r,g,b values | ||
| + | print(" | ||
| + | |||
| + | //you can use the values passed in the MAP property in your script.... | ||
| + | |||
| + | } | ||
| + | incomingValue; | ||
| + | |||
| + | |||
| + | </ | ||
usingahashmapinavalueobject.1769389473.txt.gz · Last modified: by wikiadmin
