This is an old revision of the document!
Using a MAP property in a ValueObject
This article covers the advanced topic of using a MAP property in a ValueObject to pass multiple key/value data pairs to another component or bean in MIStudio or TransSECS. Using a ValueObject with a MAP property is a convenient way to pass multiple values to a script. This will be the focus of this article.
Some beans have mapTriggers (i.e., TriggeredHistorical) which requires a ValueObject input with a MAP property). There is a TriggeredHistorical example here: Scripting for Database Servers (in MIStudio and TransSECS) which needs a LinkedHashMap.
Setting up the ValueObject "MAP" Property
ValueObjects can have user defined “properties” attached to them by using the .setProperty() method on the ValueObject. For this article we will use a property called “MAP” which is a Java HashMap object. A LinkedHashMap is required by some ErgoTech beans as can be seen in the JavaDocs, but for this example we only need the regular HashMap.
To use a HashMap in your code you will need to start your script with this definition:
HashMap = Java.type("java.util.HashMap");
For each ValueObject type you will also need to declare these definitions (for this example we will use a LongValueObject and a StringValueObject)
